@univerjs/data-validation 0.20.1 → 0.21.0-insiders.20260422-d7fcb4d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1 +1,977 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@univerjs/core`),t=require(`rxjs`);function n(e){return{type:e.type,operator:e.operator,formula1:e.formula1,formula2:e.formula2,allowBlank:e.allowBlank}}function r(e){return{error:e.error,errorStyle:e.errorStyle,errorTitle:e.errorTitle,imeMode:e.imeMode,prompt:e.prompt,promptTitle:e.promptTitle,showDropDown:e.showDropDown,showErrorMessage:e.showErrorMessage,showInputMessage:e.showInputMessage,renderMode:e.renderMode,bizInfo:e.bizInfo}}let i=function(e){return e[e.SETTING=0]=`SETTING`,e[e.RANGE=1]=`RANGE`,e[e.OPTIONS=2]=`OPTIONS`,e[e.ALL=3]=`ALL`,e}({});function a(e){"@babel/helpers - typeof";return a=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a(e)}function o(e,t){if(a(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(a(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function s(e){var t=o(e,`string`);return a(t)==`symbol`?t:t+``}function c(e,t,n){return(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let d=class extends e.Disposable{constructor(e){super(),this._logService=e,c(this,`_model`,new Map),c(this,`_ruleChange$`,new t.Subject),c(this,`ruleChange$`,this._ruleChange$.asObservable()),c(this,`ruleChangeDebounce$`,this.ruleChange$.pipe((0,t.debounceTime)(20))),this.disposeWithMe({dispose:()=>{this._ruleChange$.complete()}})}_ensureMap(e,t){this._model.has(e)||this._model.set(e,new Map);let n=this._model.get(e);if(n.has(t))return n.get(t);let r={map:new Map,list:[]};return n.set(t,r),r}_addSubUnitRule(e,t,n){let{map:r,list:i}=e,a=(Array.isArray(t)?t:[t]).filter(e=>!r.has(e.uid));typeof n==`number`&&n<i.length?i.splice(n,0,...a):i.push(...a),a.forEach(e=>{r.set(e.uid,e)})}_removeSubUnitRule(e,t){let{map:n,list:r}=e,i=r.findIndex(e=>e.uid===t);i>-1&&(r.splice(i,1),n.delete(t))}_updateSubUnitRule(e,t,a){let{map:o,list:s}=e,c=o.get(t),l=s.findIndex(e=>t===e.uid);if(!c)throw Error(`Data validation rule is not found, ruleId: ${t}.`);let u={...c};switch(a.type){case i.RANGE:u.ranges=a.payload;break;case i.SETTING:Object.assign(u,n(a.payload));break;case i.OPTIONS:Object.assign(u,r(a.payload));break;case i.ALL:Object.assign(u,a.payload);break;default:break}return s[l]=u,o.set(t,u),u}_addRuleSideEffect(e,t,n,r){if(!this._ensureMap(e,t).map.get(n.uid))return{rule:n,type:`add`,unitId:e,subUnitId:t,source:r}}addRule(e,t,n,r,i){try{let a=this._ensureMap(e,t),o=(Array.isArray(n)?n:[n]).map(n=>this._addRuleSideEffect(e,t,n,r));this._addSubUnitRule(a,n,i),o.forEach(e=>{e&&this._ruleChange$.next(e)})}catch(e){this._logService.error(e)}}updateRule(t,n,r,i,a){try{let o=this._ensureMap(t,n),s=e.Tools.deepClone(o.map.get(r));if(!s)throw Error(`Data validation rule is not found, ruleId: ${r}.`);let c=this._updateSubUnitRule(o,r,i);this._ruleChange$.next({rule:c,type:`update`,unitId:t,subUnitId:n,source:a,updatePayload:i,oldRule:s})}catch(e){this._logService.error(e)}}removeRule(e,t,n,r){try{let i=this._ensureMap(e,t),a=i.map.get(n);a&&(this._removeSubUnitRule(i,n),this._ruleChange$.next({rule:a,type:`remove`,unitId:e,subUnitId:t,source:r}))}catch(e){this._logService.error(e)}}getRuleById(e,t,n){return this._ensureMap(e,t).map.get(n)}getRuleIndex(e,t,n){return this._ensureMap(e,t).list.findIndex(e=>e.uid===n)}getRules(e,t){return[...this._ensureMap(e,t).list]}getUnitRules(e){let t=this._model.get(e);if(!t)return[];let n=[];return t.forEach((e,t)=>{n.push([t,e.list])}),n}deleteUnitRules(e){this._model.delete(e)}getSubUnitIds(e){var t,n;return Array.from((t=(n=this._model.get(e))==null?void 0:n.keys())==null?[]:t)}getAll(){return Array.from(this._model.keys()).map(e=>[e,this.getUnitRules(e)])}};d=u([l(0,e.ILogService)],d);const f={type:e.CommandType.MUTATION,id:`data-validation.mutation.addRule`,handler(e,t){if(!t)return!1;let{unitId:n,subUnitId:r,rule:i,index:a,source:o=`command`}=t;return e.get(d).addRule(n,r,i,o,a),!0}},p={type:e.CommandType.MUTATION,id:`data-validation.mutation.removeRule`,handler(e,t){if(!t)return!1;let{unitId:n,subUnitId:r,ruleId:i,source:a=`command`}=t,o=e.get(d);return Array.isArray(i)?i.forEach(e=>{o.removeRule(n,r,e,a)}):o.removeRule(n,r,i,a),!0}},m={type:e.CommandType.MUTATION,id:`data-validation.mutation.updateRule`,handler(e,t){if(!t)return!1;let{unitId:n,subUnitId:r,ruleId:i,payload:a,source:o=`command`}=t;return e.get(d).updateRule(n,r,i,a,o),!0}};let h=class extends e.Disposable{constructor(e,t,n){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._dataValidationModel=n,this._initSnapshot()}_initSnapshot(){let t=e=>{let t=this._dataValidationModel.getUnitRules(e),n={};return t?(t.forEach(([e,t])=>{n[e]=t}),JSON.stringify(n)):``},n=e=>{if(!e)return{};try{return JSON.parse(e)}catch{return{}}};this.disposeWithMe(this._resourceManagerService.registerPluginResource({pluginName:`SHEET_DATA_VALIDATION_PLUGIN`,businesses:[e.UniverInstanceType.UNIVER_SHEET],toJson:e=>t(e),parseJson:e=>n(e),onUnLoad:e=>{this._dataValidationModel.deleteUnitRules(e)},onLoad:(e,t)=>{Object.keys(t).forEach(n=>{t[n].forEach(t=>{this._dataValidationModel.addRule(e,n,t,`patched`)})})}}))}};h=u([l(0,e.IResourceManagerService),l(1,e.IUniverInstanceService),l(2,(0,e.Inject)(d))],h);var g=`@univerjs/data-validation`,_=`0.20.1`;let v=function(e){return e.SHEET=`sheet`,e}({});var y=class{constructor(){c(this,`_validatorByScopes`,new Map),c(this,`_validatorMap`,new Map),c(this,`_validatorsChange$`,new t.BehaviorSubject(void 0)),c(this,`validatorsChange$`,this._validatorsChange$.asObservable())}_addValidatorToScope(e,t){this._validatorByScopes.has(t)||this._validatorByScopes.set(t,[]);let n=this._validatorByScopes.get(t);if(n.findIndex(t=>t.id===e.id)>-1)throw Error(`Validator item with the same id ${e.id} has already been added!`);n.push(e)}_removeValidatorFromScope(e,t){let n=this._validatorByScopes.get(t);if(!n)return;let r=n.findIndex(t=>t.id===e.id);r>-1&&n.splice(r,1)}register(t){return this._validatorMap.set(t.id,t),Array.isArray(t.scopes)?t.scopes.forEach(e=>{this._addValidatorToScope(t,e)}):this._addValidatorToScope(t,t.scopes),this._validatorsChange$.next(),(0,e.toDisposable)(()=>{this._validatorMap.delete(t.id),Array.isArray(t.scopes)?t.scopes.forEach(e=>{this._removeValidatorFromScope(t,e)}):this._removeValidatorFromScope(t,t.scopes),this._validatorsChange$.next()})}getValidatorItem(e){return this._validatorMap.get(e)}getValidatorsByScope(e){return this._validatorByScopes.get(e)}};const b={type:e.CommandType.COMMAND,id:`data-validation.command.addRule`,async handler(t,n){if(t.get(e.ILogService).error("[Deprecated]: `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"),!n)return!1;let{rule:r,unitId:i,subUnitId:a}=n,o=t.get(e.ICommandService),s=t.get(e.IUndoRedoService),c={...n,rule:{...n.rule,ranges:[n.rule.range]}},l=[{id:f.id,params:c}],u=[{id:p.id,params:{unitId:i,subUnitId:a,ruleId:r.uid}}];return s.pushUndoRedo({unitID:i,redoMutations:l,undoMutations:u}),await o.executeCommand(f.id,c),!0}},x={type:e.CommandType.COMMAND,id:`data-validation.command.removeRule`,handler(t,n){if(t.get(e.ILogService).error("[Deprecated]: `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"),!n)return!1;let{unitId:r,subUnitId:i,ruleId:a}=n,o=t.get(e.ICommandService),s=t.get(e.IUndoRedoService),c=t.get(d),l=[{id:p.id,params:n}],u=[{id:f.id,params:{unitId:r,subUnitId:i,rule:{...c.getRuleById(r,i,a)},index:c.getRuleIndex(r,i,a)}}];return s.pushUndoRedo({undoMutations:u,redoMutations:l,unitID:n.unitId}),o.executeCommand(p.id,n),!0}},S={type:e.CommandType.COMMAND,id:`data-validation.command.updateDataValidationSetting`,handler(t,n){if(t.get(e.ILogService).warn("[Deprecated]: `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!"),!n)return!1;let a=t.get(e.ICommandService),o=t.get(e.IUndoRedoService),s=t.get(d),{unitId:c,subUnitId:l,ruleId:u,options:f}=n,p=s.getRuleById(c,l,u);if(!p)return!1;let h={unitId:c,subUnitId:l,ruleId:u,payload:{type:i.OPTIONS,payload:f}},g=[{id:m.id,params:h}],_={unitId:c,subUnitId:l,ruleId:u,payload:{type:i.OPTIONS,payload:r(p)}},v=[{id:m.id,params:_}];return o.pushUndoRedo({unitID:c,redoMutations:g,undoMutations:v}),a.executeCommand(m.id,h),!0}},C={type:e.CommandType.COMMAND,id:`data-validation.command.updateDataValidationOptions`,handler(t,r){if(t.get(e.ILogService).error("[Deprecated]: `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!"),!r)return!1;let a=t.get(e.ICommandService),o=t.get(e.IUndoRedoService),s=t.get(d),c=t.get(y),{unitId:l,subUnitId:u,ruleId:f,setting:p}=r,h=c.getValidatorItem(p.type);if(!h)return!1;let g=s.getRuleById(l,u,f);if(!g)return!1;let _={...g,...p};if(!h.validatorFormula(_,l,u).success)return!1;let v={unitId:l,subUnitId:u,ruleId:f,payload:{type:i.SETTING,payload:{...p,...h.normalizeFormula(_,l,u)}}},b=[{id:m.id,params:v}],x={unitId:l,subUnitId:u,ruleId:f,payload:{type:i.SETTING,payload:n(g)}},S=[{id:m.id,params:x}];return o.pushUndoRedo({unitID:l,redoMutations:b,undoMutations:S}),a.executeCommand(m.id,v),!0}},w={type:e.CommandType.COMMAND,id:`data-validation.command.removeAll`,handler(t,n){if(t.get(e.ILogService).error("[Deprecated]: `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"),!n)return!1;let{unitId:r,subUnitId:i}=n,a=t.get(e.ICommandService),o=t.get(d),s=t.get(e.IUndoRedoService),c=[...o.getRules(r,i)],l={unitId:r,subUnitId:i,ruleId:c.map(e=>e.uid)},u=[{id:p.id,params:l}],m=[{id:f.id,params:{unitId:r,subUnitId:i,rule:c}}];return s.pushUndoRedo({redoMutations:u,undoMutations:m,unitID:r}),a.executeCommand(p.id,l),!0}},T=`data-validation.config`;Symbol(T);const E={};let D=class extends e.Plugin{constructor(t=E,n,r,i){super(),this._config=t,this._injector=n,this._commandService=r,this._configService=i;let{...a}=(0,e.merge)({},E,this._config);this._configService.setConfig(T,a)}onStarting(){[[d],[y],[h]].forEach(e=>this._injector.add(e)),[b,w,S,C,x,f,m,p].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(h)}};c(D,`pluginName`,`UNIVER_DATA_VALIDATION_PLUGIN`),c(D,`packageName`,g),c(D,`version`,_),c(D,`type`,e.UniverInstanceType.UNIVER_SHEET),D=u([l(1,(0,e.Inject)(e.Injector)),l(2,e.ICommandService),l(3,e.IConfigService)],D),e.DataValidationOperator.BETWEEN,e.DataValidationOperator.EQUAL,e.DataValidationOperator.GREATER_THAN,e.DataValidationOperator.GREATER_THAN_OR_EQUAL,e.DataValidationOperator.LESS_THAN,e.DataValidationOperator.LESS_THAN_OR_EQUAL,e.DataValidationOperator.NOT_BETWEEN,e.DataValidationOperator.NOT_EQUAL;const O={[e.DataValidationOperator.BETWEEN]:`dataValidation.ruleName.between`,[e.DataValidationOperator.EQUAL]:`dataValidation.ruleName.equal`,[e.DataValidationOperator.GREATER_THAN]:`dataValidation.ruleName.greaterThan`,[e.DataValidationOperator.GREATER_THAN_OR_EQUAL]:`dataValidation.ruleName.greaterThanOrEqual`,[e.DataValidationOperator.LESS_THAN]:`dataValidation.ruleName.lessThan`,[e.DataValidationOperator.LESS_THAN_OR_EQUAL]:`dataValidation.ruleName.lessThanOrEqual`,[e.DataValidationOperator.NOT_BETWEEN]:`dataValidation.ruleName.notBetween`,[e.DataValidationOperator.NOT_EQUAL]:`dataValidation.ruleName.notEqual`,NONE:`dataValidation.ruleName.legal`},k={[e.DataValidationOperator.BETWEEN]:`dataValidation.errorMsg.between`,[e.DataValidationOperator.EQUAL]:`dataValidation.errorMsg.equal`,[e.DataValidationOperator.GREATER_THAN]:`dataValidation.errorMsg.greaterThan`,[e.DataValidationOperator.GREATER_THAN_OR_EQUAL]:`dataValidation.errorMsg.greaterThanOrEqual`,[e.DataValidationOperator.LESS_THAN]:`dataValidation.errorMsg.lessThan`,[e.DataValidationOperator.LESS_THAN_OR_EQUAL]:`dataValidation.errorMsg.lessThanOrEqual`,[e.DataValidationOperator.NOT_BETWEEN]:`dataValidation.errorMsg.notBetween`,[e.DataValidationOperator.NOT_EQUAL]:`dataValidation.errorMsg.notEqual`,NONE:`dataValidation.errorMsg.legal`},A={[e.DataValidationOperator.BETWEEN]:`dataValidation.textLength.errorMsg.between`,[e.DataValidationOperator.EQUAL]:`dataValidation.textLength.errorMsg.equal`,[e.DataValidationOperator.GREATER_THAN]:`dataValidation.textLength.errorMsg.greaterThan`,[e.DataValidationOperator.GREATER_THAN_OR_EQUAL]:`dataValidation.textLength.errorMsg.greaterThanOrEqual`,[e.DataValidationOperator.LESS_THAN]:`dataValidation.textLength.errorMsg.lessThan`,[e.DataValidationOperator.LESS_THAN_OR_EQUAL]:`dataValidation.textLength.errorMsg.lessThanOrEqual`,[e.DataValidationOperator.NOT_BETWEEN]:`dataValidation.textLength.errorMsg.notBetween`,[e.DataValidationOperator.NOT_EQUAL]:`dataValidation.textLength.errorMsg.notEqual`},j=[e.DataValidationOperator.BETWEEN,e.DataValidationOperator.NOT_BETWEEN],M=`{FORMULA1}`,N=`{FORMULA2}`,P=`{TYPE}`,F={[e.DataValidationOperator.BETWEEN]:`dataValidation.operators.between`,[e.DataValidationOperator.EQUAL]:`dataValidation.operators.equal`,[e.DataValidationOperator.GREATER_THAN]:`dataValidation.operators.greaterThan`,[e.DataValidationOperator.GREATER_THAN_OR_EQUAL]:`dataValidation.operators.greaterThanOrEqual`,[e.DataValidationOperator.LESS_THAN]:`dataValidation.operators.lessThan`,[e.DataValidationOperator.LESS_THAN_OR_EQUAL]:`dataValidation.operators.lessThanOrEqual`,[e.DataValidationOperator.NOT_BETWEEN]:`dataValidation.operators.notBetween`,[e.DataValidationOperator.NOT_EQUAL]:`dataValidation.operators.notEqual`};let I=function(e){return e.DATE=`date`,e.TIME=`time`,e.DATETIME=`datetime`,e.LIST=`list`,e.MULTIPLE_LIST=`multipleList`,e.COLOR=`color`,e.CASCADE=`cascade`,e}({}),L=class{constructor(e,t){this.localeService=e,this.injector=t,c(this,`offsetFormulaByRange`,!0),c(this,`formulaInput`,void 0),c(this,`canvasRender`,null),c(this,`dropdownType`,void 0),c(this,`optionsInput`,void 0),c(this,`skipDefaultFontRender`,void 0)}get operatorNames(){return this.operators.map(e=>this.localeService.t(F[e]))}get titleStr(){return this.localeService.t(this.title)}generateRuleName(e){var t,n;if(!e.operator)return this.localeService.t(O.NONE).replace(P,this.titleStr);let r=this.localeService.t(O[e.operator]).replace(M,(t=e.formula1)==null?``:t).replace(N,(n=e.formula2)==null?``:n);return`${this.titleStr} ${r}`}generateRuleErrorMessage(e,t){var n,r;return e.operator?`${this.localeService.t(k[e.operator]).replace(M,(n=e.formula1)==null?``:n).replace(N,(r=e.formula2)==null?``:r)}`:this.localeService.t(k.NONE).replace(P,this.titleStr)}getExtraStyle(e,t,n,r,i){}getRuleFinalError(e,t){return e.showErrorMessage&&e.error?e.error:this.generateRuleErrorMessage(e,t)}isEmptyCellValue(e){return e===``||e==null}normalizeFormula(e,t,n){return{formula1:e.formula1,formula2:e.formula2}}async isValidType(e,t,n){return!0}transform(e,t,n){return e}async validatorIsEqual(e,t,n){let{formula1:r}=t,{value:i}=e;return Number.isNaN(r)?!0:i===r}async validatorIsNotEqual(e,t,n){let{formula1:r}=t;return Number.isNaN(r)?!0:e.value!==r}async validatorIsBetween(e,t,n){let{formula1:r,formula2:i}=t;if(Number.isNaN(r)||Number.isNaN(i))return!0;let a=Math.min(r,i),o=Math.max(r,i);return e.value>=a&&e.value<=o}async validatorIsNotBetween(e,t,n){let{formula1:r,formula2:i}=t;if(Number.isNaN(r)||Number.isNaN(i))return!0;let a=Math.min(r,i),o=Math.max(r,i);return e.value<a||e.value>o}async validatorIsGreaterThan(e,t,n){let{formula1:r}=t;return Number.isNaN(r)?!0:e.value>r}async validatorIsGreaterThanOrEqual(e,t,n){let{formula1:r}=t;return Number.isNaN(r)?!0:e.value>=r}async validatorIsLessThan(e,t,n){let{formula1:r}=t;return Number.isNaN(r)?!0:e.value<r}async validatorIsLessThanOrEqual(e,t,n){let{formula1:r}=t;return Number.isNaN(r)?!0:e.value<=r}async validator(t,n){let{value:r,unitId:i,subUnitId:a}=t,o=this.isEmptyCellValue(r),{allowBlank:s=!0,operator:c}=n;if(o)return s;let l=await this.parseFormula(n,i,a,t.row,t.column);if(!l.isFormulaValid||!await this.isValidType(t,l,n))return!1;if(!c)return!0;let u=this.transform(t,l,n);switch(c){case e.DataValidationOperator.BETWEEN:return this.validatorIsBetween(u,l,n);case e.DataValidationOperator.EQUAL:return this.validatorIsEqual(u,l,n);case e.DataValidationOperator.GREATER_THAN:return this.validatorIsGreaterThan(u,l,n);case e.DataValidationOperator.GREATER_THAN_OR_EQUAL:return this.validatorIsGreaterThanOrEqual(u,l,n);case e.DataValidationOperator.LESS_THAN:return this.validatorIsLessThan(u,l,n);case e.DataValidationOperator.LESS_THAN_OR_EQUAL:return this.validatorIsLessThanOrEqual(u,l,n);case e.DataValidationOperator.NOT_BETWEEN:return this.validatorIsNotBetween(u,l,n);case e.DataValidationOperator.NOT_EQUAL:return this.validatorIsNotEqual(u,l,n);default:throw Error(`Unknown operator.`)}}};L=u([l(0,(0,e.Inject)(e.LocaleService)),l(1,(0,e.Inject)(e.Injector))],L),exports.AddDataValidationMutation=f,Object.defineProperty(exports,`BaseDataValidator`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`DataValidationModel`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`DataValidationResourceController`,{enumerable:!0,get:function(){return h}}),exports.DataValidatorDropdownType=I,exports.DataValidatorRegistryScope=v,exports.DataValidatorRegistryService=y,exports.FORMULA1=M,exports.FORMULA2=N,exports.RemoveDataValidationMutation=p,exports.TWO_FORMULA_OPERATOR_COUNT=j,exports.TYPE=P,exports.TextLengthErrorTitleMap=A,Object.defineProperty(exports,`UniverDataValidationPlugin`,{enumerable:!0,get:function(){return D}}),exports.UpdateDataValidationMutation=m,exports.UpdateRuleType=i,exports.getRuleOptions=r,exports.getRuleSetting=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _univerjs_core = require("@univerjs/core");
3
+ let rxjs = require("rxjs");
4
+
5
+ //#region src/common/util.ts
6
+ function getRuleSetting(rule) {
7
+ return {
8
+ type: rule.type,
9
+ operator: rule.operator,
10
+ formula1: rule.formula1,
11
+ formula2: rule.formula2,
12
+ allowBlank: rule.allowBlank
13
+ };
14
+ }
15
+ function getRuleOptions(rule) {
16
+ return {
17
+ error: rule.error,
18
+ errorStyle: rule.errorStyle,
19
+ errorTitle: rule.errorTitle,
20
+ imeMode: rule.imeMode,
21
+ prompt: rule.prompt,
22
+ promptTitle: rule.promptTitle,
23
+ showDropDown: rule.showDropDown,
24
+ showErrorMessage: rule.showErrorMessage,
25
+ showInputMessage: rule.showInputMessage,
26
+ renderMode: rule.renderMode,
27
+ bizInfo: rule.bizInfo
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ //#region src/types/enum/update-rule-type.ts
33
+ /**
34
+ * Copyright 2023-present DreamNum Co., Ltd.
35
+ *
36
+ * Licensed under the Apache License, Version 2.0 (the "License");
37
+ * you may not use this file except in compliance with the License.
38
+ * You may obtain a copy of the License at
39
+ *
40
+ * http://www.apache.org/licenses/LICENSE-2.0
41
+ *
42
+ * Unless required by applicable law or agreed to in writing, software
43
+ * distributed under the License is distributed on an "AS IS" BASIS,
44
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45
+ * See the License for the specific language governing permissions and
46
+ * limitations under the License.
47
+ */
48
+ let UpdateRuleType = /* @__PURE__ */ function(UpdateRuleType) {
49
+ UpdateRuleType[UpdateRuleType["SETTING"] = 0] = "SETTING";
50
+ UpdateRuleType[UpdateRuleType["RANGE"] = 1] = "RANGE";
51
+ UpdateRuleType[UpdateRuleType["OPTIONS"] = 2] = "OPTIONS";
52
+ UpdateRuleType[UpdateRuleType["ALL"] = 3] = "ALL";
53
+ return UpdateRuleType;
54
+ }({});
55
+
56
+ //#endregion
57
+ //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
58
+ function _typeof(o) {
59
+ "@babel/helpers - typeof";
60
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
61
+ return typeof o;
62
+ } : function(o) {
63
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
64
+ }, _typeof(o);
65
+ }
66
+
67
+ //#endregion
68
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
69
+ function toPrimitive(t, r) {
70
+ if ("object" != _typeof(t) || !t) return t;
71
+ var e = t[Symbol.toPrimitive];
72
+ if (void 0 !== e) {
73
+ var i = e.call(t, r || "default");
74
+ if ("object" != _typeof(i)) return i;
75
+ throw new TypeError("@@toPrimitive must return a primitive value.");
76
+ }
77
+ return ("string" === r ? String : Number)(t);
78
+ }
79
+
80
+ //#endregion
81
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
82
+ function toPropertyKey(t) {
83
+ var i = toPrimitive(t, "string");
84
+ return "symbol" == _typeof(i) ? i : i + "";
85
+ }
86
+
87
+ //#endregion
88
+ //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
89
+ function _defineProperty(e, r, t) {
90
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
91
+ value: t,
92
+ enumerable: !0,
93
+ configurable: !0,
94
+ writable: !0
95
+ }) : e[r] = t, e;
96
+ }
97
+
98
+ //#endregion
99
+ //#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
100
+ function __decorateParam(paramIndex, decorator) {
101
+ return function(target, key) {
102
+ decorator(target, key, paramIndex);
103
+ };
104
+ }
105
+
106
+ //#endregion
107
+ //#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
108
+ function __decorate(decorators, target, key, desc) {
109
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
110
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
111
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
112
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
113
+ }
114
+
115
+ //#endregion
116
+ //#region src/models/data-validation-model.ts
117
+ let DataValidationModel = class DataValidationModel extends _univerjs_core.Disposable {
118
+ constructor(_logService) {
119
+ super();
120
+ this._logService = _logService;
121
+ _defineProperty(this, "_model", /* @__PURE__ */ new Map());
122
+ _defineProperty(this, "_ruleChange$", new rxjs.Subject());
123
+ _defineProperty(this, "ruleChange$", this._ruleChange$.asObservable());
124
+ _defineProperty(this, "ruleChangeDebounce$", this.ruleChange$.pipe((0, rxjs.debounceTime)(20)));
125
+ this.disposeWithMe({ dispose: () => {
126
+ this._ruleChange$.complete();
127
+ } });
128
+ }
129
+ _ensureMap(unitId, subUnitId) {
130
+ if (!this._model.has(unitId)) this._model.set(unitId, /* @__PURE__ */ new Map());
131
+ const unitMap = this._model.get(unitId);
132
+ if (unitMap.has(subUnitId)) return unitMap.get(subUnitId);
133
+ const map = {
134
+ map: /* @__PURE__ */ new Map(),
135
+ list: []
136
+ };
137
+ unitMap.set(subUnitId, map);
138
+ return map;
139
+ }
140
+ _addSubUnitRule(subUnit, rule, index) {
141
+ const { map: dataValidationMap, list: dataValidations } = subUnit;
142
+ const rules = (Array.isArray(rule) ? rule : [rule]).filter((item) => !dataValidationMap.has(item.uid));
143
+ if (typeof index === "number" && index < dataValidations.length) dataValidations.splice(index, 0, ...rules);
144
+ else dataValidations.push(...rules);
145
+ rules.forEach((item) => {
146
+ dataValidationMap.set(item.uid, item);
147
+ });
148
+ }
149
+ _removeSubUnitRule(subUnit, ruleId) {
150
+ const { map: dataValidationMap, list: dataValidations } = subUnit;
151
+ const index = dataValidations.findIndex((item) => item.uid === ruleId);
152
+ if (index > -1) {
153
+ dataValidations.splice(index, 1);
154
+ dataValidationMap.delete(ruleId);
155
+ }
156
+ }
157
+ _updateSubUnitRule(subUnit, ruleId, payload) {
158
+ const { map: dataValidationMap, list: dataValidations } = subUnit;
159
+ const oldRule = dataValidationMap.get(ruleId);
160
+ const index = dataValidations.findIndex((rule) => ruleId === rule.uid);
161
+ if (!oldRule) throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
162
+ const rule = { ...oldRule };
163
+ switch (payload.type) {
164
+ case UpdateRuleType.RANGE:
165
+ rule.ranges = payload.payload;
166
+ break;
167
+ case UpdateRuleType.SETTING:
168
+ Object.assign(rule, getRuleSetting(payload.payload));
169
+ break;
170
+ case UpdateRuleType.OPTIONS:
171
+ Object.assign(rule, getRuleOptions(payload.payload));
172
+ break;
173
+ case UpdateRuleType.ALL:
174
+ Object.assign(rule, payload.payload);
175
+ break;
176
+ default: break;
177
+ }
178
+ dataValidations[index] = rule;
179
+ dataValidationMap.set(ruleId, rule);
180
+ return rule;
181
+ }
182
+ _addRuleSideEffect(unitId, subUnitId, rule, source) {
183
+ if (this._ensureMap(unitId, subUnitId).map.get(rule.uid)) return;
184
+ return {
185
+ rule,
186
+ type: "add",
187
+ unitId,
188
+ subUnitId,
189
+ source
190
+ };
191
+ }
192
+ addRule(unitId, subUnitId, rule, source, index) {
193
+ try {
194
+ const subUnitMap = this._ensureMap(unitId, subUnitId);
195
+ const effects = (Array.isArray(rule) ? rule : [rule]).map((item) => this._addRuleSideEffect(unitId, subUnitId, item, source));
196
+ this._addSubUnitRule(subUnitMap, rule, index);
197
+ effects.forEach((effect) => {
198
+ if (effect) this._ruleChange$.next(effect);
199
+ });
200
+ } catch (error) {
201
+ this._logService.error(error);
202
+ }
203
+ }
204
+ updateRule(unitId, subUnitId, ruleId, payload, source) {
205
+ try {
206
+ const subUnitMap = this._ensureMap(unitId, subUnitId);
207
+ const oldRule = _univerjs_core.Tools.deepClone(subUnitMap.map.get(ruleId));
208
+ if (!oldRule) throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
209
+ const rule = this._updateSubUnitRule(subUnitMap, ruleId, payload);
210
+ this._ruleChange$.next({
211
+ rule,
212
+ type: "update",
213
+ unitId,
214
+ subUnitId,
215
+ source,
216
+ updatePayload: payload,
217
+ oldRule
218
+ });
219
+ } catch (error) {
220
+ this._logService.error(error);
221
+ }
222
+ }
223
+ removeRule(unitId, subUnitId, ruleId, source) {
224
+ try {
225
+ const map = this._ensureMap(unitId, subUnitId);
226
+ const oldRule = map.map.get(ruleId);
227
+ if (oldRule) {
228
+ this._removeSubUnitRule(map, ruleId);
229
+ this._ruleChange$.next({
230
+ rule: oldRule,
231
+ type: "remove",
232
+ unitId,
233
+ subUnitId,
234
+ source
235
+ });
236
+ }
237
+ } catch (error) {
238
+ this._logService.error(error);
239
+ }
240
+ }
241
+ getRuleById(unitId, subUnitId, ruleId) {
242
+ return this._ensureMap(unitId, subUnitId).map.get(ruleId);
243
+ }
244
+ getRuleIndex(unitId, subUnitId, ruleId) {
245
+ return this._ensureMap(unitId, subUnitId).list.findIndex((rule) => rule.uid === ruleId);
246
+ }
247
+ getRules(unitId, subUnitId) {
248
+ return [...this._ensureMap(unitId, subUnitId).list];
249
+ }
250
+ getUnitRules(unitId) {
251
+ const unitMap = this._model.get(unitId);
252
+ if (!unitMap) return [];
253
+ const res = [];
254
+ unitMap.forEach((manager, subUnitId) => {
255
+ res.push([subUnitId, manager.list]);
256
+ });
257
+ return res;
258
+ }
259
+ deleteUnitRules(unitId) {
260
+ this._model.delete(unitId);
261
+ }
262
+ getSubUnitIds(unitId) {
263
+ var _this$_model$get$keys, _this$_model$get;
264
+ return Array.from((_this$_model$get$keys = (_this$_model$get = this._model.get(unitId)) === null || _this$_model$get === void 0 ? void 0 : _this$_model$get.keys()) !== null && _this$_model$get$keys !== void 0 ? _this$_model$get$keys : []);
265
+ }
266
+ getAll() {
267
+ return Array.from(this._model.keys()).map((unitId) => [unitId, this.getUnitRules(unitId)]);
268
+ }
269
+ };
270
+ DataValidationModel = __decorate([__decorateParam(0, _univerjs_core.ILogService)], DataValidationModel);
271
+
272
+ //#endregion
273
+ //#region src/commands/mutations/data-validation.mutation.ts
274
+ const AddDataValidationMutation = {
275
+ type: _univerjs_core.CommandType.MUTATION,
276
+ id: "data-validation.mutation.addRule",
277
+ handler(accessor, params) {
278
+ if (!params) return false;
279
+ const { unitId, subUnitId, rule, index, source = "command" } = params;
280
+ accessor.get(DataValidationModel).addRule(unitId, subUnitId, rule, source, index);
281
+ return true;
282
+ }
283
+ };
284
+ const RemoveDataValidationMutation = {
285
+ type: _univerjs_core.CommandType.MUTATION,
286
+ id: "data-validation.mutation.removeRule",
287
+ handler(accessor, params) {
288
+ if (!params) return false;
289
+ const { unitId, subUnitId, ruleId, source = "command" } = params;
290
+ const dataValidationModel = accessor.get(DataValidationModel);
291
+ if (Array.isArray(ruleId)) ruleId.forEach((item) => {
292
+ dataValidationModel.removeRule(unitId, subUnitId, item, source);
293
+ });
294
+ else dataValidationModel.removeRule(unitId, subUnitId, ruleId, source);
295
+ return true;
296
+ }
297
+ };
298
+ const UpdateDataValidationMutation = {
299
+ type: _univerjs_core.CommandType.MUTATION,
300
+ id: "data-validation.mutation.updateRule",
301
+ handler(accessor, params) {
302
+ if (!params) return false;
303
+ const { unitId, subUnitId, ruleId, payload, source = "command" } = params;
304
+ accessor.get(DataValidationModel).updateRule(unitId, subUnitId, ruleId, payload, source);
305
+ return true;
306
+ }
307
+ };
308
+
309
+ //#endregion
310
+ //#region src/controllers/dv-resource.controller.ts
311
+ const DATA_VALIDATION_PLUGIN_NAME = "SHEET_DATA_VALIDATION_PLUGIN";
312
+ let DataValidationResourceController = class DataValidationResourceController extends _univerjs_core.Disposable {
313
+ constructor(_resourceManagerService, _univerInstanceService, _dataValidationModel) {
314
+ super();
315
+ this._resourceManagerService = _resourceManagerService;
316
+ this._univerInstanceService = _univerInstanceService;
317
+ this._dataValidationModel = _dataValidationModel;
318
+ this._initSnapshot();
319
+ }
320
+ _initSnapshot() {
321
+ const toJson = (unitID) => {
322
+ const map = this._dataValidationModel.getUnitRules(unitID);
323
+ const resultMap = {};
324
+ if (map) {
325
+ map.forEach(([key, v]) => {
326
+ resultMap[key] = v;
327
+ });
328
+ return JSON.stringify(resultMap);
329
+ }
330
+ return "";
331
+ };
332
+ const parseJson = (json) => {
333
+ if (!json) return {};
334
+ try {
335
+ return JSON.parse(json);
336
+ } catch (err) {
337
+ return {};
338
+ }
339
+ };
340
+ this.disposeWithMe(this._resourceManagerService.registerPluginResource({
341
+ pluginName: DATA_VALIDATION_PLUGIN_NAME,
342
+ businesses: [_univerjs_core.UniverInstanceType.UNIVER_SHEET],
343
+ toJson: (unitID) => toJson(unitID),
344
+ parseJson: (json) => parseJson(json),
345
+ onUnLoad: (unitID) => {
346
+ this._dataValidationModel.deleteUnitRules(unitID);
347
+ },
348
+ onLoad: (unitID, value) => {
349
+ Object.keys(value).forEach((subunitId) => {
350
+ value[subunitId].forEach((rule) => {
351
+ this._dataValidationModel.addRule(unitID, subunitId, rule, "patched");
352
+ });
353
+ });
354
+ }
355
+ }));
356
+ }
357
+ };
358
+ DataValidationResourceController = __decorate([
359
+ __decorateParam(0, _univerjs_core.IResourceManagerService),
360
+ __decorateParam(1, _univerjs_core.IUniverInstanceService),
361
+ __decorateParam(2, (0, _univerjs_core.Inject)(DataValidationModel))
362
+ ], DataValidationResourceController);
363
+
364
+ //#endregion
365
+ //#region package.json
366
+ var name = "@univerjs/data-validation";
367
+ var version = "0.21.0-insiders.20260422-d7fcb4d";
368
+
369
+ //#endregion
370
+ //#region src/services/data-validator-registry.service.ts
371
+ let DataValidatorRegistryScope = /* @__PURE__ */ function(DataValidatorRegistryScope) {
372
+ DataValidatorRegistryScope["SHEET"] = "sheet";
373
+ return DataValidatorRegistryScope;
374
+ }({});
375
+ /**
376
+ * Register data validator
377
+ */
378
+ var DataValidatorRegistryService = class {
379
+ constructor() {
380
+ _defineProperty(this, "_validatorByScopes", /* @__PURE__ */ new Map());
381
+ _defineProperty(this, "_validatorMap", /* @__PURE__ */ new Map());
382
+ _defineProperty(this, "_validatorsChange$", new rxjs.BehaviorSubject(void 0));
383
+ _defineProperty(this, "validatorsChange$", this._validatorsChange$.asObservable());
384
+ }
385
+ _addValidatorToScope(validator, scope) {
386
+ if (!this._validatorByScopes.has(scope)) this._validatorByScopes.set(scope, []);
387
+ const validators = this._validatorByScopes.get(scope);
388
+ if (validators.findIndex((m) => m.id === validator.id) > -1) throw new Error(`Validator item with the same id ${validator.id} has already been added!`);
389
+ validators.push(validator);
390
+ }
391
+ _removeValidatorFromScope(validator, scope) {
392
+ const validators = this._validatorByScopes.get(scope);
393
+ if (!validators) return;
394
+ const index = validators.findIndex((v) => v.id === validator.id);
395
+ if (index > -1) validators.splice(index, 1);
396
+ }
397
+ register(validator) {
398
+ this._validatorMap.set(validator.id, validator);
399
+ if (Array.isArray(validator.scopes)) validator.scopes.forEach((scope) => {
400
+ this._addValidatorToScope(validator, scope);
401
+ });
402
+ else this._addValidatorToScope(validator, validator.scopes);
403
+ this._validatorsChange$.next();
404
+ return (0, _univerjs_core.toDisposable)(() => {
405
+ this._validatorMap.delete(validator.id);
406
+ if (Array.isArray(validator.scopes)) validator.scopes.forEach((scope) => {
407
+ this._removeValidatorFromScope(validator, scope);
408
+ });
409
+ else this._removeValidatorFromScope(validator, validator.scopes);
410
+ this._validatorsChange$.next();
411
+ });
412
+ }
413
+ getValidatorItem(id) {
414
+ return this._validatorMap.get(id);
415
+ }
416
+ getValidatorsByScope(scope) {
417
+ return this._validatorByScopes.get(scope);
418
+ }
419
+ };
420
+
421
+ //#endregion
422
+ //#region src/commands/commands/data-validation.command.ts
423
+ /**
424
+ * @deprecated `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
425
+ */
426
+ const AddDataValidationCommand = {
427
+ type: _univerjs_core.CommandType.COMMAND,
428
+ id: "data-validation.command.addRule",
429
+ async handler(accessor, params) {
430
+ accessor.get(_univerjs_core.ILogService).error("[Deprecated]: `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!");
431
+ if (!params) return false;
432
+ const { rule, unitId, subUnitId } = params;
433
+ const commandService = accessor.get(_univerjs_core.ICommandService);
434
+ const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
435
+ const mutationParams = {
436
+ ...params,
437
+ rule: {
438
+ ...params.rule,
439
+ ranges: [params.rule.range]
440
+ }
441
+ };
442
+ const redoMutations = [{
443
+ id: AddDataValidationMutation.id,
444
+ params: mutationParams
445
+ }];
446
+ const undoMutations = [{
447
+ id: RemoveDataValidationMutation.id,
448
+ params: {
449
+ unitId,
450
+ subUnitId,
451
+ ruleId: rule.uid
452
+ }
453
+ }];
454
+ undoRedoService.pushUndoRedo({
455
+ unitID: unitId,
456
+ redoMutations,
457
+ undoMutations
458
+ });
459
+ await commandService.executeCommand(AddDataValidationMutation.id, mutationParams);
460
+ return true;
461
+ }
462
+ };
463
+ /**
464
+ * @deprecated `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
465
+ */
466
+ const RemoveDataValidationCommand = {
467
+ type: _univerjs_core.CommandType.COMMAND,
468
+ id: "data-validation.command.removeRule",
469
+ handler(accessor, params) {
470
+ accessor.get(_univerjs_core.ILogService).error("[Deprecated]: `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!");
471
+ if (!params) return false;
472
+ const { unitId, subUnitId, ruleId } = params;
473
+ const commandService = accessor.get(_univerjs_core.ICommandService);
474
+ const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
475
+ const dataValidationModel = accessor.get(DataValidationModel);
476
+ const redoMutations = [{
477
+ id: RemoveDataValidationMutation.id,
478
+ params
479
+ }];
480
+ const undoMutations = [{
481
+ id: AddDataValidationMutation.id,
482
+ params: {
483
+ unitId,
484
+ subUnitId,
485
+ rule: { ...dataValidationModel.getRuleById(unitId, subUnitId, ruleId) },
486
+ index: dataValidationModel.getRuleIndex(unitId, subUnitId, ruleId)
487
+ }
488
+ }];
489
+ undoRedoService.pushUndoRedo({
490
+ undoMutations,
491
+ redoMutations,
492
+ unitID: params.unitId
493
+ });
494
+ commandService.executeCommand(RemoveDataValidationMutation.id, params);
495
+ return true;
496
+ }
497
+ };
498
+ /**
499
+ * @deprecated `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!
500
+ */
501
+ const UpdateDataValidationOptionsCommand = {
502
+ type: _univerjs_core.CommandType.COMMAND,
503
+ id: "data-validation.command.updateDataValidationSetting",
504
+ handler(accessor, params) {
505
+ accessor.get(_univerjs_core.ILogService).warn("[Deprecated]: `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!");
506
+ if (!params) return false;
507
+ const commandService = accessor.get(_univerjs_core.ICommandService);
508
+ const redoUndoService = accessor.get(_univerjs_core.IUndoRedoService);
509
+ const dataValidationModel = accessor.get(DataValidationModel);
510
+ const { unitId, subUnitId, ruleId, options } = params;
511
+ const rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
512
+ if (!rule) return false;
513
+ const mutationParams = {
514
+ unitId,
515
+ subUnitId,
516
+ ruleId,
517
+ payload: {
518
+ type: UpdateRuleType.OPTIONS,
519
+ payload: options
520
+ }
521
+ };
522
+ const redoMutations = [{
523
+ id: UpdateDataValidationMutation.id,
524
+ params: mutationParams
525
+ }];
526
+ const undoMutationParams = {
527
+ unitId,
528
+ subUnitId,
529
+ ruleId,
530
+ payload: {
531
+ type: UpdateRuleType.OPTIONS,
532
+ payload: getRuleOptions(rule)
533
+ }
534
+ };
535
+ const undoMutations = [{
536
+ id: UpdateDataValidationMutation.id,
537
+ params: undoMutationParams
538
+ }];
539
+ redoUndoService.pushUndoRedo({
540
+ unitID: unitId,
541
+ redoMutations,
542
+ undoMutations
543
+ });
544
+ commandService.executeCommand(UpdateDataValidationMutation.id, mutationParams);
545
+ return true;
546
+ }
547
+ };
548
+ /**
549
+ * @deprecated `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!
550
+ */
551
+ const UpdateDataValidationSettingCommand = {
552
+ type: _univerjs_core.CommandType.COMMAND,
553
+ id: "data-validation.command.updateDataValidationOptions",
554
+ handler(accessor, params) {
555
+ accessor.get(_univerjs_core.ILogService).error("[Deprecated]: `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!");
556
+ if (!params) return false;
557
+ const commandService = accessor.get(_univerjs_core.ICommandService);
558
+ const redoUndoService = accessor.get(_univerjs_core.IUndoRedoService);
559
+ const dataValidationModel = accessor.get(DataValidationModel);
560
+ const dataValidatorRegistryService = accessor.get(DataValidatorRegistryService);
561
+ const { unitId, subUnitId, ruleId, setting } = params;
562
+ const validator = dataValidatorRegistryService.getValidatorItem(setting.type);
563
+ if (!validator) return false;
564
+ const rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
565
+ if (!rule) return false;
566
+ const newRule = {
567
+ ...rule,
568
+ ...setting
569
+ };
570
+ if (!validator.validatorFormula(newRule, unitId, subUnitId).success) return false;
571
+ const mutationParams = {
572
+ unitId,
573
+ subUnitId,
574
+ ruleId,
575
+ payload: {
576
+ type: UpdateRuleType.SETTING,
577
+ payload: {
578
+ ...setting,
579
+ ...validator.normalizeFormula(newRule, unitId, subUnitId)
580
+ }
581
+ }
582
+ };
583
+ const redoMutations = [{
584
+ id: UpdateDataValidationMutation.id,
585
+ params: mutationParams
586
+ }];
587
+ const undoMutationParams = {
588
+ unitId,
589
+ subUnitId,
590
+ ruleId,
591
+ payload: {
592
+ type: UpdateRuleType.SETTING,
593
+ payload: getRuleSetting(rule)
594
+ }
595
+ };
596
+ const undoMutations = [{
597
+ id: UpdateDataValidationMutation.id,
598
+ params: undoMutationParams
599
+ }];
600
+ redoUndoService.pushUndoRedo({
601
+ unitID: unitId,
602
+ redoMutations,
603
+ undoMutations
604
+ });
605
+ commandService.executeCommand(UpdateDataValidationMutation.id, mutationParams);
606
+ return true;
607
+ }
608
+ };
609
+ /**
610
+ * @deprecated `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!
611
+ */
612
+ const RemoveAllDataValidationCommand = {
613
+ type: _univerjs_core.CommandType.COMMAND,
614
+ id: "data-validation.command.removeAll",
615
+ handler(accessor, params) {
616
+ accessor.get(_univerjs_core.ILogService).error("[Deprecated]: `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!");
617
+ if (!params) return false;
618
+ const { unitId, subUnitId } = params;
619
+ const commandService = accessor.get(_univerjs_core.ICommandService);
620
+ const dataValidationModel = accessor.get(DataValidationModel);
621
+ const undoRedoService = accessor.get(_univerjs_core.IUndoRedoService);
622
+ const currentRules = [...dataValidationModel.getRules(unitId, subUnitId)];
623
+ const redoParams = {
624
+ unitId,
625
+ subUnitId,
626
+ ruleId: currentRules.map((rule) => rule.uid)
627
+ };
628
+ const redoMutations = [{
629
+ id: RemoveDataValidationMutation.id,
630
+ params: redoParams
631
+ }];
632
+ const undoMutations = [{
633
+ id: AddDataValidationMutation.id,
634
+ params: {
635
+ unitId,
636
+ subUnitId,
637
+ rule: currentRules
638
+ }
639
+ }];
640
+ undoRedoService.pushUndoRedo({
641
+ redoMutations,
642
+ undoMutations,
643
+ unitID: unitId
644
+ });
645
+ commandService.executeCommand(RemoveDataValidationMutation.id, redoParams);
646
+ return true;
647
+ }
648
+ };
649
+
650
+ //#endregion
651
+ //#region src/config/config.ts
652
+ /**
653
+ * Copyright 2023-present DreamNum Co., Ltd.
654
+ *
655
+ * Licensed under the Apache License, Version 2.0 (the "License");
656
+ * you may not use this file except in compliance with the License.
657
+ * You may obtain a copy of the License at
658
+ *
659
+ * http://www.apache.org/licenses/LICENSE-2.0
660
+ *
661
+ * Unless required by applicable law or agreed to in writing, software
662
+ * distributed under the License is distributed on an "AS IS" BASIS,
663
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
664
+ * See the License for the specific language governing permissions and
665
+ * limitations under the License.
666
+ */
667
+ const DATA_VALIDATION_PLUGIN_CONFIG_KEY = "data-validation.config";
668
+ const configSymbol = Symbol(DATA_VALIDATION_PLUGIN_CONFIG_KEY);
669
+ const defaultPluginConfig = {};
670
+
671
+ //#endregion
672
+ //#region src/plugin.ts
673
+ let UniverDataValidationPlugin = class UniverDataValidationPlugin extends _univerjs_core.Plugin {
674
+ constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
675
+ super();
676
+ this._config = _config;
677
+ this._injector = _injector;
678
+ this._commandService = _commandService;
679
+ this._configService = _configService;
680
+ const { ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
681
+ this._configService.setConfig(DATA_VALIDATION_PLUGIN_CONFIG_KEY, rest);
682
+ }
683
+ onStarting() {
684
+ [
685
+ [DataValidationModel],
686
+ [DataValidatorRegistryService],
687
+ [DataValidationResourceController]
688
+ ].forEach((d) => this._injector.add(d));
689
+ [
690
+ AddDataValidationCommand,
691
+ RemoveAllDataValidationCommand,
692
+ UpdateDataValidationOptionsCommand,
693
+ UpdateDataValidationSettingCommand,
694
+ RemoveDataValidationCommand,
695
+ AddDataValidationMutation,
696
+ UpdateDataValidationMutation,
697
+ RemoveDataValidationMutation
698
+ ].forEach((command) => {
699
+ this._commandService.registerCommand(command);
700
+ });
701
+ }
702
+ onReady() {
703
+ this._injector.get(DataValidationResourceController);
704
+ }
705
+ };
706
+ _defineProperty(UniverDataValidationPlugin, "pluginName", "UNIVER_DATA_VALIDATION_PLUGIN");
707
+ _defineProperty(UniverDataValidationPlugin, "packageName", name);
708
+ _defineProperty(UniverDataValidationPlugin, "version", version);
709
+ _defineProperty(UniverDataValidationPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
710
+ UniverDataValidationPlugin = __decorate([
711
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
712
+ __decorateParam(2, _univerjs_core.ICommandService),
713
+ __decorateParam(3, _univerjs_core.IConfigService)
714
+ ], UniverDataValidationPlugin);
715
+
716
+ //#endregion
717
+ //#region src/types/const/operator-text-map.ts
718
+ /**
719
+ * Copyright 2023-present DreamNum Co., Ltd.
720
+ *
721
+ * Licensed under the Apache License, Version 2.0 (the "License");
722
+ * you may not use this file except in compliance with the License.
723
+ * You may obtain a copy of the License at
724
+ *
725
+ * http://www.apache.org/licenses/LICENSE-2.0
726
+ *
727
+ * Unless required by applicable law or agreed to in writing, software
728
+ * distributed under the License is distributed on an "AS IS" BASIS,
729
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
730
+ * See the License for the specific language governing permissions and
731
+ * limitations under the License.
732
+ */
733
+ const OperatorTextMap = {
734
+ [_univerjs_core.DataValidationOperator.BETWEEN]: "dataValidation.operators.between",
735
+ [_univerjs_core.DataValidationOperator.EQUAL]: "dataValidation.operators.equal",
736
+ [_univerjs_core.DataValidationOperator.GREATER_THAN]: "dataValidation.operators.greaterThan",
737
+ [_univerjs_core.DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.operators.greaterThanOrEqual",
738
+ [_univerjs_core.DataValidationOperator.LESS_THAN]: "dataValidation.operators.lessThan",
739
+ [_univerjs_core.DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.operators.lessThanOrEqual",
740
+ [_univerjs_core.DataValidationOperator.NOT_BETWEEN]: "dataValidation.operators.notBetween",
741
+ [_univerjs_core.DataValidationOperator.NOT_EQUAL]: "dataValidation.operators.notEqual"
742
+ };
743
+ const OperatorTitleMap = {
744
+ [_univerjs_core.DataValidationOperator.BETWEEN]: "dataValidation.ruleName.between",
745
+ [_univerjs_core.DataValidationOperator.EQUAL]: "dataValidation.ruleName.equal",
746
+ [_univerjs_core.DataValidationOperator.GREATER_THAN]: "dataValidation.ruleName.greaterThan",
747
+ [_univerjs_core.DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.ruleName.greaterThanOrEqual",
748
+ [_univerjs_core.DataValidationOperator.LESS_THAN]: "dataValidation.ruleName.lessThan",
749
+ [_univerjs_core.DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.ruleName.lessThanOrEqual",
750
+ [_univerjs_core.DataValidationOperator.NOT_BETWEEN]: "dataValidation.ruleName.notBetween",
751
+ [_univerjs_core.DataValidationOperator.NOT_EQUAL]: "dataValidation.ruleName.notEqual",
752
+ NONE: "dataValidation.ruleName.legal"
753
+ };
754
+ const OperatorErrorTitleMap = {
755
+ [_univerjs_core.DataValidationOperator.BETWEEN]: "dataValidation.errorMsg.between",
756
+ [_univerjs_core.DataValidationOperator.EQUAL]: "dataValidation.errorMsg.equal",
757
+ [_univerjs_core.DataValidationOperator.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
758
+ [_univerjs_core.DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.errorMsg.greaterThanOrEqual",
759
+ [_univerjs_core.DataValidationOperator.LESS_THAN]: "dataValidation.errorMsg.lessThan",
760
+ [_univerjs_core.DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.errorMsg.lessThanOrEqual",
761
+ [_univerjs_core.DataValidationOperator.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
762
+ [_univerjs_core.DataValidationOperator.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
763
+ NONE: "dataValidation.errorMsg.legal"
764
+ };
765
+ const TextLengthErrorTitleMap = {
766
+ [_univerjs_core.DataValidationOperator.BETWEEN]: "dataValidation.textLength.errorMsg.between",
767
+ [_univerjs_core.DataValidationOperator.EQUAL]: "dataValidation.textLength.errorMsg.equal",
768
+ [_univerjs_core.DataValidationOperator.GREATER_THAN]: "dataValidation.textLength.errorMsg.greaterThan",
769
+ [_univerjs_core.DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.greaterThanOrEqual",
770
+ [_univerjs_core.DataValidationOperator.LESS_THAN]: "dataValidation.textLength.errorMsg.lessThan",
771
+ [_univerjs_core.DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.lessThanOrEqual",
772
+ [_univerjs_core.DataValidationOperator.NOT_BETWEEN]: "dataValidation.textLength.errorMsg.notBetween",
773
+ [_univerjs_core.DataValidationOperator.NOT_EQUAL]: "dataValidation.textLength.errorMsg.notEqual"
774
+ };
775
+
776
+ //#endregion
777
+ //#region src/types/const/two-formula-operators.ts
778
+ /**
779
+ * Copyright 2023-present DreamNum Co., Ltd.
780
+ *
781
+ * Licensed under the Apache License, Version 2.0 (the "License");
782
+ * you may not use this file except in compliance with the License.
783
+ * You may obtain a copy of the License at
784
+ *
785
+ * http://www.apache.org/licenses/LICENSE-2.0
786
+ *
787
+ * Unless required by applicable law or agreed to in writing, software
788
+ * distributed under the License is distributed on an "AS IS" BASIS,
789
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
790
+ * See the License for the specific language governing permissions and
791
+ * limitations under the License.
792
+ */
793
+ const TWO_FORMULA_OPERATOR_COUNT = [_univerjs_core.DataValidationOperator.BETWEEN, _univerjs_core.DataValidationOperator.NOT_BETWEEN];
794
+
795
+ //#endregion
796
+ //#region src/validators/base-data-validator.ts
797
+ const FORMULA1 = "{FORMULA1}";
798
+ const FORMULA2 = "{FORMULA2}";
799
+ const TYPE = "{TYPE}";
800
+ const operatorNameMap = {
801
+ [_univerjs_core.DataValidationOperator.BETWEEN]: "dataValidation.operators.between",
802
+ [_univerjs_core.DataValidationOperator.EQUAL]: "dataValidation.operators.equal",
803
+ [_univerjs_core.DataValidationOperator.GREATER_THAN]: "dataValidation.operators.greaterThan",
804
+ [_univerjs_core.DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.operators.greaterThanOrEqual",
805
+ [_univerjs_core.DataValidationOperator.LESS_THAN]: "dataValidation.operators.lessThan",
806
+ [_univerjs_core.DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.operators.lessThanOrEqual",
807
+ [_univerjs_core.DataValidationOperator.NOT_BETWEEN]: "dataValidation.operators.notBetween",
808
+ [_univerjs_core.DataValidationOperator.NOT_EQUAL]: "dataValidation.operators.notEqual"
809
+ };
810
+ let DataValidatorDropdownType = /* @__PURE__ */ function(DataValidatorDropdownType) {
811
+ DataValidatorDropdownType["DATE"] = "date";
812
+ DataValidatorDropdownType["TIME"] = "time";
813
+ DataValidatorDropdownType["DATETIME"] = "datetime";
814
+ DataValidatorDropdownType["LIST"] = "list";
815
+ DataValidatorDropdownType["MULTIPLE_LIST"] = "multipleList";
816
+ DataValidatorDropdownType["COLOR"] = "color";
817
+ DataValidatorDropdownType["CASCADE"] = "cascade";
818
+ return DataValidatorDropdownType;
819
+ }({});
820
+ let BaseDataValidator = class BaseDataValidator {
821
+ constructor(localeService, injector) {
822
+ this.localeService = localeService;
823
+ this.injector = injector;
824
+ _defineProperty(this, "offsetFormulaByRange", true);
825
+ _defineProperty(this, "formulaInput", void 0);
826
+ _defineProperty(this, "canvasRender", null);
827
+ _defineProperty(this, "dropdownType", void 0);
828
+ _defineProperty(this, "optionsInput", void 0);
829
+ _defineProperty(this, "skipDefaultFontRender", void 0);
830
+ }
831
+ get operatorNames() {
832
+ return this.operators.map((operator) => this.localeService.t(operatorNameMap[operator]));
833
+ }
834
+ get titleStr() {
835
+ return this.localeService.t(this.title);
836
+ }
837
+ generateRuleName(rule) {
838
+ var _rule$formula, _rule$formula2;
839
+ if (!rule.operator) return this.localeService.t(OperatorTitleMap.NONE).replace(TYPE, this.titleStr);
840
+ const ruleName = this.localeService.t(OperatorTitleMap[rule.operator]).replace(FORMULA1, (_rule$formula = rule.formula1) !== null && _rule$formula !== void 0 ? _rule$formula : "").replace(FORMULA2, (_rule$formula2 = rule.formula2) !== null && _rule$formula2 !== void 0 ? _rule$formula2 : "");
841
+ return `${this.titleStr} ${ruleName}`;
842
+ }
843
+ generateRuleErrorMessage(rule, position) {
844
+ var _rule$formula3, _rule$formula4;
845
+ if (!rule.operator) return this.localeService.t(OperatorErrorTitleMap.NONE).replace(TYPE, this.titleStr);
846
+ return `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1, (_rule$formula3 = rule.formula1) !== null && _rule$formula3 !== void 0 ? _rule$formula3 : "").replace(FORMULA2, (_rule$formula4 = rule.formula2) !== null && _rule$formula4 !== void 0 ? _rule$formula4 : "")}`;
847
+ }
848
+ getExtraStyle(rule, value, ctx, row, column) {}
849
+ getRuleFinalError(rule, position) {
850
+ if (rule.showErrorMessage && rule.error) return rule.error;
851
+ return this.generateRuleErrorMessage(rule, position);
852
+ }
853
+ isEmptyCellValue(cellValue) {
854
+ if (cellValue === "" || cellValue === void 0 || cellValue === null) return true;
855
+ return false;
856
+ }
857
+ normalizeFormula(rule, unitId, subUnitId) {
858
+ return {
859
+ formula1: rule.formula1,
860
+ formula2: rule.formula2
861
+ };
862
+ }
863
+ async isValidType(cellInfo, formula, rule) {
864
+ return true;
865
+ }
866
+ transform(cellInfo, formula, rule) {
867
+ return cellInfo;
868
+ }
869
+ async validatorIsEqual(cellInfo, formula, rule) {
870
+ const { formula1 } = formula;
871
+ const { value: cellValue } = cellInfo;
872
+ if (Number.isNaN(formula1)) return true;
873
+ return cellValue === formula1;
874
+ }
875
+ async validatorIsNotEqual(cellInfo, formula, _rule) {
876
+ const { formula1 } = formula;
877
+ if (Number.isNaN(formula1)) return true;
878
+ return cellInfo.value !== formula1;
879
+ }
880
+ async validatorIsBetween(cellInfo, formula, _rule) {
881
+ const { formula1, formula2 } = formula;
882
+ if (Number.isNaN(formula1) || Number.isNaN(formula2)) return true;
883
+ const start = Math.min(formula1, formula2);
884
+ const end = Math.max(formula1, formula2);
885
+ return cellInfo.value >= start && cellInfo.value <= end;
886
+ }
887
+ async validatorIsNotBetween(cellInfo, formula, _rule) {
888
+ const { formula1, formula2 } = formula;
889
+ if (Number.isNaN(formula1) || Number.isNaN(formula2)) return true;
890
+ const start = Math.min(formula1, formula2);
891
+ const end = Math.max(formula1, formula2);
892
+ return cellInfo.value < start || cellInfo.value > end;
893
+ }
894
+ async validatorIsGreaterThan(cellInfo, formula, _rule) {
895
+ const { formula1 } = formula;
896
+ if (Number.isNaN(formula1)) return true;
897
+ return cellInfo.value > formula1;
898
+ }
899
+ async validatorIsGreaterThanOrEqual(cellInfo, formula, _rule) {
900
+ const { formula1 } = formula;
901
+ if (Number.isNaN(formula1)) return true;
902
+ return cellInfo.value >= formula1;
903
+ }
904
+ async validatorIsLessThan(cellInfo, formula, _rule) {
905
+ const { formula1 } = formula;
906
+ if (Number.isNaN(formula1)) return true;
907
+ return cellInfo.value < formula1;
908
+ }
909
+ async validatorIsLessThanOrEqual(cellInfo, formula, _rule) {
910
+ const { formula1 } = formula;
911
+ if (Number.isNaN(formula1)) return true;
912
+ return cellInfo.value <= formula1;
913
+ }
914
+ async validator(cellInfo, rule) {
915
+ const { value: cellValue, unitId, subUnitId } = cellInfo;
916
+ const isEmpty = this.isEmptyCellValue(cellValue);
917
+ const { allowBlank = true, operator } = rule;
918
+ if (isEmpty) return allowBlank;
919
+ const formulaInfo = await this.parseFormula(rule, unitId, subUnitId, cellInfo.row, cellInfo.column);
920
+ if (!formulaInfo.isFormulaValid) return false;
921
+ if (!await this.isValidType(cellInfo, formulaInfo, rule)) return false;
922
+ if (!operator) return true;
923
+ const transformedCell = this.transform(cellInfo, formulaInfo, rule);
924
+ switch (operator) {
925
+ case _univerjs_core.DataValidationOperator.BETWEEN: return this.validatorIsBetween(transformedCell, formulaInfo, rule);
926
+ case _univerjs_core.DataValidationOperator.EQUAL: return this.validatorIsEqual(transformedCell, formulaInfo, rule);
927
+ case _univerjs_core.DataValidationOperator.GREATER_THAN: return this.validatorIsGreaterThan(transformedCell, formulaInfo, rule);
928
+ case _univerjs_core.DataValidationOperator.GREATER_THAN_OR_EQUAL: return this.validatorIsGreaterThanOrEqual(transformedCell, formulaInfo, rule);
929
+ case _univerjs_core.DataValidationOperator.LESS_THAN: return this.validatorIsLessThan(transformedCell, formulaInfo, rule);
930
+ case _univerjs_core.DataValidationOperator.LESS_THAN_OR_EQUAL: return this.validatorIsLessThanOrEqual(transformedCell, formulaInfo, rule);
931
+ case _univerjs_core.DataValidationOperator.NOT_BETWEEN: return this.validatorIsNotBetween(transformedCell, formulaInfo, rule);
932
+ case _univerjs_core.DataValidationOperator.NOT_EQUAL: return this.validatorIsNotEqual(transformedCell, formulaInfo, rule);
933
+ default: throw new Error("Unknown operator.");
934
+ }
935
+ }
936
+ };
937
+ BaseDataValidator = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector))], BaseDataValidator);
938
+
939
+ //#endregion
940
+ exports.AddDataValidationMutation = AddDataValidationMutation;
941
+ Object.defineProperty(exports, 'BaseDataValidator', {
942
+ enumerable: true,
943
+ get: function () {
944
+ return BaseDataValidator;
945
+ }
946
+ });
947
+ Object.defineProperty(exports, 'DataValidationModel', {
948
+ enumerable: true,
949
+ get: function () {
950
+ return DataValidationModel;
951
+ }
952
+ });
953
+ Object.defineProperty(exports, 'DataValidationResourceController', {
954
+ enumerable: true,
955
+ get: function () {
956
+ return DataValidationResourceController;
957
+ }
958
+ });
959
+ exports.DataValidatorDropdownType = DataValidatorDropdownType;
960
+ exports.DataValidatorRegistryScope = DataValidatorRegistryScope;
961
+ exports.DataValidatorRegistryService = DataValidatorRegistryService;
962
+ exports.FORMULA1 = FORMULA1;
963
+ exports.FORMULA2 = FORMULA2;
964
+ exports.RemoveDataValidationMutation = RemoveDataValidationMutation;
965
+ exports.TWO_FORMULA_OPERATOR_COUNT = TWO_FORMULA_OPERATOR_COUNT;
966
+ exports.TYPE = TYPE;
967
+ exports.TextLengthErrorTitleMap = TextLengthErrorTitleMap;
968
+ Object.defineProperty(exports, 'UniverDataValidationPlugin', {
969
+ enumerable: true,
970
+ get: function () {
971
+ return UniverDataValidationPlugin;
972
+ }
973
+ });
974
+ exports.UpdateDataValidationMutation = UpdateDataValidationMutation;
975
+ exports.UpdateRuleType = UpdateRuleType;
976
+ exports.getRuleOptions = getRuleOptions;
977
+ exports.getRuleSetting = getRuleSetting;