@univerjs/sheets-data-validation-ui 0.18.0 → 0.19.0
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 +1 -51
- package/lib/es/index.js +1 -51
- package/lib/index.js +1 -51
- package/lib/types/controllers/dv-copy-paste.controller.d.ts +3 -2
- package/lib/umd/index.js +1 -51
- package/package.json +15 -15
package/lib/umd/index.js
CHANGED
|
@@ -1,51 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/engine-render`),require(`@univerjs/sheets`),require(`@univerjs/sheets-data-validation`),require(`@univerjs/data-validation`),require(`@univerjs/ui`),require(`rxjs`),require(`@univerjs/sheets-numfmt`),require(`@univerjs/sheets-ui`),require(`@univerjs/design`),require(`react`),require(`@univerjs/engine-formula`),require(`@univerjs/sheets-formula-ui`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/engine-render`,`@univerjs/sheets`,`@univerjs/sheets-data-validation`,`@univerjs/data-validation`,`@univerjs/ui`,`rxjs`,`@univerjs/sheets-numfmt`,`@univerjs/sheets-ui`,`@univerjs/design`,`react`,`@univerjs/engine-formula`,`@univerjs/sheets-formula-ui`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsDataValidationUi={},e.UniverCore,e.UniverEngineRender,e.UniverSheets,e.UniverSheetsDataValidation,e.UniverDataValidation,e.UniverUi,e.rxjs,e.UniverSheetsNumfmt,e.UniverSheetsUi,e.UniverDesign,e.React,e.UniverEngineFormula,e.UniverSheetsFormulaUi,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var h=Object.create,g=Object.defineProperty,_=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,y=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,x=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=v(t),a=0,o=i.length,s;a<o;a++)s=i[a],!b.call(e,s)&&s!==n&&g(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=_(t,s))||r.enumerable});return e};d=((e,t,n)=>(n=e==null?{}:h(y(e)),x(t||!e||!e.__esModule?g(n,`default`,{value:e,enumerable:!0}):n,e)))(d);var S=`@univerjs/sheets-data-validation-ui`,C=`0.18.0`;function w(e){"@babel/helpers - typeof";return w=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},w(e)}function T(e,t){if(w(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(w(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function E(e){var t=T(e,`string`);return w(t)==`symbol`?t:t+``}function D(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t){return function(n,r){t(n,r,e)}}function k(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 A=class extends t.Disposable{get activeRule(){return this._activeRule}get isOpen(){return this._open$.getValue()}constructor(e,n){super(),this._univerInstanceService=e,this._sidebarService=n,D(this,`_open$`,new s.BehaviorSubject(!1)),D(this,`open$`,this._open$.pipe((0,s.distinctUntilChanged)())),D(this,`_activeRule`,void 0),D(this,`_activeRule$`,new s.BehaviorSubject(void 0)),D(this,`activeRule$`,this._activeRule$.asObservable()),D(this,`_closeDisposable`,null),D(this,`_focusFormulaEditorActiveRuleSubUnitId`,null),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,s.filter)(e=>!e)).subscribe(()=>{this.close()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.id===`DataValidationPanel`&&(e.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}dispose(){var e;super.dispose(),this._open$.next(!1),this._open$.complete(),this._activeRule$.complete(),(e=this._closeDisposable)==null||e.dispose()}open(){this._open$.next(!0)}close(){var e;this._open$.next(!1),(e=this._closeDisposable)==null||e.dispose()}setCloseDisposable(e){this._closeDisposable=(0,t.toDisposable)(()=>{e.dispose(),this._closeDisposable=null})}setActiveRule(e){this._activeRule=e,this._activeRule$.next(e)}setFocusFormulaEditorActiveRuleSubUnitId(e){this._focusFormulaEditorActiveRuleSubUnitId=e}getFocusFormulaEditorActiveRuleSubUnitId(){return this._focusFormulaEditorActiveRuleSubUnitId}};A=k([O(0,t.IUniverInstanceService),O(1,o.ISidebarService)],A);let j=`sheets-data-validation-ui.config`;Symbol(j);let M={},N=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetInterceptorService=e,this._dataValidationModel=t,this._dataValidatorRegistryService=n,this._dialogService=r,this._localeService=i,this._sheetsDataValidationValidatorService=a,this._initEditorBridgeInterceptor()}_initEditorBridgeInterceptor(){this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(r.VALIDATE_CELL,{handler:async(e,n,r)=>{let i=await e,{row:a,col:o,unitId:s,subUnitId:c}=n,l=this._dataValidationModel.getRuleIdByLocation(s,c,a,o),f=l?this._dataValidationModel.getRuleById(s,c,l):void 0;if(i===!1)return r(Promise.resolve(!1));if(!f||f.errorStyle!==t.DataValidationErrorStyle.STOP)return r(Promise.resolve(!0));let p=this._dataValidatorRegistryService.getValidatorItem(f.type);return!p||await this._sheetsDataValidationValidatorService.validatorCell(s,c,a,o)===t.DataValidationStatus.VALID?r(Promise.resolve(!0)):(this._dialogService.open({width:368,title:{title:this._localeService.t(`dataValidation.alert.title`)},id:`reject-input-dialog`,children:{title:p.getRuleFinalError(f,{row:a,col:o,unitId:s,subUnitId:c})},footer:{title:(0,d.createElement)(u.Button,{variant:`primary`,onClick:()=>this._dialogService.close(`reject-input-dialog`)},this._localeService.t(`dataValidation.alert.ok`))},onClose:()=>{this._dialogService.close(`reject-input-dialog`)}}),r(Promise.resolve(!1)))}}))}showReject(e){this._dialogService.open({width:368,title:{title:this._localeService.t(`dataValidation.alert.title`)},id:`reject-input-dialog`,children:{title:e},footer:{title:(0,d.createElement)(u.Button,{variant:`primary`,onClick:()=>this._dialogService.close(`reject-input-dialog`)},this._localeService.t(`dataValidation.alert.ok`))},onClose:()=>{this._dialogService.close(`reject-input-dialog`)}})}};N=k([O(0,(0,t.Inject)(r.SheetInterceptorService)),O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(a.DataValidatorRegistryService)),O(3,o.IDialogService),O(4,(0,t.Inject)(t.LocaleService)),O(5,(0,t.Inject)(i.SheetsDataValidationValidatorService))],N);let P=e=>{if(e==null||typeof e==`boolean`)return;if(e===``)return(0,t.dayjs)();if(typeof e==`number`||!Number.isNaN(+e))return(0,t.dayjs)(t.numfmt.format(`yyyy-MM-dd HH:mm:ss`,Number(e)));let n=(0,t.dayjs)(e);if(n.isValid())return n};function F(e,t){if(e===(0,c.getPatternType)(t))return t;switch(e){case`datetime`:return`yyyy-MM-dd hh:mm:ss`;case`date`:return`yyyy-MM-dd`;case`time`:return`HH:mm:ss`}}let I=class extends t.Disposable{get activeDropdown(){return this._activeDropdown}constructor(e,t,n,r,i,a,o,c,l,u,d){super(),this._univerInstanceService=e,this._dataValidatorRegistryService=t,this._zenZoneService=n,this._dataValidationModel=r,this._sheetsSelectionsService=i,this._cellDropdownManagerService=a,this._sheetDataValidationModel=o,this._commandService=c,this._editorBridgeService=l,this._injector=u,this._configService=d,D(this,`_activeDropdown`,void 0),D(this,`_activeDropdown$`,new s.Subject),D(this,`_currentPopup`,null),D(this,`activeDropdown$`,this._activeDropdown$.asObservable()),D(this,`_zenVisible`,!1),this._init(),this._initSelectionChange(),this.disposeWithMe(()=>{this._activeDropdown$.complete()})}_init(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{this._zenVisible=e,e&&this.hideDropdown()}))}_getDropdownByCell(e,n,r,i){let a=e?this._univerInstanceService.getUnit(e,t.UniverInstanceType.UNIVER_SHEET):this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(!a)return;let o=n?a.getSheetBySheetId(n):a.getActiveSheet();if(!o)return;let s=this._dataValidationModel.getRuleByLocation(a.getUnitId(),o.getSheetId(),r,i);if(!s)return;let c=this._dataValidatorRegistryService.getValidatorItem(s.type);return c==null?void 0:c.dropdownType}_initSelectionChange(){this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe(e=>{e&&e.every(e=>!(e.primary&&this._getDropdownByCell(e.primary.unitId,e.primary.sheetId,e.primary.actualRow,e.primary.actualColumn)))&&this.hideDropdown()}))}showDropdown(e){let{location:s}=e,{row:c,col:u,unitId:d,subUnitId:f,workbook:p,worksheet:m}=s;if(this._currentPopup&&this._currentPopup.dispose(),this._zenVisible)return;this._activeDropdown=e,this._activeDropdown$.next(this._activeDropdown);let h=this._sheetDataValidationModel.getRuleByLocation(d,f,c,u);if(!h)return;let g=this._dataValidatorRegistryService.getValidatorItem(h.type);if(!(g!=null&&g.dropdownType))return;let _,v=async(e,i)=>{var a,s,_;if(!e)return!0;let v=e,y=m.getCell(c,u),b=v.format(i===`date`?`YYYY-MM-DD 00:00:00`:`YYYY-MM-DD HH:mm:ss`),x=(a=t.numfmt.parseDate(b))==null?void 0:a.v,S=i===`time`?x%1:x,C=p.getStyles().getStyleByCell(y),w=(s=C==null||(_=C.n)==null?void 0:_.pattern)==null?``:s;return h.errorStyle!==t.DataValidationErrorStyle.STOP||await g.validator({value:S,unitId:d,subUnitId:f,row:c,column:u,worksheet:m,workbook:p,interceptValue:b.replace(`Z`,``).replace(`T`,` `),t:t.CellValueType.NUMBER},h)?(await this._commandService.executeCommand(r.SetRangeValuesCommand.id,{unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:S,t:2,p:null,f:null,si:null,s:{n:{pattern:F(i,w)}}}}),await this._commandService.executeCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!0):(this._injector.has(N)&&this._injector.get(N).showReject(g.getRuleFinalError(h,{row:c,col:u,unitId:d,subUnitId:f})),!1)},y;switch(g.dropdownType){case a.DataValidatorDropdownType.DATE:{var b;let e=P((0,i.getCellValueOrigin)(m.getCellRaw(c,u))),t=!!((b=h.bizInfo)!=null&&b.showTime);y={location:s,type:`datepicker`,props:{showTime:t,onChange:e=>v(e,t?`datetime`:`date`),defaultValue:e,patternType:`date`}};break}case a.DataValidatorDropdownType.TIME:y={location:s,type:`datepicker`,props:{onChange:e=>v(e,`time`),defaultValue:P((0,i.getCellValueOrigin)(m.getCellRaw(c,u))),patternType:`time`}};break;case a.DataValidatorDropdownType.DATETIME:y={location:s,type:`datepicker`,props:{onChange:e=>v(e,`datetime`),defaultValue:P((0,i.getCellValueOrigin)(m.getCellRaw(c,u))),patternType:`datetime`}};break;case a.DataValidatorDropdownType.LIST:case a.DataValidatorDropdownType.MULTIPLE_LIST:{var x,S,C,w;let e=g.dropdownType===a.DataValidatorDropdownType.MULTIPLE_LIST,p=async t=>{let a=(0,i.serializeListOptions)(t),s={unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:a,p:null,f:null,si:null}};return this._commandService.executeCommand(r.SetRangeValuesCommand.id,s),this._editorBridgeService.isVisible().visible&&await this._commandService.executeCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!e},v=(h==null?void 0:h.renderMode)===t.DataValidationRenderMode.CUSTOM||(h==null?void 0:h.renderMode)===void 0,b=g.getListWithColor(h,d,f),T=(0,i.getDataValidationCellValue)(m.getCellRaw(c,u));y={location:s,type:`list`,props:{onChange:e=>p(e),options:b.map(e=>({label:e.label,value:e.label,color:v||e.color?e.color||`#ECECEC`:`transparent`})),onEdit:()=>{this._commandService.executeCommand(R.id,{ruleId:h.uid}),_==null||_.dispose()},defaultValue:T,multiple:e,showEdit:(x=(S=this._configService.getConfig(`sheets-data-validation-ui.config`))==null?void 0:S.showEditOnDropdown)==null?!0:x,showSearch:(C=(w=this._configService.getConfig(`sheets-data-validation-ui.config`))==null?void 0:w.showSearchOnDropdown)==null?!0:C}};break}case a.DataValidatorDropdownType.CASCADE:var T;y={type:`cascader`,props:{onChange:e=>{let t={unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:e.join(`/`),p:null,f:null,si:null}};return this._commandService.syncExecuteCommand(r.SetRangeValuesCommand.id,t),this._editorBridgeService.isVisible().visible&&this._commandService.syncExecuteCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!0},defaultValue:(0,i.getDataValidationCellValue)(m.getCellRaw(c,u)).split(`/`),options:JSON.parse((T=h.formula1)==null?`[]`:T)},location:s};break;case a.DataValidatorDropdownType.COLOR:y={type:`color`,props:{onChange:e=>{let t={unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:e,p:null,f:null,si:null}};return this._commandService.syncExecuteCommand(r.SetRangeValuesCommand.id,t),this._editorBridgeService.isVisible().visible&&this._commandService.syncExecuteCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!0},defaultValue:(0,i.getDataValidationCellValue)(m.getCellRaw(c,u))},location:s};break;default:throw Error(`[DataValidationDropdownManagerService]: unknown type!`)}if(_=this._cellDropdownManagerService.showDropdown({...y,onHide:()=>{this._activeDropdown=null,this._activeDropdown$.next(null)}}),!_)throw Error(`[DataValidationDropdownManagerService]: cannot show dropdown!`);let E=new t.DisposableCollection;E.add(_),E.add({dispose:()=>{var e,t;(e=this._activeDropdown)==null||(t=e.onHide)==null||t.call(e)}}),this._currentPopup=E}hideDropdown(){this._activeDropdown&&(this._currentPopup&&this._currentPopup.dispose(),this._currentPopup=null,this._activeDropdown=null,this._activeDropdown$.next(null))}showDataValidationDropdown(e,n,r,i,a){let o=this._univerInstanceService.getUnit(e,t.UniverInstanceType.UNIVER_SHEET);if(!o)return;let s=o.getSheetBySheetId(n);if(!s)return;let c=this._dataValidationModel.getRuleByLocation(o.getUnitId(),s.getSheetId(),r,i);if(!c)return;let l=this._dataValidatorRegistryService.getValidatorItem(c.type);if(!l||!l.dropdownType){this.hideDropdown();return}this.showDropdown({location:{workbook:o,worksheet:s,row:r,col:i,unitId:e,subUnitId:n},onHide:a})}};I=k([O(0,t.IUniverInstanceService),O(1,(0,t.Inject)(a.DataValidatorRegistryService)),O(2,o.IZenZoneService),O(3,(0,t.Inject)(i.SheetDataValidationModel)),O(4,(0,t.Inject)(r.SheetsSelectionsService)),O(5,(0,t.Inject)(l.ISheetCellDropdownManagerService)),O(6,(0,t.Inject)(i.SheetDataValidationModel)),O(7,t.ICommandService),O(8,l.IEditorBridgeService),O(9,(0,t.Inject)(t.Injector)),O(10,t.IConfigService)],I);let L=`DataValidationPanel`,R={id:`data-validation.operation.open-validation-panel`,type:t.CommandType.OPERATION,handler(e,n){if(!n)return!1;let{ruleId:i,isAdd:s}=n,c=e.get(A),l=e.get(a.DataValidationModel),u=e.get(t.IUniverInstanceService),d=e.get(o.ISidebarService),f=(0,r.getSheetCommandTarget)(u);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h=i?l.getRuleById(p,m,i):void 0;c.open(),c.setActiveRule(h&&{unitId:p,subUnitId:m,rule:h});let g=d.open({id:L,header:{title:s?`dataValidation.panel.addTitle`:`dataValidation.panel.title`},children:{label:L},width:312,onClose:()=>c.close()});return c.setCloseDisposable(g),!0}},z={id:`data-validation.operation.close-validation-panel`,type:t.CommandType.OPERATION,handler(e){return e.get(A).close(),!0}},B={id:`data-validation.operation.toggle-validation-panel`,type:t.CommandType.OPERATION,handler(e){let n=e.get(t.ICommandService),r=e.get(A);return r.open(),r.isOpen?n.executeCommand(z.id):n.executeCommand(R.id),!0}},V={type:t.CommandType.OPERATION,id:`sheet.operation.show-data-validation-dropdown`,handler(e,t){if(!t)return!1;let n=e.get(I),{unitId:r,subUnitId:i,row:a,column:o}=t,s=n.activeDropdown,c=s==null?void 0:s.location;return c&&c.unitId===r&&c.subUnitId===i&&c.row===a&&c.col===o||n.showDataValidationDropdown(r,i,a,o),!0}},H={type:t.CommandType.OPERATION,id:`sheet.operation.hide-data-validation-dropdown`,handler(e,t){return t?(e.get(I).hideDropdown(),!0):!1}},U={type:t.CommandType.COMMAND,id:`data-validation.command.addRuleAndOpen`,handler(e){let n=(0,r.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!n)return!1;let{workbook:a,worksheet:o}=n,s=(0,i.createDefaultNewRule)(e),c=e.get(t.ICommandService),l={rule:s,unitId:a.getUnitId(),subUnitId:o.getSheetId()};return c.syncExecuteCommand(i.AddSheetDataValidationCommand.id,l)?(c.syncExecuteCommand(R.id,{ruleId:s.uid,isAdd:!0}),!0):!1}},W=`SHEET_DATA_VALIDATION_ALERT`,G=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._hoverManagerService=e,this._cellAlertManagerService=t,this._univerInstanceService=n,this._localeService=r,this._zenZoneService=i,this._dataValidationModel=a,this._init()}_init(){this._initCellAlertPopup(),this._initZenService()}_initCellAlertPopup(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe((0,s.debounceTime)(100)).subscribe(e=>{if(e){let r=this._univerInstanceService.getUnit(e.location.unitId,t.UniverInstanceType.UNIVER_SHEET),i=r.getSheetBySheetId(e.location.subUnitId);if(!i)return;let a=this._dataValidationModel.getRuleByLocation(e.location.unitId,e.location.subUnitId,e.location.row,e.location.col);if(!a){this._cellAlertManagerService.removeAlert(W);return}if(this._dataValidationModel.validator(a,{...e.location,workbook:r,worksheet:i})===t.DataValidationStatus.INVALID){var n;let t=this._cellAlertManagerService.currentAlert.get(W),r=t==null||(n=t.alert)==null?void 0:n.location;if(r&&r.row===e.location.row&&r.col===e.location.col&&r.subUnitId===e.location.subUnitId&&r.unitId===e.location.unitId){this._cellAlertManagerService.removeAlert(W);return}let i=this._dataValidationModel.getValidator(a.type);if(!i){this._cellAlertManagerService.removeAlert(W);return}this._cellAlertManagerService.showAlert({type:l.CellAlertType.ERROR,title:this._localeService.t(`dataValidation.error.title`),message:i==null?void 0:i.getRuleFinalError(a,e.location),location:e.location,width:200,height:74,key:W});return}}this._cellAlertManagerService.removeAlert(W)}))}_initZenService(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e&&this._cellAlertManagerService.removeAlert(W)}))}};G=k([O(0,(0,t.Inject)(l.HoverManagerService)),O(1,(0,t.Inject)(l.CellAlertManagerService)),O(2,t.IUniverInstanceService),O(3,(0,t.Inject)(t.LocaleService)),O(4,o.IZenZoneService),O(5,(0,t.Inject)(i.SheetDataValidationModel))],G);let K=class extends t.Disposable{constructor(e,t,n){super(),this._autoFillService=e,this._sheetDataValidationModel=t,this._injector=n,this._initAutoFill()}_initAutoFill(){let e=()=>({redos:[],undos:[]}),n=(e,n)=>{let{source:a,target:o,unitId:s,subUnitId:c}=e,u=this._sheetDataValidationModel.getRuleObjectMatrix(s,c).clone(),d=(0,l.virtualizeDiscreteRanges)([a,o]),[f,p]=d.ranges,{mapFunc:m}=d,h={row:f.startRow,col:f.startColumn},g=r.AutoFillTools.getAutoFillRepeatRange(f,p),_=new t.ObjectMatrix,v=new Set;g.forEach(e=>{let n=e.repeatStartCell,r=e.relativeRange,i={startRow:h.row,startColumn:h.col,endColumn:h.col,endRow:h.row},a={startRow:n.row,startColumn:n.col,endColumn:n.col,endRow:n.row};t.Range.foreach(r,(e,n)=>{let r=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},i),{row:o,col:l}=m(r.startRow,r.startColumn),u=this._sheetDataValidationModel.getRuleIdByLocation(s,c,o,l)||``,d=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},a),{row:f,col:p}=m(d.startRow,d.startColumn);_.setValue(f,p,u),v.add(u)})});let y=Array.from(v).map(e=>({id:e,ranges:(0,t.queryObjectMatrix)(_,t=>t===e)}));u.addRangeRules(y);let{redoMutations:b,undoMutations:x}=(0,i.getDataValidationDiffMutations)(s,c,u.diff(this._sheetDataValidationModel.getRules(s,c)),this._injector,`patched`,n===r.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT);return{undos:x,redos:b}},a={id:i.DATA_VALIDATION_PLUGIN_NAME,onBeforeFillData:e=>{let{source:n,unitId:i,subUnitId:a}=e;for(let e of n.rows)for(let o of n.cols){let n=this._sheetDataValidationModel.getRuleByLocation(i,a,e,o);if(n&&n.type===t.DataValidationType.CHECKBOX){this._autoFillService.setDisableApplyType(r.AUTO_FILL_APPLY_TYPE.SERIES,!0);return}}},onFillData:(t,i,a)=>a===r.AUTO_FILL_APPLY_TYPE.COPY||a===r.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||a===r.AUTO_FILL_APPLY_TYPE.SERIES?n(t,a):e(),onAfterFillData:()=>{}};this.disposeWithMe(this._autoFillService.addHook(a))}};K=k([O(0,r.IAutoFillService),O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(t.Injector))],K);let q=class extends t.Disposable{constructor(e,t,n){super(),this._sheetClipboardService=e,this._sheetDataValidationModel=t,this._injector=n,D(this,`_copyInfo`,void 0),this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:i.DATA_VALIDATION_PLUGIN_NAME,onBeforeCopy:(e,t,n)=>this._collect(e,t,n),onPasteCells:(e,t,n,r)=>{let{copyType:i=l.COPY_TYPE.COPY,pasteType:a}=r,{range:o}=e||{},{range:s,unitId:c,subUnitId:u}=t;return this._generateMutations(s,{copyType:i,pasteType:a,copyRange:o,unitId:c,subUnitId:u})}})}_collect(e,n,i){let a=new t.ObjectMatrix;this._copyInfo={unitId:e,subUnitId:n,matrix:a};let o=this._injector.invoke(t=>(0,r.rangeToDiscreteRange)(i,t,e,n));if(!o)return;let{rows:s,cols:c}=o;s.forEach((t,r)=>{c.forEach((i,o)=>{let s=this._sheetDataValidationModel.getRuleIdByLocation(e,n,t,i);a.setValue(r,o,s==null?``:s)})})}_generateMutations(e,n){if(!this._copyInfo)return{redos:[],undos:[]};if(n.copyType===l.COPY_TYPE.CUT)return this._copyInfo=null,{redos:[],undos:[]};if(!this._copyInfo||!this._copyInfo.matrix.getSizeOf()||!n.copyRange||[l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH,l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE,l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA].includes(n.pasteType))return{redos:[],undos:[]};let{unitId:r,subUnitId:a}=this._copyInfo;if(n.unitId!==r||a!==n.subUnitId){let o=this._sheetDataValidationModel.getRuleObjectMatrix(n.unitId,n.subUnitId).clone(),s=new t.ObjectMatrix,c=new Set,{ranges:[u,d],mapFunc:f}=(0,l.virtualizeDiscreteRanges)([n.copyRange,e]),p=(0,l.getRepeatRange)(u,d,!0),m=new Map;p.forEach(({startRange:e})=>{var i;(i=this._copyInfo)==null||i.matrix.forValue((i,o,l)=>{let u=t.Rectangle.getPositionRange({startRow:i,endRow:i,startColumn:o,endColumn:o},e),d=`${a}-${l}`,p=this._sheetDataValidationModel.getRuleById(r,a,l);!this._sheetDataValidationModel.getRuleById(n.unitId,n.subUnitId,d)&&p&&m.set(d,{...p,uid:d});let{row:h,col:g}=f(u.startRow,u.startColumn);c.add(d),s.setValue(h,g,d)})});let h=Array.from(c).map(e=>({id:e,ranges:(0,t.queryObjectMatrix)(s,t=>t===e)}));o.addRangeRules(h);let{redoMutations:g,undoMutations:_}=(0,i.getDataValidationDiffMutations)(n.unitId,n.subUnitId,o.diffWithAddition(this._sheetDataValidationModel.getRules(n.unitId,n.subUnitId),m.values()),this._injector,`patched`,!1);return{redos:g,undos:_}}else{let o=this._sheetDataValidationModel.getRuleObjectMatrix(r,a).clone(),s=new t.ObjectMatrix,c=new Set,{ranges:[u,d],mapFunc:f}=(0,l.virtualizeDiscreteRanges)([n.copyRange,e]);(0,l.getRepeatRange)(u,d,!0).forEach(({startRange:e})=>{var n;(n=this._copyInfo)==null||n.matrix.forValue((n,r,i)=>{let a=t.Rectangle.getPositionRange({startRow:n,endRow:n,startColumn:r,endColumn:r},e),{row:o,col:l}=f(a.startRow,a.startColumn);s.setValue(o,l,i),c.add(i)})});let p=Array.from(c).map(e=>({id:e,ranges:(0,t.queryObjectMatrix)(s,t=>t===e)}));o.addRangeRules(p);let{redoMutations:m,undoMutations:h}=(0,i.getDataValidationDiffMutations)(r,a,o.diff(this._sheetDataValidationModel.getRules(r,a)),this._injector,`patched`,!1);return{redos:m,undos:h}}}};q=k([O(0,l.ISheetClipboardService),O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(t.Injector))],q);let J=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===i.AddSheetDataValidationCommand.id){let{unitId:t,subUnitId:n,rule:{ranges:i}}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[r.WorkbookEditablePermission],rangeTypes:[r.RangeProtectionPermissionEditPoint],worksheetTypes:[r.WorksheetEditPermission,r.WorksheetSetCellStylePermission]},i,t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.setStyleErr`))}if(e.id===i.UpdateSheetDataValidationRangeCommand.id){let{unitId:t,subUnitId:n,ranges:i}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[r.WorkbookEditablePermission],rangeTypes:[r.RangeProtectionPermissionEditPoint],worksheetTypes:[r.WorksheetEditPermission,r.WorksheetSetCellStylePermission]},i,t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.setStyleErr`))}}))}};J=k([O(0,(0,t.Inject)(t.LocaleService)),O(1,t.ICommandService),O(2,(0,t.Inject)(r.SheetPermissionCheckController))],J);let ee=`sheet.menu.data-validation`;function te(e){return{id:ee,type:o.MenuItemType.SUBITEMS,icon:`DataValidationIcon`,tooltip:`dataValidation.title`,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,l.getCurrentRangeDisable$)(e,{workbookTypes:[r.WorkbookEditablePermission],worksheetTypes:[r.WorksheetSetCellStylePermission,r.WorksheetEditPermission],rangeTypes:[r.RangeProtectionPermissionEditPoint]})}}function ne(e){return{id:R.id,title:`dataValidation.panel.title`,type:o.MenuItemType.BUTTON}}function re(e){return{id:U.id,title:`dataValidation.panel.add`,type:o.MenuItemType.BUTTON}}let ie={[o.RibbonDataGroup.RULES]:{[ee]:{order:0,menuItemFactory:te,[R.id]:{order:0,menuItemFactory:ne},[U.id]:{order:1,menuItemFactory:re}}}},ae={tr:{size:6,color:`#fe4b4b`}},Y=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this._commandService=e,this._menuManagerService=t,this._renderManagerService=n,this._univerInstanceService=r,this._autoHeightController=i,this._dropdownManagerService=a,this._sheetDataValidationModel=o,this._dataValidatorRegistryService=s,this._sheetInterceptorService=c,this._dataValidationCacheService=l,this._editorBridgeService=u,this._initMenu(),this._initDropdown(),this._initViewModelIntercept(),this._initAutoHeight()}_initMenu(){this._menuManagerService.mergeMenu(ie)}_initDropdown(){this._editorBridgeService&&this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{if(!e.visible){var t;((t=this._dropdownManagerService.activeDropdown)==null?void 0:t.trigger)===`editor-bridge`&&this._dropdownManagerService.hideDropdown();return}let n=this._editorBridgeService.getEditCellState();if(n){let{unitId:e,sheetId:t,row:r,column:i}=n,a=this._univerInstanceService.getUniverSheetInstance(e);if(!a)return;let o=this._sheetDataValidationModel.getRuleByLocation(e,t,r,i);if(!o)return;let s=this._dataValidatorRegistryService.getValidatorItem(o.type);if(!(s!=null&&s.dropdownType))return;let c=a.getActiveSheet();if(!c)return;let l=this._dropdownManagerService.activeDropdown,u=l==null?void 0:l.location;if(u&&u.unitId===e&&u.subUnitId===t&&u.row===r&&u.col===i)return;this._dropdownManagerService.showDropdown({location:{unitId:e,subUnitId:t,row:r,col:i,workbook:a,worksheet:c},trigger:`editor-bridge`,closeOnOutSide:!1})}}))}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(r.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,priority:r.InterceptCellContentPriority.DATA_VALIDATION,handler:(e,n,r)=>{var a,o,s,c,u;let{row:d,col:f,unitId:p,subUnitId:m,workbook:h,worksheet:g}=n,_=this._sheetDataValidationModel.getRuleIdByLocation(p,m,d,f);if(!_)return r(e);let v=this._sheetDataValidationModel.getRuleById(p,m,_);if(!v)return r(e);let y=(a=this._dataValidationCacheService.getValue(p,m,d,f))==null?t.DataValidationStatus.VALID:a,b=this._dataValidatorRegistryService.getValidatorItem(v.type),x=n.rawData,S,C={get value(){var e;return S===void 0&&(S=(e=(0,i.getCellValueOrigin)(x))==null?null:e),S}},w={get value(){var e;return`${(e=C.value)==null?``:e}`}};return(!e||e===n.rawData)&&(e={...n.rawData}),e.markers={...e==null?void 0:e.markers,...y===t.DataValidationStatus.INVALID?ae:null},e.customRender=[...(o=e==null?void 0:e.customRender)==null?[]:o,...b!=null&&b.canvasRender?[b.canvasRender]:[]],e.fontRenderExtension={...e==null?void 0:e.fontRenderExtension,isSkip:(e==null||(s=e.fontRenderExtension)==null?void 0:s.isSkip)||(b==null||(c=b.skipDefaultFontRender)==null?void 0:c.call(b,v,C.value,n))},e.interceptorStyle={...e==null?void 0:e.interceptorStyle,...b==null?void 0:b.getExtraStyle(v,w.value,{get style(){let t=h.getStyles();return(typeof(e==null?void 0:e.s)==`string`?t.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}}},d,f)},e.interceptorAutoHeight=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoHeight)==null?void 0:a.call(i,c)},e.interceptorAutoWidth=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoWidth)==null?void 0:a.call(i,c)},e.coverable=((u=e==null?void 0:e.coverable)==null?!0:u)&&!(v.type===t.DataValidationType.LIST||v.type===t.DataValidationType.LIST_MULTIPLE),r(e)}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe((0,s.filter)(e=>e.source===`command`),(0,s.bufferTime)(100)).subscribe(e=>{if(e.length===0)return;let n=[];e.forEach(e=>{if(e.rule.type===t.DataValidationType.LIST_MULTIPLE||e.rule.type===t.DataValidationType.LIST){var r;(r=e.rule)!=null&&r.ranges&&n.push(...e.rule.ranges)}}),n.length&&(0,t.sequenceExecute)(this._autoHeightController.getUndoRedoParamsOfAutoHeight(n).redos,this._commandService)})}};Y=k([O(0,t.ICommandService),O(1,o.IMenuManagerService),O(2,n.IRenderManagerService),O(3,t.IUniverInstanceService),O(4,(0,t.Inject)(l.AutoHeightController)),O(5,(0,t.Inject)(I)),O(6,(0,t.Inject)(i.SheetDataValidationModel)),O(7,(0,t.Inject)(a.DataValidatorRegistryService)),O(8,(0,t.Inject)(r.SheetInterceptorService)),O(9,(0,t.Inject)(i.DataValidationCacheService)),O(10,(0,t.Optional)(l.IEditorBridgeService))],Y);let oe=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o){super(),this._commandService=e,this._renderManagerService=t,this._autoHeightController=n,this._dataValidatorRegistryService=r,this._sheetInterceptorService=i,this._sheetDataValidationModel=a,this._dataValidationCacheService=o,this._initViewModelIntercept(),this._initAutoHeight()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(r.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,priority:r.InterceptCellContentPriority.DATA_VALIDATION,handler:(e,n,r)=>{var a,o,s,c,u;let{row:d,col:f,unitId:p,subUnitId:m,workbook:h,worksheet:g}=n,_=this._sheetDataValidationModel.getRuleIdByLocation(p,m,d,f);if(!_)return r(e);let v=this._sheetDataValidationModel.getRuleById(p,m,_);if(!v)return r(e);let y=(a=this._dataValidationCacheService.getValue(p,m,d,f))==null?t.DataValidationStatus.VALID:a,b=this._dataValidatorRegistryService.getValidatorItem(v.type),x=(0,i.getCellValueOrigin)(g.getCellRaw(d,f)),S=`${x==null?``:x}`;return(!e||e===n.rawData)&&(e={...n.rawData}),e.markers={...e==null?void 0:e.markers,...y===t.DataValidationStatus.INVALID?ae:null},e.customRender=[...(o=e==null?void 0:e.customRender)==null?[]:o,...b!=null&&b.canvasRender?[b.canvasRender]:[]],e.fontRenderExtension={...e==null?void 0:e.fontRenderExtension,isSkip:(e==null||(s=e.fontRenderExtension)==null?void 0:s.isSkip)||(b==null||(c=b.skipDefaultFontRender)==null?void 0:c.call(b,v,x,n))},e.interceptorStyle={...e==null?void 0:e.interceptorStyle,...b==null?void 0:b.getExtraStyle(v,S,{get style(){let t=h.getStyles();return(typeof(e==null?void 0:e.s)==`string`?t.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}}},d,f)},e.interceptorAutoHeight=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoHeight)==null?void 0:a.call(i,c)},e.interceptorAutoWidth=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoWidth)==null?void 0:a.call(i,c)},e.coverable=((u=e==null?void 0:e.coverable)==null?!0:u)&&!(v.type===t.DataValidationType.LIST||v.type===t.DataValidationType.LIST_MULTIPLE),r(e)}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe((0,s.filter)(e=>e.source===`command`),(0,s.bufferTime)(16)).subscribe(e=>{let n=[];e.forEach(e=>{if(e.rule.type===t.DataValidationType.LIST_MULTIPLE||e.rule.type===t.DataValidationType.LIST){var r;(r=e.rule)!=null&&r.ranges&&n.push(...e.rule.ranges)}}),n.length&&(0,t.sequenceExecute)(this._autoHeightController.getUndoRedoParamsOfAutoHeight(n).redos,this._commandService)})}};oe=k([O(0,t.ICommandService),O(1,n.IRenderManagerService),O(2,(0,t.Inject)(l.AutoHeightController)),O(3,(0,t.Inject)(a.DataValidatorRegistryService)),O(4,(0,t.Inject)(r.SheetInterceptorService)),O(5,(0,t.Inject)(i.SheetDataValidationModel)),O(6,(0,t.Inject)(i.DataValidationCacheService))],oe);let se=class extends t.Disposable{constructor(e,t,n){super(),this._context=e,this._sheetDataValidationModel=t,this._sheetSkeletonManagerService=n,this._initSkeletonChange()}_initSkeletonChange(){this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe((0,t.bufferDebounceTime)(16)).subscribe(e=>{var t;if(!e.length)return;let n=new Set;e.forEach(e=>{n.add(e.subUnitId)}),n.forEach(e=>{var t;(t=this._sheetSkeletonManagerService.getSkeletonParam(e))==null||t.skeleton.makeDirty(!0)}),(t=this._context.mainComponent)==null||t.makeForceDirty()}))}};se=k([O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(l.SheetSkeletonManagerService))],se);function X({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,d.useRef)(`_${de()}`);return ce(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function ce(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...le(e,n,i),...r},(ue(e,n).children||[]).map((r,a)=>ce(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function le(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function ue(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function de(){return Math.random().toString(36).substring(2,8)}X.displayName=`UniverIcon`;let fe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M1.4917 3.07803C1.4917 2.19437 2.20804 1.47803 3.0917 1.47803H5.6917C6.57536 1.47803 7.2917 2.19437 7.2917 3.07803V5.67803C7.2917 6.56168 6.57535 7.27803 5.6917 7.27803H3.0917C2.20804 7.27803 1.4917 6.56168 1.4917 5.67803V3.07803ZM3.0917 2.67803C2.87078 2.67803 2.6917 2.85711 2.6917 3.07803V5.67803C2.6917 5.89894 2.87079 6.07803 3.0917 6.07803H5.6917C5.91261 6.07803 6.0917 5.89894 6.0917 5.67803V3.07803C6.0917 2.85711 5.91261 2.67803 5.6917 2.67803H3.0917Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M14.6175 2.45279C14.8518 2.68711 14.8518 3.06701 14.6175 3.30132L11.6151 6.30365C11.3957 6.52307 11.0451 6.53897 10.8067 6.34031L8.80915 4.67566C8.55458 4.46352 8.52019 4.08518 8.73233 3.83062C8.94447 3.57605 9.32281 3.54166 9.57737 3.7538L11.154 5.06767L13.769 2.45278C14.0033 2.21847 14.3832 2.21848 14.6175 2.45279Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M14.1175 9.19746C14.3518 9.43178 14.3518 9.81168 14.1175 10.046L12.5418 11.6217L14.1175 13.1975C14.3518 13.4318 14.3518 13.8117 14.1175 14.046C13.8832 14.2803 13.5033 14.2803 13.269 14.046L11.6933 12.4703L10.1175 14.046C9.88321 14.2803 9.50331 14.2803 9.269 14.046C9.03468 13.8117 9.03468 13.4318 9.269 13.1975L10.8447 11.6217L9.269 10.046C9.03468 9.81168 9.03468 9.43178 9.269 9.19746C9.50331 8.96315 9.88321 8.96315 10.1175 9.19746L11.6933 10.7732L13.269 9.19746C13.5033 8.96315 13.8832 8.96315 14.1175 9.19746Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M3.0917 8.72168C2.20804 8.72168 1.4917 9.43802 1.4917 10.3217V12.9217C1.4917 13.8053 2.20804 14.5217 3.0917 14.5217H5.6917C6.57535 14.5217 7.2917 13.8053 7.2917 12.9217V10.3217C7.2917 9.43802 6.57536 8.72168 5.6917 8.72168H3.0917ZM2.6917 10.3217C2.6917 10.1008 2.87078 9.92168 3.0917 9.92168H5.6917C5.91261 9.92168 6.0917 10.1008 6.0917 10.3217V12.9217C6.0917 13.1426 5.91261 13.3217 5.6917 13.3217H3.0917C2.87079 13.3217 2.6917 13.1426 2.6917 12.9217V10.3217Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},pe=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`data-validation-icon`,ref:t,icon:fe}))});pe.displayName=`DataValidationIcon`;let me={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},he=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`delete-icon`,ref:t,icon:me}))});he.displayName=`DeleteIcon`;let ge={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z`}}]},_e=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`increase-icon`,ref:t,icon:ge}))});_e.displayName=`IncreaseIcon`;let ve={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ye=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`more-down-icon`,ref:t,icon:ve}))});ye.displayName=`MoreDownIcon`;let be={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.64645 9.85355C4.45118 9.65829 4.45118 9.34171 4.64645 9.14645L7.64645 6.14645C7.84171 5.95118 8.15829 5.95118 8.35355 6.14645L11.3536 9.14645C11.5488 9.34171 11.5488 9.65829 11.3536 9.85355C11.1583 10.0488 10.8417 10.0488 10.6464 9.85355L8 7.20711L5.35355 9.85355C5.15829 10.0488 4.84171 10.0488 4.64645 9.85355Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},xe=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`more-up-icon`,ref:t,icon:be}))});xe.displayName=`MoreUpIcon`;let Se={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z`}}]},Ce=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`sequence-icon`,ref:t,icon:Se}))});Ce.displayName=`SequenceIcon`;function we(e){var n;let r=(0,o.useDependency)(t.LocaleService),i=(0,o.useDependency)(o.ComponentManager),{value:a,onChange:s,extraComponent:c}=e,[l,f]=(0,d.useState)(!1),p=c?i.get(c):null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`
|
|
2
|
-
univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900
|
|
3
|
-
dark:!univer-text-white
|
|
4
|
-
`,onClick:()=>f(!l),children:[r.t(`dataValidation.panel.options`),l?(0,m.jsx)(xe,{className:`univer-ml-1`}):(0,m.jsx)(ye,{className:`univer-ml-1`})]}),l&&(0,m.jsxs)(m.Fragment,{children:[p?(0,m.jsx)(p,{value:a,onChange:s}):null,(0,m.jsx)(u.FormLayout,{label:r.t(`dataValidation.panel.invalid`),children:(0,m.jsxs)(u.RadioGroup,{value:`${(n=a.errorStyle)==null?t.DataValidationErrorStyle.WARNING:n}`,onChange:e=>s({...a,errorStyle:+e}),children:[(0,m.jsx)(u.Radio,{value:`${t.DataValidationErrorStyle.WARNING}`,children:r.t(`dataValidation.panel.showWarning`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationErrorStyle.STOP}`,children:r.t(`dataValidation.panel.rejectInput`)})]})}),(0,m.jsx)(u.FormLayout,{label:r.t(`dataValidation.panel.messageInfo`),children:(0,m.jsx)(u.Checkbox,{checked:a.showErrorMessage,onChange:()=>s({...a,showErrorMessage:!a.showErrorMessage}),children:r.t(`dataValidation.panel.showInfo`)})}),a.showErrorMessage?(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Input,{value:a.error,onChange:e=>s({...a,error:e})})}):null]})]})}let Te=e=>(0,t.debounce)(async(t,n,r,i)=>{let a=await e.executeCommand(t,n,r);i==null||i(a)},1e3);function Ee(e,n,r){var i;if(n){var a;return((a=e.getUnit(n))==null||(a=a.getSheetBySheetName(r))==null?void 0:a.getSheetId())||``}return((i=e.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null||(i=i.getSheetBySheetName(r))==null?void 0:i.getSheetId())||``}function De(){var e,n;let[c,l]=(0,d.useState)(0),h=(0,o.useDependency)(A),{unitId:g,subUnitId:_,rule:v}=(0,o.useObservable)(h.activeRule$,h.activeRule)||{},y=v.uid,b=(0,o.useDependency)(a.DataValidatorRegistryService),x=(0,o.useDependency)(t.IUniverInstanceService),S=(0,o.useDependency)(o.ComponentManager),C=(0,o.useDependency)(t.ICommandService),w=(0,o.useDependency)(a.DataValidationModel),T=(0,o.useDependency)(t.LocaleService),E=(0,o.useObservable)(()=>x.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),D=(0,o.useObservable)(()=>{var e;return(e=E==null?void 0:E.activeSheet$)==null?(0,s.of)(null):e},void 0,void 0,[]),[O,k]=(0,d.useState)(v),j=b.getValidatorItem(O.type),[M,N]=(0,d.useState)(!1),P=b.getValidatorsByScope(a.DataValidatorRegistryScope.SHEET),[F,I]=(0,d.useState)(()=>O.ranges.map(e=>({unitId:``,sheetId:``,range:e}))),L=(0,d.useMemo)(()=>Te(C),[C]),[R,z]=(0,d.useState)(!1),[B,V]=(0,d.useState)(!1),H=(0,d.useRef)(null),U=(0,o.useDependency)(r.SheetsSelectionsService);if((0,d.useEffect)(()=>()=>{let e=U.getCurrentLastSelection();e&&U.setSelections([e])},[U]),(0,d.useEffect)(()=>{C.onCommandExecuted(e=>{(e.id===t.UndoCommand.id||e.id===t.RedoCommand.id)&&setTimeout(()=>{let e=w.getRuleById(g,_,y);l(e=>e+1),e&&(k(e),I(e.ranges.map(e=>({unitId:``,sheetId:``,range:e}))))},20)})},[C,w,y,_,g]),!j)return null;let W=j.operators,G=j.operatorNames,K=O.operator?a.TWO_FORMULA_OPERATOR_COUNT.includes(O.operator):!1,q=()=>{(D==null?void 0:D.getSheetId())!==_&&C.syncExecuteCommand(r.SetWorksheetActiveOperation.id,{unitId:g,subUnitId:_})},J=()=>{var e;if(!((e=H.current)==null||(e=e.editor)==null)&&e.isFocus()){var t;ee((t=H.current)==null?void 0:t.getValue())}!O.ranges.length||R||(j.validatorFormula(O,g,_).success?h.setActiveRule(null):N(!0),q())},ee=(0,o.useEvent)(e=>{let n=e.split(`,`).filter(Boolean).map(f.deserializeRangeWithSheet).map(e=>{let t=e.sheetName;if(t){let n=Ee(x,e.unitId,t);return{...e,sheetId:n}}return{...e,sheetId:``}});if((0,t.isUnitRangesEqual)(n,F))return;I(n);let r=n.filter(e=>(!e.unitId||e.unitId===g)&&(!e.sheetId||e.sheetId===_)).map(e=>e.range);if(k({...O,ranges:r}),r.length===0)return;let a={unitId:g,subUnitId:_,ruleId:y,ranges:r};L(i.UpdateSheetDataValidationRangeCommand.id,a)}),te=e=>{if((0,t.shallowEqual)(e,(0,a.getRuleSetting)(O)))return;k({...O,...e});let n={unitId:g,subUnitId:_,ruleId:y,setting:e};L(i.UpdateSheetDataValidationSettingCommand.id,n,void 0)},ne=async()=>{await C.executeCommand(i.RemoveSheetDataValidationCommand.id,{ruleId:y,unitId:g,subUnitId:_}),h.setActiveRule(null),q()},re={type:O.type,operator:O.operator,formula1:O.formula1,formula2:O.formula2,allowBlank:O.allowBlank},ie=e=>{let t=b.getValidatorItem(e);if(!t)return;let n=t.operators,r=w.getRuleById(g,_,y),o=e===(r==null?void 0:r.type)||e.includes(`list`)&&r!=null&&r.type.includes(`list`)?{...r,type:e}:{...O,type:e,operator:n[0],formula1:void 0,formula2:void 0};k(o),C.executeCommand(i.UpdateSheetDataValidationSettingCommand.id,{unitId:g,subUnitId:_,ruleId:O.uid,setting:(0,a.getRuleSetting)(o)})},ae=S.get(j.formulaInput),Y=(0,d.useMemo)(()=>F.map(e=>(0,f.serializeRange)(e.range)).join(`,`),[]),oe=(0,a.getRuleOptions)(O),se=e=>{(0,t.shallowEqual)(e,(0,a.getRuleOptions)(O))||(k({...O,...e}),L(i.UpdateSheetDataValidationOptionsCommand.id,{unitId:g,subUnitId:_,ruleId:y,options:e}))},X=W.length&&!O.operator;return(0,m.jsxs)(`div`,{"data-u-comp":`data-validation-detail`,className:`univer-py-2`,children:[(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.panel.range`),error:!O.ranges.length||R?T.t(`dataValidation.panel.rangeError`):``,children:(0,m.jsx)(p.RangeSelector,{selectorRef:H,unitId:g,subUnitId:_,initialValue:Y,onChange:(e,t)=>{var n;!B&&(n=H.current)!=null&&n.verify()&&ee(t)},onFocusChange:(e,t)=>{var n;V(e),!e&&t&&(n=H.current)!=null&&n.verify()&&ee(t)},onVerify:e=>z(!e)})}),(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.panel.type`),children:(0,m.jsx)(u.Select,{className:`univer-w-full`,value:O.type,options:P==null||(e=P.sort((e,t)=>e.order-t.order))==null?void 0:e.map(e=>({label:T.t(e.title),value:e.id})),onChange:ie})}),W!=null&&W.length?(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.panel.operator`),children:(0,m.jsx)(u.Select,{className:`univer-w-full`,value:`${O.operator}`,options:[{value:``,label:T.t(`dataValidation.operators.legal`)},...W.map((e,t)=>({value:`${e}`,label:G[t]}))],onChange:e=>{te({...re,operator:e})}})}):null,ae&&!X?(0,m.jsx)(ae,{isTwoFormula:K,value:{formula1:O.formula1,formula2:O.formula2},onChange:e=>{te({...re,...e})},showError:M,validResult:j.validatorFormula(O,g,_),unitId:g,subUnitId:_,ruleId:y},c+O.type):null,(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Checkbox,{checked:(n=O.allowBlank)==null?!0:n,onChange:()=>{var e;return te({...re,allowBlank:!((e=O.allowBlank)==null||e)})},children:T.t(`dataValidation.panel.allowBlank`)})}),(0,m.jsx)(we,{value:oe,onChange:se,extraComponent:j.optionsInput}),(0,m.jsxs)(`div`,{className:`univer-mt-5 univer-flex univer-flex-row univer-justify-end`,children:[(0,m.jsx)(u.Button,{className:`univer-ml-3`,onClick:ne,children:T.t(`dataValidation.panel.removeRule`)}),(0,m.jsx)(u.Button,{className:`univer-ml-3`,variant:`primary`,onClick:J,children:T.t(`dataValidation.panel.done`)})]})]})}let Oe=e=>{let{rule:n,onClick:r,unitId:s,subUnitId:c,disable:p}=e,h=(0,o.useDependency)(a.DataValidatorRegistryService),g=(0,o.useDependency)(t.ICommandService),_=(0,o.useDependency)(l.IMarkSelectionService),v=h.getValidatorItem(n.type),y=(0,d.useRef)(void 0),[b,x]=(0,d.useState)(!1),S=(0,o.useDependency)(t.ThemeService),C=(0,d.useMemo)(()=>{var e;let n=S.getColorFromTheme(`primary.600`),r=S.getColorFromTheme(`loop-color.2`),i=(e=S.getColorFromTheme(r))==null?n:e,a=new t.ColorKit(i).toRgb();return{fill:`rgba(${a.r}, ${a.g}, ${a.b}, 0.1)`,stroke:i}},[(0,o.useObservable)(S.currentTheme$)]),w=e=>{g.executeCommand(i.RemoveSheetDataValidationCommand.id,{ruleId:n.uid,unitId:s,subUnitId:c}),e.stopPropagation()};return(0,d.useEffect)(()=>()=>{if(y.current){var e;(e=y.current)==null||e.forEach(e=>{e&&_.removeShape(e)})}},[_]),(0,m.jsxs)(`div`,{className:(0,u.clsx)(`
|
|
5
|
-
univer-bg-secondary univer-relative univer--mx-2 univer-box-border univer-flex univer-w-[287px]
|
|
6
|
-
univer-cursor-pointer univer-flex-col univer-justify-between univer-overflow-hidden univer-rounded-md
|
|
7
|
-
univer-p-2 univer-pr-9
|
|
8
|
-
`,{"hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-700":!p,"univer-opacity-50":p}),onClick:r,onMouseEnter:()=>{p||(x(!0),y.current=n.ranges.map(e=>_.addShape({range:e,style:C,primary:null})))},onMouseLeave:()=>{var e;x(!1),(e=y.current)==null||e.forEach(e=>{e&&_.removeShape(e)}),y.current=void 0},children:[(0,m.jsx)(`div`,{className:`
|
|
9
|
-
univer-truncate univer-text-sm univer-font-medium univer-leading-[22px] univer-text-gray-900
|
|
10
|
-
dark:!univer-text-white
|
|
11
|
-
`,children:v==null?void 0:v.generateRuleName(n)}),(0,m.jsx)(`div`,{className:`
|
|
12
|
-
univer-text-secondary univer-truncate univer-text-xs univer-leading-[18px]
|
|
13
|
-
dark:!univer-text-gray-300
|
|
14
|
-
`,children:n.ranges.map(e=>(0,f.serializeRange)(e)).join(`,`)}),b?(0,m.jsx)(`div`,{className:`
|
|
15
|
-
univer-absolute univer-right-2 univer-top-[19px] univer-flex univer-size-5 univer-items-center
|
|
16
|
-
univer-justify-center univer-rounded
|
|
17
|
-
hover:univer-bg-gray-200
|
|
18
|
-
dark:!univer-text-gray-300
|
|
19
|
-
dark:hover:!univer-bg-gray-700
|
|
20
|
-
`,onClick:w,children:(0,m.jsx)(he,{})}):null]})};function ke(e){let n=(0,o.useDependency)(i.SheetDataValidationModel),a=(0,o.useDependency)(t.IUniverInstanceService),s=(0,o.useDependency)(t.ICommandService),c=(0,o.useDependency)(t.Injector),l=(0,o.useDependency)(A),f=(0,o.useDependency)(t.LocaleService),[p,h]=(0,d.useState)([]),{workbook:g}=e,_=(0,o.useObservable)(g.activeSheet$,void 0,!0),v=g.getUnitId(),y=_==null?void 0:_.getSheetId();(0,d.useEffect)(()=>{h(n.getRules(v,y));let e=n.ruleChange$.subscribe(e=>{e.unitId===v&&e.subUnitId===y&&h(n.getRules(v,y))});return()=>{e.unsubscribe()}},[v,y,n]);let b=async()=>{let e=(0,i.createDefaultNewRule)(c),t={unitId:v,subUnitId:y,rule:e};await s.executeCommand(i.AddSheetDataValidationCommand.id,t),l.setActiveRule({unitId:v,subUnitId:y,rule:e})},x=()=>{s.executeCommand(i.RemoveSheetAllDataValidationCommand.id,{unitId:v,subUnitId:y})},S=(e=>{let n=a.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),i=n.getActiveSheet(),o=n.getUnitId(),s=i.getSheetId();return e.map(e=>(0,r.checkRangesEditablePermission)(c,o,s,e.ranges)?{...e}:{...e,disable:!0})})(p),C=S==null?void 0:S.some(e=>e.disable);return(0,m.jsxs)(`div`,{className:`univer-pb-4`,children:[S==null?void 0:S.map(e=>{var t;return(0,m.jsx)(Oe,{unitId:v,subUnitId:y,onClick:()=>{e.disable||l.setActiveRule({unitId:v,subUnitId:y,rule:e})},rule:e,disable:(t=e.disable)==null?!1:t},e.uid)}),(0,m.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[p.length&&!C?(0,m.jsx)(u.Button,{onClick:x,children:f.t(`dataValidation.panel.removeAll`)}):null,(0,m.jsx)(u.Button,{variant:`primary`,onClick:b,children:f.t(`dataValidation.panel.add`)})]})]})}let Ae=()=>{let e=(0,o.useDependency)(A),n=(0,o.useObservable)(e.activeRule$,e.activeRule),r=(0,o.useDependency)(t.IUniverInstanceService),i=(0,o.useObservable)(()=>r.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),a=(0,o.useObservable)(()=>{var e;return(e=i==null?void 0:i.activeSheet$)==null?(0,s.of)(null):e},void 0,void 0,[]);return!i||!a?null:n&&(n.subUnitId===a.getSheetId()||n.subUnitId===e.getFocusFormulaEditorActiveRuleSubUnitId())?(0,m.jsx)(De,{},n.rule.uid):(0,m.jsx)(ke,{workbook:i})},je=e=>{let{isTwoFormula:n=!1,value:r,onChange:i,showError:a,validResult:s}=e,c=(0,o.useDependency)(t.LocaleService),l=a?s==null?void 0:s.formula1:``,d=a?s==null?void 0:s.formula2:``;return n?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.FormLayout,{error:l,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:c.t(`dataValidation.panel.formulaPlaceholder`),value:r==null?void 0:r.formula1,onChange:e=>{i==null||i({...r,formula1:e})}})}),(0,m.jsx)(`div`,{className:`-univer-mt-2 univer-mb-1 univer-text-sm univer-text-gray-400`,children:c.t(`dataValidation.panel.formulaAnd`)}),(0,m.jsx)(u.FormLayout,{error:d,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:c.t(`dataValidation.panel.formulaPlaceholder`),value:r==null?void 0:r.formula2,onChange:e=>{i==null||i({...r,formula2:e})}})})]}):(0,m.jsx)(u.FormLayout,{error:l,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:c.t(`dataValidation.panel.formulaPlaceholder`),value:r==null?void 0:r.formula1,onChange:e=>{i==null||i({formula1:e})}})})};function Me(e){let{value:n,onChange:r,showError:i,validResult:a}=e,s=(0,o.useDependency)(t.LocaleService),c=i?a==null?void 0:a.formula1:``,l=i?a==null?void 0:a.formula2:``,[f,p]=(0,d.useState)(!((n==null?void 0:n.formula1)===void 0&&(n==null?void 0:n.formula2)===void 0));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Checkbox,{checked:f,onChange:e=>{e?p(!0):(p(!1),r==null||r({...n,formula1:void 0,formula2:void 0}))},children:s.t(`dataValidation.checkbox.tips`)})}),f?(0,m.jsx)(u.FormLayout,{label:s.t(`dataValidation.checkbox.checked`),error:c,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:s.t(`dataValidation.panel.valuePlaceholder`),value:n==null?void 0:n.formula1,onChange:e=>{r==null||r({...n,formula1:e||void 0})}})}):null,f?(0,m.jsx)(u.FormLayout,{label:s.t(`dataValidation.checkbox.unchecked`),error:l,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:s.t(`dataValidation.panel.valuePlaceholder`),value:n==null?void 0:n.formula2,onChange:e=>{r==null||r({...n,formula2:e||void 0})}})}):null]})}function Ne(e){var t;let{unitId:n,subUnitId:r,value:i,onChange:a,showError:s,validResult:c}=e,l=s?c==null?void 0:c.formula1:void 0,f=(0,d.useRef)(null),[h,g]=(0,d.useState)(!1);return(0,o.useSidebarClick)(e=>{var t;(t=f.current)!=null&&t.isClickOutSide(e)&&g(!1)}),(0,m.jsx)(u.FormLayout,{error:l,children:(0,m.jsx)(p.FormulaEditor,{ref:f,className:(0,u.clsx)(`
|
|
21
|
-
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg
|
|
22
|
-
univer-bg-white univer-pt-2 univer-transition-colors
|
|
23
|
-
hover:univer-border-primary-600
|
|
24
|
-
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
25
|
-
[&>div:first-child]:univer-px-2.5
|
|
26
|
-
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
27
|
-
`,u.borderClassName),initValue:(t=i==null?void 0:i.formula1)==null?`=`:t,unitId:n,subUnitId:r,isFocus:h,isSupportAcrossSheet:!0,onChange:e=>{let t=(e==null?``:e).trim();t!==(i==null?void 0:i.formula1)&&(a==null||a({...i,formula1:t}))},onFocus:()=>g(!0)})})}let Pe=[`#FFFFFF`,`#FEE7E7`,`#FEF0E6`,`#EFFBD0`,`#E4F4FE`,`#E8ECFD`,`#F1EAFA`,`#FDE8F3`,`#E5E5E5`,`#FDCECE`,`#FDC49B`,`#DEF6A2`,`#9FDAFF`,`#D0D9FB`,`#E3D5F6`,`#FBD0E8`,`#656565`,`#FE4B4B`,`#FF8C51`,`#8BBB11`,`#0B9EFB`,`#3A60F7`,`#9E6DE3`,`#F248A6`],Fe=e=>{let{value:t,onChange:n,disabled:r}=e,[i,a]=(0,d.useState)(!1);return(0,m.jsx)(u.Dropdown,{align:`start`,disabled:r,open:i,onOpenChange:a,overlay:(0,m.jsx)(`div`,{className:`
|
|
28
|
-
univer-box-border univer-grid univer-w-fit univer-grid-cols-6 univer-flex-wrap univer-gap-2
|
|
29
|
-
univer-p-1.5
|
|
30
|
-
`,children:Pe.map(e=>(0,m.jsx)(`div`,{className:(0,u.clsx)(`univer-box-border univer-size-4 univer-cursor-pointer univer-rounded`,u.borderClassName),style:{background:e},onClick:()=>{n(e),a(!1)}},e))}),children:(0,m.jsxs)(`div`,{className:(0,u.clsx)(`
|
|
31
|
-
univer-box-border univer-inline-flex univer-h-8 univer-w-16 univer-cursor-pointer univer-items-center
|
|
32
|
-
univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-white univer-px-2.5
|
|
33
|
-
univer-transition-colors univer-duration-200
|
|
34
|
-
hover:univer-border-primary-600
|
|
35
|
-
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
36
|
-
`,u.borderClassName),children:[(0,m.jsx)(`div`,{className:`univer-box-border univer-size-4 univer-rounded univer-text-base`,style:{background:t}}),(0,m.jsx)(ye,{})]})})},Ie=e=>{let{item:t,commonProps:n,className:r}=e,{onItemChange:i,onItemDelete:a}=n;return(0,m.jsxs)(`div`,{className:(0,u.clsx)(`univer-flex univer-items-center univer-gap-2`,r),children:[!t.isRef&&(0,m.jsx)(`div`,{className:(0,u.clsx)(`univer-cursor-move`,`draggableHandle`),children:(0,m.jsx)(Ce,{})}),(0,m.jsx)(Fe,{value:t.color,onChange:e=>{i(t.id,t.label,e)}}),(0,m.jsx)(u.Input,{disabled:t.isRef,value:t.label,onChange:e=>{i(t.id,e,t.color)}}),t.isRef?null:(0,m.jsx)(`div`,{className:`
|
|
37
|
-
univer-ml-1 univer-cursor-pointer univer-rounded univer-text-base
|
|
38
|
-
hover:univer-bg-gray-200
|
|
39
|
-
`,children:(0,m.jsx)(he,{onClick:()=>a(t.id)})})]})};function Le(e){let{value:n,onChange:r=()=>{},unitId:c,subUnitId:l,validResult:f,showError:h,ruleId:g}=e,{formula1:_=``,formula2:v=``}=n||{},[y,b]=(0,d.useState)(()=>(0,t.isFormulaString)(_)?`1`:`0`),[x,S]=(0,d.useState)(y===`1`?_:`=`),[C,w]=(0,d.useState)(y===`1`?_:`=`),T=(0,o.useDependency)(t.LocaleService),E=(0,o.useDependency)(a.DataValidatorRegistryService),D=(0,o.useDependency)(a.DataValidationModel),O=(0,o.useDependency)(i.DataValidationFormulaController),k=(0,o.useDependency)(A),[j,M]=(0,d.useState)(()=>v.split(`,`)),N=E.getValidatorItem(t.DataValidationType.LIST),[P,F]=(0,d.useState)([]),[I,L]=(0,d.useState)(``),R=h?f==null?void 0:f.formula1:``,z=(0,o.useObservable)((0,d.useMemo)(()=>D.ruleChange$.pipe((0,s.debounceTime)(16)),[])),B=(0,o.useEvent)(r);(0,d.useEffect)(()=>{(async()=>{await new Promise(e=>{setTimeout(()=>e(!0),100)});let e=D.getRuleById(c,l,g);(0,t.isFormulaString)(e==null?void 0:e.formula1)&&N&&e&&F(await N.getListAsync(e,c,l))})()},[D,z,N,g,l,c]),(0,d.useEffect)(()=>{(0,t.isFormulaString)(_)&&_!==C&&(S(_),w(C))},[C,_]);let[V,H]=(0,d.useState)(()=>{let e=y===`1`?[]:(0,i.deserializeListOptions)(_),n=v.split(`,`);return e.map((e,r)=>({label:e,color:n[r]||`#ECECEC`,isRef:!1,id:(0,t.generateRandomId)(4)}))}),U=(e,t,n)=>{let r=V.find(t=>t.id===e);r&&(r.label=t,r.color=n,H([...V]))},W=e=>{let t=V.findIndex(t=>t.id===e);t!==-1&&(V.splice(t,1),H([...V]))},G=v.split(`,`),K=(0,d.useMemo)(()=>P.map((e,t)=>({label:e,color:G[t]||`#ECECEC`,id:`${t}`,isRef:!0})),[G,P]),q=(e,t,n)=>{let r=[...j];r[+e]=n,M(r),B({formula1:_,formula2:r.join(`,`)})},J=()=>{H([...V,{label:``,color:`#ECECEC`,isRef:!1,id:(0,t.generateRandomId)(4)}])};(0,d.useEffect)(()=>{if(y===`1`)return;let e=new Set,t=[];V.map(e=>({labelList:e.label.split(`,`),item:e})).forEach(({item:n,labelList:r})=>{r.forEach(r=>{e.has(r)||(e.add(r),t.push({label:r,color:n.color}))})}),B({formula1:(0,i.serializeListOptions)(t.map(e=>e.label)),formula2:t.map(e=>e.color===`#ECECEC`?``:e.color).join(`,`)})},[V,B,y,C,j]);let ee=(0,o.useEvent)(async e=>{if(!(0,t.isFormulaString)(e)){B==null||B({formula1:``,formula2:v});return}O.getFormulaRefCheck(e)?(B==null||B({formula1:(0,t.isFormulaString)(e)?e:``,formula2:v}),L(``)):(B==null||B({formula1:``,formula2:v}),S(`=`),L(T.t(`dataValidation.validFail.formulaError`)))}),te=(0,d.useRef)(null),[ne,re]=(0,d.useState)(!1);return(0,o.useSidebarClick)(e=>{var t;(t=te.current)!=null&&t.isClickOutSide(e)&&re(!1)}),(0,d.useEffect)(()=>{ne?k.setFocusFormulaEditorActiveRuleSubUnitId(l):k.setFocusFormulaEditorActiveRuleSubUnitId(null)},[ne,l,k]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.list.options`),children:(0,m.jsxs)(u.RadioGroup,{value:y,onChange:e=>{b(e),S(C),e===`1`&&B({formula1:C===`=`?``:C,formula2:j.join(`,`)})},children:[(0,m.jsx)(u.Radio,{value:`0`,children:T.t(`dataValidation.list.customOptions`)}),(0,m.jsx)(u.Radio,{value:`1`,children:T.t(`dataValidation.list.refOptions`)})]})}),y===`1`?(0,m.jsxs)(u.FormLayout,{error:R||I||void 0,children:[(0,m.jsx)(p.FormulaEditor,{ref:te,className:(0,u.clsx)(`
|
|
40
|
-
univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center
|
|
41
|
-
univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors
|
|
42
|
-
hover:univer-border-primary-600
|
|
43
|
-
dark:!univer-bg-gray-700 dark:!univer-text-white
|
|
44
|
-
[&>div:first-child]:univer-px-2.5
|
|
45
|
-
[&>div]:univer-h-5 [&>div]:univer-ring-transparent
|
|
46
|
-
`,u.borderClassName),initValue:x,unitId:c,subUnitId:l,isFocus:ne,isSupportAcrossSheet:!0,onFocus:()=>re(!0),onChange:(e=``)=>{let t=(e==null?``:e).trim();w(t),ee(t)}}),K.length>0&&(0,m.jsx)(`div`,{className:`univer-mt-3`,children:K.map(e=>(0,m.jsx)(Ie,{className:`univer-mb-3`,item:e,commonProps:{onItemChange:q}},e.id))})]}):(0,m.jsx)(u.FormLayout,{error:R,children:(0,m.jsxs)(`div`,{className:`-univer-mt-3`,children:[(0,m.jsx)(u.DraggableList,{list:V,onListChange:H,rowHeight:28,margin:[0,12],draggableHandle:`.draggableHandle`,itemRender:e=>(0,m.jsx)(Ie,{item:e,commonProps:{onItemChange:U,onItemDelete:W}},e.id),idKey:`id`}),(0,m.jsxs)(`a`,{className:`
|
|
47
|
-
univer-text-primary univer-flex univer-w-fit univer-cursor-pointer univer-flex-row
|
|
48
|
-
univer-items-center univer-rounded univer-p-1 univer-px-2 univer-text-sm
|
|
49
|
-
hover:univer-bg-primary-50
|
|
50
|
-
dark:hover:!univer-bg-gray-800
|
|
51
|
-
`,onClick:J,children:[(0,m.jsx)(_e,{className:`univer-mr-1`}),T.t(`dataValidation.list.add`)]})]})})]})}let Re=[[i.CUSTOM_FORMULA_INPUT_NAME,Ne],[i.BASE_FORMULA_INPUT_NAME,je],[i.LIST_FORMULA_INPUT_NAME,Le],[i.CHECKBOX_FORMULA_INPUT_NAME,Me]];function ze(e){var n;let{value:r,onChange:i}=e,a=(0,o.useDependency)(t.LocaleService);return(0,m.jsx)(u.FormLayout,{label:a.t(`dataValidation.renderMode.label`),children:(0,m.jsxs)(u.RadioGroup,{value:`${(n=r.renderMode)==null?t.DataValidationRenderMode.CUSTOM:n}`,onChange:e=>i({...r,renderMode:+e}),children:[(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.CUSTOM}`,children:a.t(`dataValidation.renderMode.chip`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.ARROW}`,children:a.t(`dataValidation.renderMode.arrow`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.TEXT}`,children:a.t(`dataValidation.renderMode.text`)})]})})}ze.componentKey=`LIST_RENDER_MODE_OPTION_INPUT`;function Be(e){var n;let{value:r,onChange:i}=e,a=(0,o.useDependency)(t.LocaleService);return(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Checkbox,{checked:(n=r.bizInfo)==null?void 0:n.showTime,onChange:e=>{i({...r,bizInfo:{...r.bizInfo,showTime:e}})},children:a.t(`dataValidation.showTime.label`)})})}Be.componentKey=`DATE_SHOW_TIME_OPTION`;let Ve=class{_calc(e,n){var r,i,a;let{vt:o,ht:s}=n||{},c=e.endX-e.startX-12,l=e.endY-e.startY,u=((r=n==null?void 0:n.fs)==null?10:r)*1.6,d=0,f=0;switch(o){case t.VerticalAlign.TOP:f=0;break;case t.VerticalAlign.BOTTOM:f=0+(l-u);break;default:f=0+(l-u)/2;break}switch(s){case t.HorizontalAlign.LEFT:d=6;break;case t.HorizontalAlign.RIGHT:d=6+(c-u);break;default:d=6+(c-u)/2;break}return{left:e.startX+d,top:e.startY+f,width:((i=n==null?void 0:n.fs)==null?10:i)*1.6,height:((a=n==null?void 0:n.fs)==null?10:a)*1.6}}constructor(e,t,n,r,i,a){this._commandService=e,this._univerInstanceService=t,this._formulaService=n,this._themeService=r,this._renderManagerService=i,this._dataValidationModel=a}calcCellAutoHeight(e){var t;let{style:n}=e;return((t=n==null?void 0:n.fs)==null?10:t)*1.6}calcCellAutoWidth(e){var t;let{style:n}=e;return((t=n==null?void 0:n.fs)==null?10:t)*1.6}async _parseFormula(e,n,r){var a,o,s;let{formula1:c=i.CHECKBOX_FORMULA_1,formula2:l=i.CHECKBOX_FORMULA_2}=e,u=await this._formulaService.getRuleFormulaResult(n,r,e.uid),d=(0,i.getFormulaResult)(u==null||(a=u[0])==null||(a=a.result)==null||(a=a[0])==null?void 0:a[0]),f=(0,i.getFormulaResult)(u==null||(o=u[1])==null||(o=o.result)==null||(o=o[0])==null?void 0:o[0]),p=(0,i.isLegalFormulaResult)(String(d))&&(0,i.isLegalFormulaResult)(String(f));return{formula1:(0,t.isFormulaString)(c)?(0,i.getFormulaResult)(u==null||(s=u[0])==null||(s=s.result)==null||(s=s[0])==null?void 0:s[0]):c,formula2:(0,t.isFormulaString)(l)?f:l,isFormulaValid:p}}drawWith(e,t){var r,a,o,s;let{style:c,primaryWithCoord:l,unitId:u,subUnitId:d,worksheet:f,row:p,col:m}=t,h=l.isMergedMainCell?l.mergeInfo:l,g=(0,i.getCellValueOrigin)(f.getCellRaw(p,m)),_=this._dataValidationModel.getRuleByLocation(u,d,p,m);if(!_)return;let v=this._dataValidationModel.getValidator(_.type);if(!v||!((r=v.skipDefaultFontRender)!=null&&r.call(v,_,g,{unitId:u,subUnitId:d,row:p,column:m})))return;let{formula1:y}=v.parseFormulaSync(_,u,d),b=this._calc(h,c),{a:x,d:S}=e.getTransform(),C=(0,n.fixLineWidthByScale)(b.left,x),w=(0,n.fixLineWidthByScale)(b.top,S),T=n.Transform.create().composeMatrix({left:C,top:w,scaleX:1,scaleY:1,angle:0,skewX:0,skewY:0,flipX:!1,flipY:!1}),E=h.endX-h.startX,D=h.endY-h.startY;e.save(),e.beginPath(),e.rect(h.startX,h.startY,E,D),e.clip();let O=T.getMatrix();e.transform(O[0],O[1],O[2],O[3],O[4],O[5]);let k=((a=c==null?void 0:c.fs)==null?10:a)*1.6,A=String(g)===String(y),j=this._themeService.getColorFromTheme(`primary.600`);n.CheckboxShape.drawWith(e,{checked:A,width:k,height:k,fill:(o=c==null||(s=c.cl)==null?void 0:s.rgb)==null?j:o}),e.restore()}isHit(e,t){let n=t.primaryWithCoord.isMergedMainCell?t.primaryWithCoord.mergeInfo:t.primaryWithCoord,r=this._calc(n,t.style),i=r.top,a=r.top+r.height,o=r.left,s=r.left+r.width,{x:c,y:l}=e;return c<=s&&c>=o&&l<=a&&l>=i}async onPointerDown(e,t){var n;if(t.button===2)return;let{primaryWithCoord:a,unitId:o,subUnitId:s,worksheet:c,row:l,col:u}=e,d=(0,i.getCellValueOrigin)(c.getCellRaw(l,u)),f=this._dataValidationModel.getRuleByLocation(o,s,l,u);if(!f)return;let p=this._dataValidationModel.getValidator(f.type);if(!p||!((n=p.skipDefaultFontRender)!=null&&n.call(p,f,d,{unitId:o,subUnitId:s,row:l,column:u})))return;let{formula1:m,formula2:h}=await this._parseFormula(f,o,s),g={range:{startColumn:a.actualColumn,endColumn:a.actualColumn,startRow:a.actualRow,endRow:a.actualRow},value:{v:String(d)===(0,i.transformCheckboxValue)(String(m))?h:m,p:null}};this._commandService.executeCommand(r.SetRangeValuesCommand.id,g)}onPointerEnter(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.POINTER)}onPointerLeave(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.DEFAULT)}};Ve=k([O(0,t.ICommandService),O(1,t.IUniverInstanceService),O(2,(0,t.Inject)(i.DataValidationFormulaService)),O(3,(0,t.Inject)(t.ThemeService)),O(4,(0,t.Inject)(n.IRenderManagerService)),O(5,(0,t.Inject)(i.SheetDataValidationModel))],Ve);let Z=class{constructor(e){this.injector=e,D(this,`canvasRender`,null),D(this,`dropdownType`,void 0),D(this,`optionsInput`,void 0),D(this,`formulaInput`,i.LIST_FORMULA_INPUT_NAME)}};Z=k([O(0,(0,t.Inject)(t.Injector))],Z);var He=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.CHECKBOX),D(this,`canvasRender`,this.injector.createInstance(Ve)),D(this,`formulaInput`,i.CHECKBOX_FORMULA_INPUT_NAME)}},Ue=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.CUSTOM),D(this,`formulaInput`,i.CUSTOM_FORMULA_INPUT_NAME)}},We=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.DATE),D(this,`formulaInput`,`data-validation.formula-input`),D(this,`optionsInput`,Be.componentKey),D(this,`dropdownType`,a.DataValidatorDropdownType.DATE)}},Ge=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.DECIMAL),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}};function Ke(e,t){let r=n.FontCache.getTextSize(e,t),i=r.width+8,{ba:a,bd:o}=r;return{width:i,height:a+o+0,ba:a}}function qe(e,t,n,r){let i=n-26,a=r-12,o=e.map(e=>({layout:Ke(e,t),text:e})),s,c=[];o.forEach(e=>{let{layout:t}=e,{width:n,height:r}=t;!s||s.width+n+4>i?(s={width:n,height:r,items:[{...e,left:0}]},c.push(s)):(s.items.push({...e,left:s.width+4}),s.width=s.width+n+4)});let l=0,u=0;return c.forEach((e,t)=>{u=Math.max(u,e.width),t===c.length-1?l+=e.height:l+=e.height+4}),{lines:c,totalHeight:l,contentWidth:i,contentHeight:a,cellAutoHeight:l+12,calcAutoWidth:u+26}}var Je=class extends n.Shape{static drawWith(e,t){let{fontString:r,info:i,fill:a,color:o}=t,{layout:s,text:c}=i;e.save(),n.Rect.drawWith(e,{width:s.width,height:s.height,radius:8,fill:a||`#ECECEC`}),e.translateWithPrecision(4,s.ba),e.font=r,e.fillStyle=o,e.fillText(c,0,0),e.restore()}};let Ye=new Path2D(`M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z`),Xe=class{constructor(e,t,n,r){this._commandService=e,this._univerInstanceService=t,this._renderManagerService=n,this._dataValidationModel=r,D(this,`zIndex`,void 0),D(this,`_dropdownInfoMap`,new Map)}_ensureMap(e){let t=this._dropdownInfoMap.get(e);return t||(t=new Map,this._dropdownInfoMap.set(e,t)),t}_generateKey(e,t){return`${e}.${t}`}_drawDownIcon(e,n,r,i,a){let o=r-14+4,s=4;switch(a){case t.VerticalAlign.MIDDLE:s=(i-14)/2+4;break;case t.VerticalAlign.BOTTOM:s=i-14+4;break;default:break}e.save(),e.translateWithPrecision(n.startX+o,n.startY+s),e.fillStyle=`#565656`,e.fill(Ye),e.restore()}drawWith(e,r,a,o){var s,c;let{primaryWithCoord:l,row:u,col:d,style:f,data:p,subUnitId:m}=r,h=l.isMergedMainCell?l.mergeInfo:l,{leftOffset:g=0,rightOffset:_=0,topOffset:v=0,downOffset:y=0}=(p==null?void 0:p.fontRenderExtension)||{},b=this._ensureMap(m),x=this._generateKey(u,d),S=l.isMergedMainCell?l.mergeInfo.startRow:u,C=l.isMergedMainCell?l.mergeInfo.startColumn:d,w=this._dataValidationModel.getRuleByLocation(r.unitId,r.subUnitId,S,C);if(!w)return;let T=this._dataValidationModel.getValidator(w.type);if(!T)return;let E={startX:h.startX+g,endX:h.endX-_,startY:h.startY+v,endY:h.endY-y},D=E.endX-E.startX,O=E.endY-E.startY,{cl:k}=f||{},A=(s=typeof k==`object`?k==null?void 0:k.rgb:k)==null?`#000`:s,j=(0,n.getFontStyleString)(f==null?void 0:f),{vt:M,ht:N}=f||{},P=M==null?t.VerticalAlign.MIDDLE:M,F=(c=(0,i.getCellValueOrigin)(p))==null?``:c,I=T.parseCellValue(F),L=T.getListWithColorMap(w),R=qe(I,j,D,O);this._drawDownIcon(e,E,D,O,P),e.save(),e.translateWithPrecision(E.startX,E.startY),e.beginPath(),e.rect(0,0,D-14,O),e.clip(),e.translateWithPrecision(6,6);let z=0;switch(P){case t.VerticalAlign.MIDDLE:z=(R.contentHeight-R.totalHeight)/2;break;case t.VerticalAlign.BOTTOM:z=R.contentHeight-R.totalHeight;break;default:break}e.translateWithPrecision(0,z),R.lines.forEach((n,r)=>{e.save();let{width:i,height:a,items:o}=n,s=0;switch(N){case t.HorizontalAlign.RIGHT:s=R.contentWidth-i;break;case t.HorizontalAlign.CENTER:s=(R.contentWidth-i)/2;break;default:break}e.translate(s,r*(a+4)),o.forEach(t=>{e.save(),e.translateWithPrecision(t.left,0),Je.drawWith(e,{...j,info:t,color:A,fill:L[t.text]}),e.restore()}),e.restore()}),e.restore(),b.set(x,{left:E.startX,top:E.startY,width:R.contentWidth+6+14,height:R.contentHeight+12})}calcCellAutoHeight(e){var t;let{primaryWithCoord:r,style:a,data:o,row:s,col:c}=e,{leftOffset:l=0,rightOffset:u=0,topOffset:d=0,downOffset:f=0}=(o==null?void 0:o.fontRenderExtension)||{},p=r.isMergedMainCell?r.mergeInfo:r,m={startX:p.startX+l,endX:p.endX-u,startY:p.startY+d,endY:p.endY-f},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,s,c);if(!h)return;let g=this._dataValidationModel.getValidator(h.type);if(!g)return;let _=m.endX-m.startX,v=m.endY-m.startY,y=(t=(0,i.getCellValueOrigin)(o))==null?``:t;return qe(g.parseCellValue(y),(0,n.getFontStyleString)(a==null?void 0:a),_,v).cellAutoHeight}calcCellAutoWidth(e){var t;let{primaryWithCoord:r,style:a,data:o,row:s,col:c}=e,{leftOffset:l=0,rightOffset:u=0,topOffset:d=0,downOffset:f=0}=(o==null?void 0:o.fontRenderExtension)||{},p=r.isMergedMainCell?r.mergeInfo:r,m={startX:p.startX+l,endX:p.endX-u,startY:p.startY+d,endY:p.endY-f},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,s,c);if(!h)return;let g=this._dataValidationModel.getValidator(h.type);if(!g)return;let _=m.endX-m.startX,v=m.endY-m.startY,y=(t=(0,i.getCellValueOrigin)(o))==null?``:t;return qe(g.parseCellValue(y),(0,n.getFontStyleString)(a==null?void 0:a),_,v).calcAutoWidth}isHit(e,t){let{primaryWithCoord:n}=t,{endX:r}=n.isMergedMainCell?n.mergeInfo:n,{x:i}=e;return i>=r-14&&i<=r}onPointerDown(e,t){if(t.button===2)return;let{unitId:n,subUnitId:r,row:i,col:a}=e,o={unitId:n,subUnitId:r,row:i,column:a};this._commandService.executeCommand(V.id,o)}onPointerEnter(e,r){var i;return(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null?void 0:i.setCursor(n.CURSOR_TYPE.POINTER)}onPointerLeave(e,r){var i;return(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null?void 0:i.setCursor(n.CURSOR_TYPE.DEFAULT)}};Xe=k([O(0,t.ICommandService),O(1,t.IUniverInstanceService),O(2,(0,t.Inject)(n.IRenderManagerService)),O(3,(0,t.Inject)(i.SheetDataValidationModel))],Xe);var Ze=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.LIST_MULTIPLE),D(this,`canvasRender`,this.injector.createInstance(Xe)),D(this,`dropdownType`,a.DataValidatorDropdownType.MULTIPLE_LIST)}};let Qe=new Path2D(`M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z`);function $e(e,n,r,i,a,o,s=!0){let c=0,l=s?3:0;switch(a){case t.VerticalAlign.BOTTOM:c=n-i-l;break;case t.VerticalAlign.MIDDLE:c=(n-i)/2;break;default:c=l;break}c=Math.max(3,c);let u=0;switch(o){case t.HorizontalAlign.CENTER:u=(e-r)/2;break;case t.HorizontalAlign.RIGHT:u=e-r;break;default:break}return u=Math.max(6,u),{paddingLeft:u,paddingTop:c}}let et=class{constructor(e,t,n,r,i){this._univerInstanceService=e,this._localeService=t,this._commandService=n,this._renderManagerService=r,this._dataValidationModel=i,D(this,`_dropdownInfoMap`,new Map),D(this,`zIndex`,void 0)}_ensureMap(e){let t=this._dropdownInfoMap.get(e);return t||(t=new Map,this._dropdownInfoMap.set(e,t)),t}_generateKey(e,t){return`${e}.${t}`}_drawDownIcon(e,n,r,i,a,o,s){let{t:c=t.DEFAULT_STYLES.pd.t,b:l=t.DEFAULT_STYLES.pd.b}=s,u=r-14,d;switch(o){case t.VerticalAlign.MIDDLE:d=(i-4)/2;break;case t.VerticalAlign.BOTTOM:d=i-l-a-3+(a/2-4/2);break;default:d=c+3+(a/2-4/2);break}e.save(),e.translateWithPrecision(n.startX+u,n.startY+d),e.fillStyle=`#565656`,e.fill(Qe),e.restore()}drawWith(e,r,a){var o,s,c,l;let{primaryWithCoord:u,row:d,col:f,style:p,data:m,subUnitId:h}=r,g=u.isMergedMainCell?u.mergeInfo:u,_=u.isMergedMainCell?u.mergeInfo.startRow:d,v=u.isMergedMainCell?u.mergeInfo.startColumn:f,y=this._dataValidationModel.getRuleByLocation(r.unitId,r.subUnitId,_,v);if(!y)return;let b=this._dataValidationModel.getValidator(y.type);if(!b)return;let{leftOffset:x=0,rightOffset:S=0,topOffset:C=0,downOffset:w=0}=(m==null?void 0:m.fontRenderExtension)||{};if(!y||!b||!b||b.id.indexOf(t.DataValidationType.LIST)!==0||!b.skipDefaultFontRender(y))return;let T={startX:g.startX+x,endX:g.endX-S,startY:g.startY+C,endY:g.endY-w},E=T.endX-T.startX,D=T.endY-T.startY,O=this._ensureMap(h),k=this._generateKey(d,f),A=b.getListWithColorMap(y),j=(0,i.getCellValueOrigin)(m),M=`${j==null?``:j}`,N=A[M],{tb:P,vt:F,ht:I,pd:L}=p||{};P=(o=P)==null?t.WrapStrategy.WRAP:o,F=(s=F)==null?t.VerticalAlign.BOTTOM:s,I=(c=I)==null?t.DEFAULT_STYLES.ht:c,L=(l=L)==null?t.DEFAULT_STYLES.pd:l;let R=(0,n.getFontStyleString)(p).fontCache;if(y.renderMode===t.DataValidationRenderMode.ARROW){var z,B,V;let{l:r=t.DEFAULT_STYLES.pd.l,t:i=t.DEFAULT_STYLES.pd.t,r:o=t.DEFAULT_STYLES.pd.r,b:s=t.DEFAULT_STYLES.pd.b}=L,c=E-r-o-14-4,l=new n.DocSimpleSkeleton(M,R,P===t.WrapStrategy.WRAP,c,1/0);l.calculate();let u=l.getTotalWidth(),d=l.getTotalHeight(),{paddingTop:f,paddingLeft:m}=$e(c,D-i-s,u,d,F,I,!0);this._drawDownIcon(e,T,E,D,d,F,L),e.save(),e.translateWithPrecision(T.startX+r,T.startY+i),e.beginPath(),e.rect(0,0,E-r-o,D-i-s),e.clip(),e.translateWithPrecision(0,f),e.save(),e.translateWithPrecision(m,0),e.beginPath(),e.rect(0,0,c,d),e.clip(),n.Text.drawWith(e,{text:M,fontStyle:R,width:c,height:d,color:p==null||(z=p.cl)==null?void 0:z.rgb,strokeLine:!!(!(p==null||(B=p.st)==null)&&B.s),underline:!!(!(p==null||(V=p.ul)==null)&&V.s),warp:P===t.WrapStrategy.WRAP,hAlign:t.HorizontalAlign.LEFT},l),e.restore(),e.restore(),O.set(k,{left:T.endX-14+a.rowHeaderWidth,top:T.startY+i+a.columnHeaderHeight,width:14,height:D-i-s})}else{var H,U,W;e.save(),e.translateWithPrecision(T.startX,T.startY),e.beginPath(),e.rect(0,0,E,D),e.clip();let r=E-12-4-14-4,i=new n.DocSimpleSkeleton(M,R,P===t.WrapStrategy.WRAP,r,1/0);i.calculate();let o=i.getTotalWidth(),s=i.getTotalHeight(),c=s+2,l=Math.max(E-12,1),{paddingTop:u}=$e(l,D,o,c,F,I);e.translateWithPrecision(6,u),n.Rect.drawWith(e,{width:l,height:c,fill:N||`#ECECEC`,radius:8}),e.save(),e.translateWithPrecision(4,1),e.beginPath(),e.rect(0,0,r,s),e.clip(),n.Text.drawWith(e,{text:M,fontStyle:R,width:r,height:s,color:p==null||(H=p.cl)==null?void 0:H.rgb,strokeLine:!!(!(p==null||(U=p.st)==null)&&U.s),underline:!!(!(p==null||(W=p.ul)==null)&&W.s),warp:P===t.WrapStrategy.WRAP,hAlign:t.HorizontalAlign.LEFT},i),e.restore(),e.translateWithPrecision(r+4+4,(s-4)/2),e.fillStyle=`#565656`,e.fill(Qe),e.restore(),O.set(k,{left:T.startX+6+a.rowHeaderWidth,top:T.startY+u+a.columnHeaderHeight,width:l,height:c})}}calcCellAutoHeight(e){var r;let{primaryWithCoord:a,style:o,data:s,row:c,col:l}=e,u=a.isMergedMainCell?a.mergeInfo:a,{leftOffset:d=0,rightOffset:f=0,topOffset:p=0,downOffset:m=0}=(s==null?void 0:s.fontRenderExtension)||{},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,c,l);if(!h||h.renderMode===t.DataValidationRenderMode.TEXT)return;let g={startX:u.startX+d,endX:u.endX-f,startY:u.startY+p,endY:u.endY-m},_=g.endX-g.startX,v=(0,i.getCellValueOrigin)(s),y=`${v==null?``:v}`,{tb:b,pd:x}=o||{},{t:S=t.DEFAULT_STYLES.pd.t,b:C=t.DEFAULT_STYLES.pd.b}=x==null?{}:x;if(b=(r=b)==null?t.WrapStrategy.WRAP:r,h.renderMode===t.DataValidationRenderMode.ARROW){let{l:e=t.DEFAULT_STYLES.pd.l,r=t.DEFAULT_STYLES.pd.r}=x==null?{}:x,i=_-e-r-14-4,a=new n.DocSimpleSkeleton(y,(0,n.getFontStyleString)(o).fontCache,b===t.WrapStrategy.WRAP,i,1/0);return a.calculate(),a.getTotalHeight()+S+C+6}else{let e=Math.max(_-12-4-14-4,10),r=new n.DocSimpleSkeleton(y,(0,n.getFontStyleString)(o).fontCache,b===t.WrapStrategy.WRAP,e,1/0);return r.calculate(),r.getTotalHeight()+6+2}}calcCellAutoWidth(e){var r;let{primaryWithCoord:a,style:o,data:s,row:c,col:l}=e,u=a.isMergedMainCell?a.mergeInfo:a,{leftOffset:d=0,rightOffset:f=0,topOffset:p=0,downOffset:m=0}=(s==null?void 0:s.fontRenderExtension)||{},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,c,l);if(!h||h.renderMode===t.DataValidationRenderMode.TEXT)return;let g={startX:u.startX+d,endX:u.endX-f,startY:u.startY+p,endY:u.endY-m},_=g.endX-g.startX,v=(0,i.getCellValueOrigin)(s),y=`${v==null?``:v}`,{tb:b,pd:x}=o||{},{l:S=t.DEFAULT_STYLES.pd.l,r:C=t.DEFAULT_STYLES.pd.r}=x==null?{}:x;b=(r=b)==null?t.WrapStrategy.WRAP:r;let w=26;switch(h.renderMode){case t.DataValidationRenderMode.ARROW:w=18+C+S;break;case t.DataValidationRenderMode.CUSTOM:w=34+C+S+8/2+1;break;default:w=34+C+S+8/2+1}let T=_-w,E=new n.DocSimpleSkeleton(y,(0,n.getFontStyleString)(o).fontCache,b===t.WrapStrategy.WRAP,T,1/0);return E.calculate(),E.getTotalWidth()+w}isHit(e,n){let{subUnitId:r,row:i,col:a}=n,o=this._ensureMap(r).get(this._generateKey(i,a)),s=this._dataValidationModel.getRuleByLocation(n.unitId,n.subUnitId,i,a);if(!s||!o||s.renderMode===t.DataValidationRenderMode.TEXT)return!1;let{top:c,left:l,width:u,height:d}=o,{x:f,y:p}=e;return f>=l&&f<=l+u&&p>=c&&p<=c+d}onPointerDown(e,t){if(t.button===2)return;let{unitId:n,subUnitId:r,row:i,col:a}=e,o={unitId:n,subUnitId:r,row:i,column:a};this._commandService.executeCommand(V.id,o)}onPointerEnter(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.POINTER)}onPointerLeave(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.DEFAULT)}};et=k([O(0,t.IUniverInstanceService),O(1,(0,t.Inject)(t.LocaleService)),O(2,t.ICommandService),O(3,(0,t.Inject)(n.IRenderManagerService)),O(4,(0,t.Inject)(i.SheetDataValidationModel))],et);var tt=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.LIST),D(this,`canvasRender`,this.injector.createInstance(et)),D(this,`dropdownType`,a.DataValidatorDropdownType.LIST),D(this,`optionsInput`,ze.componentKey),D(this,`formulaInput`,i.LIST_FORMULA_INPUT_NAME)}},nt=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.TEXT_LENGTH),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}},rt=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.WHOLE),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}};let it=class extends t.RxDisposable{constructor(e,t,n){super(),this._injector=e,this._componentManger=t,this._dataValidatorRegistryService=n,this._initComponents(),this._registerValidatorViews()}_initComponents(){[[`DataValidationIcon`,pe],[L,Ae],[ze.componentKey,ze],[Be.componentKey,Be],...Re].forEach(([e,t])=>{this.disposeWithMe(this._componentManger.register(e,t))})}_registerValidatorViews(){[Ge,rt,nt,We,He,tt,Ze,Ue].forEach(e=>{let t=this._injector.createInstance(e),n=this._dataValidatorRegistryService.getValidatorItem(t.id);n&&(n.formulaInput=t.formulaInput,n.canvasRender=t.canvasRender,n.dropdownType=t.dropdownType,n.optionsInput=t.optionsInput)})}};it=k([O(0,(0,t.Inject)(t.Injector)),O(1,(0,t.Inject)(o.ComponentManager)),O(2,(0,t.Inject)(a.DataValidatorRegistryService))],it);let Q=class extends t.Plugin{constructor(e=M,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},M,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(j,o)}onStarting(){[[A],[I],[G],[K],[Y],[J],[q],[it]].forEach(e=>{this._injector.add(e)}),[U,V,H,z,R,B].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(q),this._injector.get(J),this._injector.get(n.IRenderManagerService).registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[se])}onRendered(){this._injector.get(it),this._injector.get(Y)}onSteady(){this._injector.get(K)}};D(Q,`pluginName`,`SHEET_DATA_VALIDATION_UI_PLUGIN`),D(Q,`packageName`,S),D(Q,`version`,C),D(Q,`type`,t.UniverInstanceType.UNIVER_SHEET),Q=k([O(1,(0,t.Inject)(t.Injector)),O(2,t.ICommandService),O(3,t.IConfigService)],Q);let $=class extends t.Plugin{constructor(e=M,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},M,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(j,o)}onStarting(){[[A],[I],[G],[K],[Y],[J],[q],[N],[it]].forEach(e=>{this._injector.add(e)}),[U,V,H,z,R,B].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(q),this._injector.get(J),this._injector.get(N),this._injector.get(G),this._injector.get(n.IRenderManagerService).registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[se])}onRendered(){this._injector.get(it),this._injector.get(Y)}onSteady(){this._injector.get(K)}};D($,`pluginName`,`SHEET_DATA_VALIDATION_UI_PLUGIN`),D($,`packageName`,S),D($,`version`,C),D($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=k([(0,t.DependentOn)(i.UniverSheetsDataValidationPlugin),O(1,(0,t.Inject)(t.Injector)),O(2,t.ICommandService),O(3,t.IConfigService)],$),Object.defineProperty(e,`BaseSheetDataValidatorView`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,`UniverSheetsDataValidationMobileUIPlugin`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,`UniverSheetsDataValidationUIPlugin`,{enumerable:!0,get:function(){return $}})});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/engine-render`),require(`@univerjs/sheets`),require(`@univerjs/sheets-data-validation`),require(`@univerjs/data-validation`),require(`@univerjs/ui`),require(`rxjs`),require(`@univerjs/sheets-numfmt`),require(`@univerjs/sheets-ui`),require(`@univerjs/design`),require(`react`),require(`@univerjs/engine-formula`),require(`@univerjs/sheets-formula-ui`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/engine-render`,`@univerjs/sheets`,`@univerjs/sheets-data-validation`,`@univerjs/data-validation`,`@univerjs/ui`,`rxjs`,`@univerjs/sheets-numfmt`,`@univerjs/sheets-ui`,`@univerjs/design`,`react`,`@univerjs/engine-formula`,`@univerjs/sheets-formula-ui`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsDataValidationUi={},e.UniverCore,e.UniverEngineRender,e.UniverSheets,e.UniverSheetsDataValidation,e.UniverDataValidation,e.UniverUi,e.rxjs,e.UniverSheetsNumfmt,e.UniverSheetsUi,e.UniverDesign,e.React,e.UniverEngineFormula,e.UniverSheetsFormulaUi,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var h=Object.create,g=Object.defineProperty,_=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,y=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,x=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=v(t),a=0,o=i.length,s;a<o;a++)s=i[a],!b.call(e,s)&&s!==n&&g(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=_(t,s))||r.enumerable});return e};d=((e,t,n)=>(n=e==null?{}:h(y(e)),x(t||!e||!e.__esModule?g(n,`default`,{value:e,enumerable:!0}):n,e)))(d);var S=`@univerjs/sheets-data-validation-ui`,C=`0.19.0`;function w(e){"@babel/helpers - typeof";return w=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},w(e)}function T(e,t){if(w(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(w(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function E(e){var t=T(e,`string`);return w(t)==`symbol`?t:t+``}function D(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e,t){return function(n,r){t(n,r,e)}}function k(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 A=class extends t.Disposable{get activeRule(){return this._activeRule}get isOpen(){return this._open$.getValue()}constructor(e,n){super(),this._univerInstanceService=e,this._sidebarService=n,D(this,`_open$`,new s.BehaviorSubject(!1)),D(this,`open$`,this._open$.pipe((0,s.distinctUntilChanged)())),D(this,`_activeRule`,void 0),D(this,`_activeRule$`,new s.BehaviorSubject(void 0)),D(this,`activeRule$`,this._activeRule$.asObservable()),D(this,`_closeDisposable`,null),D(this,`_focusFormulaEditorActiveRuleSubUnitId`,null),this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET).pipe((0,s.filter)(e=>!e)).subscribe(()=>{this.close()})),this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe(e=>{e.id===`DataValidationPanel`&&(e.visible||setTimeout(()=>{this._sidebarService.sidebarOptions$.next({visible:!1})}))}))}dispose(){var e;super.dispose(),this._open$.next(!1),this._open$.complete(),this._activeRule$.complete(),(e=this._closeDisposable)==null||e.dispose()}open(){this._open$.next(!0)}close(){var e;this._open$.next(!1),(e=this._closeDisposable)==null||e.dispose()}setCloseDisposable(e){this._closeDisposable=(0,t.toDisposable)(()=>{e.dispose(),this._closeDisposable=null})}setActiveRule(e){this._activeRule=e,this._activeRule$.next(e)}setFocusFormulaEditorActiveRuleSubUnitId(e){this._focusFormulaEditorActiveRuleSubUnitId=e}getFocusFormulaEditorActiveRuleSubUnitId(){return this._focusFormulaEditorActiveRuleSubUnitId}};A=k([O(0,t.IUniverInstanceService),O(1,o.ISidebarService)],A);let j=`sheets-data-validation-ui.config`;Symbol(j);let M={},N=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._sheetInterceptorService=e,this._dataValidationModel=t,this._dataValidatorRegistryService=n,this._dialogService=r,this._localeService=i,this._sheetsDataValidationValidatorService=a,this._initEditorBridgeInterceptor()}_initEditorBridgeInterceptor(){this.disposeWithMe(this._sheetInterceptorService.writeCellInterceptor.intercept(r.VALIDATE_CELL,{handler:async(e,n,r)=>{let i=await e,{row:a,col:o,unitId:s,subUnitId:c}=n,l=this._dataValidationModel.getRuleIdByLocation(s,c,a,o),f=l?this._dataValidationModel.getRuleById(s,c,l):void 0;if(i===!1)return r(Promise.resolve(!1));if(!f||f.errorStyle!==t.DataValidationErrorStyle.STOP)return r(Promise.resolve(!0));let p=this._dataValidatorRegistryService.getValidatorItem(f.type);return!p||await this._sheetsDataValidationValidatorService.validatorCell(s,c,a,o)===t.DataValidationStatus.VALID?r(Promise.resolve(!0)):(this._dialogService.open({width:368,title:{title:this._localeService.t(`dataValidation.alert.title`)},id:`reject-input-dialog`,children:{title:p.getRuleFinalError(f,{row:a,col:o,unitId:s,subUnitId:c})},footer:{title:(0,d.createElement)(u.Button,{variant:`primary`,onClick:()=>this._dialogService.close(`reject-input-dialog`)},this._localeService.t(`dataValidation.alert.ok`))},onClose:()=>{this._dialogService.close(`reject-input-dialog`)}}),r(Promise.resolve(!1)))}}))}showReject(e){this._dialogService.open({width:368,title:{title:this._localeService.t(`dataValidation.alert.title`)},id:`reject-input-dialog`,children:{title:e},footer:{title:(0,d.createElement)(u.Button,{variant:`primary`,onClick:()=>this._dialogService.close(`reject-input-dialog`)},this._localeService.t(`dataValidation.alert.ok`))},onClose:()=>{this._dialogService.close(`reject-input-dialog`)}})}};N=k([O(0,(0,t.Inject)(r.SheetInterceptorService)),O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(a.DataValidatorRegistryService)),O(3,o.IDialogService),O(4,(0,t.Inject)(t.LocaleService)),O(5,(0,t.Inject)(i.SheetsDataValidationValidatorService))],N);let P=e=>{if(e==null||typeof e==`boolean`)return;if(e===``)return(0,t.dayjs)();if(typeof e==`number`||!Number.isNaN(+e))return(0,t.dayjs)(t.numfmt.format(`yyyy-MM-dd HH:mm:ss`,Number(e)));let n=(0,t.dayjs)(e);if(n.isValid())return n};function F(e,t){if(e===(0,c.getPatternType)(t))return t;switch(e){case`datetime`:return`yyyy-MM-dd hh:mm:ss`;case`date`:return`yyyy-MM-dd`;case`time`:return`HH:mm:ss`}}let I=class extends t.Disposable{get activeDropdown(){return this._activeDropdown}constructor(e,t,n,r,i,a,o,c,l,u,d){super(),this._univerInstanceService=e,this._dataValidatorRegistryService=t,this._zenZoneService=n,this._dataValidationModel=r,this._sheetsSelectionsService=i,this._cellDropdownManagerService=a,this._sheetDataValidationModel=o,this._commandService=c,this._editorBridgeService=l,this._injector=u,this._configService=d,D(this,`_activeDropdown`,void 0),D(this,`_activeDropdown$`,new s.Subject),D(this,`_currentPopup`,null),D(this,`activeDropdown$`,this._activeDropdown$.asObservable()),D(this,`_zenVisible`,!1),this._init(),this._initSelectionChange(),this.disposeWithMe(()=>{this._activeDropdown$.complete()})}_init(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{this._zenVisible=e,e&&this.hideDropdown()}))}_getDropdownByCell(e,n,r,i){let a=e?this._univerInstanceService.getUnit(e,t.UniverInstanceType.UNIVER_SHEET):this._univerInstanceService.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET);if(!a)return;let o=n?a.getSheetBySheetId(n):a.getActiveSheet();if(!o)return;let s=this._dataValidationModel.getRuleByLocation(a.getUnitId(),o.getSheetId(),r,i);if(!s)return;let c=this._dataValidatorRegistryService.getValidatorItem(s.type);return c==null?void 0:c.dropdownType}_initSelectionChange(){this.disposeWithMe(this._sheetsSelectionsService.selectionMoveEnd$.subscribe(e=>{e&&e.every(e=>!(e.primary&&this._getDropdownByCell(e.primary.unitId,e.primary.sheetId,e.primary.actualRow,e.primary.actualColumn)))&&this.hideDropdown()}))}showDropdown(e){let{location:s}=e,{row:c,col:u,unitId:d,subUnitId:f,workbook:p,worksheet:m}=s;if(this._currentPopup&&this._currentPopup.dispose(),this._zenVisible)return;this._activeDropdown=e,this._activeDropdown$.next(this._activeDropdown);let h=this._sheetDataValidationModel.getRuleByLocation(d,f,c,u);if(!h)return;let g=this._dataValidatorRegistryService.getValidatorItem(h.type);if(!(g!=null&&g.dropdownType))return;let _,v=async(e,i)=>{var a,s,_;if(!e)return!0;let v=e,y=m.getCell(c,u),b=v.format(i===`date`?`YYYY-MM-DD 00:00:00`:`YYYY-MM-DD HH:mm:ss`),x=(a=t.numfmt.parseDate(b))==null?void 0:a.v,S=i===`time`?x%1:x,C=p.getStyles().getStyleByCell(y),w=(s=C==null||(_=C.n)==null?void 0:_.pattern)==null?``:s;return h.errorStyle!==t.DataValidationErrorStyle.STOP||await g.validator({value:S,unitId:d,subUnitId:f,row:c,column:u,worksheet:m,workbook:p,interceptValue:b.replace(`Z`,``).replace(`T`,` `),t:t.CellValueType.NUMBER},h)?(await this._commandService.executeCommand(r.SetRangeValuesCommand.id,{unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:S,t:2,p:null,f:null,si:null,s:{n:{pattern:F(i,w)}}}}),await this._commandService.executeCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!0):(this._injector.has(N)&&this._injector.get(N).showReject(g.getRuleFinalError(h,{row:c,col:u,unitId:d,subUnitId:f})),!1)},y;switch(g.dropdownType){case a.DataValidatorDropdownType.DATE:{var b;let e=P((0,i.getCellValueOrigin)(m.getCellRaw(c,u))),t=!!((b=h.bizInfo)!=null&&b.showTime);y={location:s,type:`datepicker`,props:{showTime:t,onChange:e=>v(e,t?`datetime`:`date`),defaultValue:e,patternType:`date`}};break}case a.DataValidatorDropdownType.TIME:y={location:s,type:`datepicker`,props:{onChange:e=>v(e,`time`),defaultValue:P((0,i.getCellValueOrigin)(m.getCellRaw(c,u))),patternType:`time`}};break;case a.DataValidatorDropdownType.DATETIME:y={location:s,type:`datepicker`,props:{onChange:e=>v(e,`datetime`),defaultValue:P((0,i.getCellValueOrigin)(m.getCellRaw(c,u))),patternType:`datetime`}};break;case a.DataValidatorDropdownType.LIST:case a.DataValidatorDropdownType.MULTIPLE_LIST:{var x,S,C,w;let e=g.dropdownType===a.DataValidatorDropdownType.MULTIPLE_LIST,p=async t=>{let a=(0,i.serializeListOptions)(t),s={unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:a,p:null,f:null,si:null}};return this._commandService.executeCommand(r.SetRangeValuesCommand.id,s),this._editorBridgeService.isVisible().visible&&await this._commandService.executeCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!e},v=(h==null?void 0:h.renderMode)===t.DataValidationRenderMode.CUSTOM||(h==null?void 0:h.renderMode)===void 0,b=g.getListWithColor(h,d,f),T=(0,i.getDataValidationCellValue)(m.getCellRaw(c,u));y={location:s,type:`list`,props:{onChange:e=>p(e),options:b.map(e=>({label:e.label,value:e.label,color:v||e.color?e.color||`#ECECEC`:`transparent`})),onEdit:()=>{this._commandService.executeCommand(R.id,{ruleId:h.uid}),_==null||_.dispose()},defaultValue:T,multiple:e,showEdit:(x=(S=this._configService.getConfig(`sheets-data-validation-ui.config`))==null?void 0:S.showEditOnDropdown)==null?!0:x,showSearch:(C=(w=this._configService.getConfig(`sheets-data-validation-ui.config`))==null?void 0:w.showSearchOnDropdown)==null?!0:C}};break}case a.DataValidatorDropdownType.CASCADE:var T;y={type:`cascader`,props:{onChange:e=>{let t={unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:e.join(`/`),p:null,f:null,si:null}};return this._commandService.syncExecuteCommand(r.SetRangeValuesCommand.id,t),this._editorBridgeService.isVisible().visible&&this._commandService.syncExecuteCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!0},defaultValue:(0,i.getDataValidationCellValue)(m.getCellRaw(c,u)).split(`/`),options:JSON.parse((T=h.formula1)==null?`[]`:T)},location:s};break;case a.DataValidatorDropdownType.COLOR:y={type:`color`,props:{onChange:e=>{let t={unitId:d,subUnitId:f,range:{startColumn:u,endColumn:u,startRow:c,endRow:c},value:{v:e,p:null,f:null,si:null}};return this._commandService.syncExecuteCommand(r.SetRangeValuesCommand.id,t),this._editorBridgeService.isVisible().visible&&this._commandService.syncExecuteCommand(l.SetCellEditVisibleOperation.id,{visible:!1,eventType:n.DeviceInputEventType.Keyboard,unitId:d,keycode:o.KeyCode.ESC}),!0},defaultValue:(0,i.getDataValidationCellValue)(m.getCellRaw(c,u))},location:s};break;default:throw Error(`[DataValidationDropdownManagerService]: unknown type!`)}if(_=this._cellDropdownManagerService.showDropdown({...y,onHide:()=>{this._activeDropdown=null,this._activeDropdown$.next(null)}}),!_)throw Error(`[DataValidationDropdownManagerService]: cannot show dropdown!`);let E=new t.DisposableCollection;E.add(_),E.add({dispose:()=>{var e,t;(e=this._activeDropdown)==null||(t=e.onHide)==null||t.call(e)}}),this._currentPopup=E}hideDropdown(){this._activeDropdown&&(this._currentPopup&&this._currentPopup.dispose(),this._currentPopup=null,this._activeDropdown=null,this._activeDropdown$.next(null))}showDataValidationDropdown(e,n,r,i,a){let o=this._univerInstanceService.getUnit(e,t.UniverInstanceType.UNIVER_SHEET);if(!o)return;let s=o.getSheetBySheetId(n);if(!s)return;let c=this._dataValidationModel.getRuleByLocation(o.getUnitId(),s.getSheetId(),r,i);if(!c)return;let l=this._dataValidatorRegistryService.getValidatorItem(c.type);if(!l||!l.dropdownType){this.hideDropdown();return}this.showDropdown({location:{workbook:o,worksheet:s,row:r,col:i,unitId:e,subUnitId:n},onHide:a})}};I=k([O(0,t.IUniverInstanceService),O(1,(0,t.Inject)(a.DataValidatorRegistryService)),O(2,o.IZenZoneService),O(3,(0,t.Inject)(i.SheetDataValidationModel)),O(4,(0,t.Inject)(r.SheetsSelectionsService)),O(5,(0,t.Inject)(l.ISheetCellDropdownManagerService)),O(6,(0,t.Inject)(i.SheetDataValidationModel)),O(7,t.ICommandService),O(8,l.IEditorBridgeService),O(9,(0,t.Inject)(t.Injector)),O(10,t.IConfigService)],I);let L=`DataValidationPanel`,R={id:`data-validation.operation.open-validation-panel`,type:t.CommandType.OPERATION,handler(e,n){if(!n)return!1;let{ruleId:i,isAdd:s}=n,c=e.get(A),l=e.get(a.DataValidationModel),u=e.get(t.IUniverInstanceService),d=e.get(o.ISidebarService),f=(0,r.getSheetCommandTarget)(u);if(!f)return!1;let{unitId:p,subUnitId:m}=f,h=i?l.getRuleById(p,m,i):void 0;c.open(),c.setActiveRule(h&&{unitId:p,subUnitId:m,rule:h});let g=d.open({id:L,header:{title:s?`dataValidation.panel.addTitle`:`dataValidation.panel.title`},children:{label:L},width:312,onClose:()=>c.close()});return c.setCloseDisposable(g),!0}},z={id:`data-validation.operation.close-validation-panel`,type:t.CommandType.OPERATION,handler(e){return e.get(A).close(),!0}},B={id:`data-validation.operation.toggle-validation-panel`,type:t.CommandType.OPERATION,handler(e){let n=e.get(t.ICommandService),r=e.get(A);return r.open(),r.isOpen?n.executeCommand(z.id):n.executeCommand(R.id),!0}},V={type:t.CommandType.OPERATION,id:`sheet.operation.show-data-validation-dropdown`,handler(e,t){if(!t)return!1;let n=e.get(I),{unitId:r,subUnitId:i,row:a,column:o}=t,s=n.activeDropdown,c=s==null?void 0:s.location;return c&&c.unitId===r&&c.subUnitId===i&&c.row===a&&c.col===o||n.showDataValidationDropdown(r,i,a,o),!0}},H={type:t.CommandType.OPERATION,id:`sheet.operation.hide-data-validation-dropdown`,handler(e,t){return t?(e.get(I).hideDropdown(),!0):!1}},U={type:t.CommandType.COMMAND,id:`data-validation.command.addRuleAndOpen`,handler(e){let n=(0,r.getSheetCommandTarget)(e.get(t.IUniverInstanceService));if(!n)return!1;let{workbook:a,worksheet:o}=n,s=(0,i.createDefaultNewRule)(e),c=e.get(t.ICommandService),l={rule:s,unitId:a.getUnitId(),subUnitId:o.getSheetId()};return c.syncExecuteCommand(i.AddSheetDataValidationCommand.id,l)?(c.syncExecuteCommand(R.id,{ruleId:s.uid,isAdd:!0}),!0):!1}},W=`SHEET_DATA_VALIDATION_ALERT`,G=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._hoverManagerService=e,this._cellAlertManagerService=t,this._univerInstanceService=n,this._localeService=r,this._zenZoneService=i,this._dataValidationModel=a,this._init()}_init(){this._initCellAlertPopup(),this._initZenService()}_initCellAlertPopup(){this.disposeWithMe(this._hoverManagerService.currentCell$.pipe((0,s.debounceTime)(100)).subscribe(e=>{if(e){let r=this._univerInstanceService.getUnit(e.location.unitId,t.UniverInstanceType.UNIVER_SHEET),i=r.getSheetBySheetId(e.location.subUnitId);if(!i)return;let a=this._dataValidationModel.getRuleByLocation(e.location.unitId,e.location.subUnitId,e.location.row,e.location.col);if(!a){this._cellAlertManagerService.removeAlert(W);return}if(this._dataValidationModel.validator(a,{...e.location,workbook:r,worksheet:i})===t.DataValidationStatus.INVALID){var n;let t=this._cellAlertManagerService.currentAlert.get(W),r=t==null||(n=t.alert)==null?void 0:n.location;if(r&&r.row===e.location.row&&r.col===e.location.col&&r.subUnitId===e.location.subUnitId&&r.unitId===e.location.unitId){this._cellAlertManagerService.removeAlert(W);return}let i=this._dataValidationModel.getValidator(a.type);if(!i){this._cellAlertManagerService.removeAlert(W);return}this._cellAlertManagerService.showAlert({type:l.CellAlertType.ERROR,title:this._localeService.t(`dataValidation.error.title`),message:i==null?void 0:i.getRuleFinalError(a,e.location),location:e.location,width:200,height:74,key:W});return}}this._cellAlertManagerService.removeAlert(W)}))}_initZenService(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e&&this._cellAlertManagerService.removeAlert(W)}))}};G=k([O(0,(0,t.Inject)(l.HoverManagerService)),O(1,(0,t.Inject)(l.CellAlertManagerService)),O(2,t.IUniverInstanceService),O(3,(0,t.Inject)(t.LocaleService)),O(4,o.IZenZoneService),O(5,(0,t.Inject)(i.SheetDataValidationModel))],G);let K=class extends t.Disposable{constructor(e,t,n){super(),this._autoFillService=e,this._sheetDataValidationModel=t,this._injector=n,this._initAutoFill()}_initAutoFill(){let e=()=>({redos:[],undos:[]}),n=(e,n)=>{let{source:a,target:o,unitId:s,subUnitId:c}=e,u=this._sheetDataValidationModel.getRuleObjectMatrix(s,c).clone(),d=(0,l.virtualizeDiscreteRanges)([a,o]),[f,p]=d.ranges,{mapFunc:m}=d,h={row:f.startRow,col:f.startColumn},g=r.AutoFillTools.getAutoFillRepeatRange(f,p),_=new t.ObjectMatrix,v=new Set;g.forEach(e=>{let n=e.repeatStartCell,r=e.relativeRange,i={startRow:h.row,startColumn:h.col,endColumn:h.col,endRow:h.row},a={startRow:n.row,startColumn:n.col,endColumn:n.col,endRow:n.row};t.Range.foreach(r,(e,n)=>{let r=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},i),{row:o,col:l}=m(r.startRow,r.startColumn),u=this._sheetDataValidationModel.getRuleIdByLocation(s,c,o,l)||``,d=t.Rectangle.getPositionRange({startRow:e,startColumn:n,endColumn:n,endRow:e},a),{row:f,col:p}=m(d.startRow,d.startColumn);_.setValue(f,p,u),v.add(u)})});let y=Array.from(v).map(e=>({id:e,ranges:(0,t.queryObjectMatrix)(_,t=>t===e)}));u.addRangeRules(y);let{redoMutations:b,undoMutations:x}=(0,i.getDataValidationDiffMutations)(s,c,u.diff(this._sheetDataValidationModel.getRules(s,c)),this._injector,`patched`,n===r.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT);return{undos:x,redos:b}},a={id:i.DATA_VALIDATION_PLUGIN_NAME,onBeforeFillData:e=>{let{source:n,unitId:i,subUnitId:a}=e;for(let e of n.rows)for(let o of n.cols){let n=this._sheetDataValidationModel.getRuleByLocation(i,a,e,o);if(n&&n.type===t.DataValidationType.CHECKBOX){this._autoFillService.setDisableApplyType(r.AUTO_FILL_APPLY_TYPE.SERIES,!0);return}}},onFillData:(t,i,a)=>a===r.AUTO_FILL_APPLY_TYPE.COPY||a===r.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT||a===r.AUTO_FILL_APPLY_TYPE.SERIES?n(t,a):e(),onAfterFillData:()=>{}};this.disposeWithMe(this._autoFillService.addHook(a))}};K=k([O(0,r.IAutoFillService),O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(t.Injector))],K);let ee=[l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_COL_WIDTH,l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_VALUE,l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMAT,l.PREDEFINED_HOOK_NAME_PASTE.SPECIAL_PASTE_FORMULA],q=class extends t.Disposable{constructor(e,t,n,r){super(),this._sheetClipboardService=e,this._sheetDataValidationModel=t,this._injector=n,this._univerInstanceService=r,D(this,`_copyInfo`,void 0),this._initCopyPaste()}_initCopyPaste(){this._sheetClipboardService.addClipboardHook({id:i.DATA_VALIDATION_PLUGIN_NAME,onBeforeCopy:(e,t,n)=>this._collect(e,t,n),onPasteCells:(e,t,n,r)=>!e||!this._copyInfo||ee.includes(r.pasteType)?{redos:[],undos:[]}:this._generateMutations(e,t,r)})}_collect(e,n,i){let a=new t.ObjectMatrix;this._copyInfo={unitId:e,subUnitId:n,matrix:a};let o=this._injector.invoke(t=>(0,r.rangeToDiscreteRange)(i,t,e,n));if(!o)return;let{rows:s,cols:c}=o;s.forEach((t,r)=>{c.forEach((i,o)=>{let s=this._sheetDataValidationModel.getRuleIdByLocation(e,n,t,i);a.setValue(r,o,s==null?``:s)})})}_generateMutations(e,n,a){let{unitId:o,subUnitId:s,range:c}=e,{unitId:u,subUnitId:d,range:f}=n,{copyType:p=l.COPY_TYPE.COPY}=a;if(!(0,r.getSheetCommandTarget)(this._univerInstanceService,{unitId:u,subUnitId:d}))return{redos:[],undos:[]};if(p===l.COPY_TYPE.CUT&&u===o&&d===s)return this._copyInfo=null,{redos:[],undos:[]};if(u!==o||d!==s){let e=this._sheetDataValidationModel.getRuleObjectMatrix(u,d).clone(),n=new t.ObjectMatrix,r=new Set,{ranges:[a,m],mapFunc:h}=(0,l.virtualizeDiscreteRanges)([c,f]),g=(0,l.getRepeatRange)(a,m,!0),_=new Map;g.forEach(({startRange:e})=>{var i;(i=this._copyInfo)==null||i.matrix.forValue((i,a,c)=>{let l=t.Rectangle.getPositionRange({startRow:i,endRow:i,startColumn:a,endColumn:a},e),f=`${s}-${c}`,p=this._sheetDataValidationModel.getRuleById(o,s,c);!this._sheetDataValidationModel.getRuleById(u,d,f)&&p&&_.set(f,{...p,uid:f});let{row:m,col:g}=h(l.startRow,l.startColumn);r.add(f),n.setValue(m,g,f)})});let v=Array.from(r).map(e=>({id:e,ranges:(0,t.queryObjectMatrix)(n,t=>t===e)}));e.addRangeRules(v);let{redoMutations:y,undoMutations:b}=(0,i.getDataValidationDiffMutations)(u,d,e.diffWithAddition(this._sheetDataValidationModel.getRules(u,d),_.values()),this._injector,`patched`,!1);if(p===l.COPY_TYPE.CUT){let e=this._sheetDataValidationModel.getRuleObjectMatrix(o,s).clone(),t=h(a.startRow,a.startColumn),n=h(a.endRow,a.endColumn);e.addRangeRules([{id:``,ranges:[{startRow:t.row,endRow:n.row,startColumn:t.col,endColumn:n.col}]}]);let{redoMutations:r,undoMutations:c}=(0,i.getDataValidationDiffMutations)(o,s,e.diff(this._sheetDataValidationModel.getRules(o,s)),this._injector,`patched`,!1);y.push(...r),b.push(...c)}return{redos:y,undos:b}}else{let e=this._sheetDataValidationModel.getRuleObjectMatrix(o,s).clone(),n=new t.ObjectMatrix,r=new Set,{ranges:[a,p],mapFunc:m}=(0,l.virtualizeDiscreteRanges)([c,f]);(0,l.getRepeatRange)(a,p,!0).forEach(({startRange:e})=>{var i;(i=this._copyInfo)==null||i.matrix.forValue((i,a,o)=>{let s=t.Rectangle.getPositionRange({startRow:i,endRow:i,startColumn:a,endColumn:a},e),{row:c,col:l}=m(s.startRow,s.startColumn);n.setValue(c,l,o),r.add(o)})});let h=Array.from(r).map(e=>({id:e,ranges:(0,t.queryObjectMatrix)(n,t=>t===e)}));e.addRangeRules(h);let{redoMutations:g,undoMutations:_}=(0,i.getDataValidationDiffMutations)(u,d,e.diff(this._sheetDataValidationModel.getRules(o,s)),this._injector,`patched`,!1);return{redos:g,undos:_}}}};q=k([O(0,l.ISheetClipboardService),O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(t.Injector)),O(3,(0,t.Inject)(t.IUniverInstanceService))],q);let J=class extends t.Disposable{constructor(e,t,n){super(),this._localeService=e,this._commandService=t,this._sheetPermissionCheckController=n,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===i.AddSheetDataValidationCommand.id){let{unitId:t,subUnitId:n,rule:{ranges:i}}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[r.WorkbookEditablePermission],rangeTypes:[r.RangeProtectionPermissionEditPoint],worksheetTypes:[r.WorksheetEditPermission,r.WorksheetSetCellStylePermission]},i,t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.setStyleErr`))}if(e.id===i.UpdateSheetDataValidationRangeCommand.id){let{unitId:t,subUnitId:n,ranges:i}=e.params;this._sheetPermissionCheckController.permissionCheckWithRanges({workbookTypes:[r.WorkbookEditablePermission],rangeTypes:[r.RangeProtectionPermissionEditPoint],worksheetTypes:[r.WorksheetEditPermission,r.WorksheetSetCellStylePermission]},i,t,n)||this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.setStyleErr`))}}))}};J=k([O(0,(0,t.Inject)(t.LocaleService)),O(1,t.ICommandService),O(2,(0,t.Inject)(r.SheetPermissionCheckController))],J);let Y=`sheet.menu.data-validation`;function te(e){return{id:Y,type:o.MenuItemType.SUBITEMS,icon:`DataValidationIcon`,tooltip:`dataValidation.title`,hidden$:(0,o.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,l.getCurrentRangeDisable$)(e,{workbookTypes:[r.WorkbookEditablePermission],worksheetTypes:[r.WorksheetSetCellStylePermission,r.WorksheetEditPermission],rangeTypes:[r.RangeProtectionPermissionEditPoint]})}}function ne(e){return{id:R.id,title:`dataValidation.panel.title`,type:o.MenuItemType.BUTTON}}function re(e){return{id:U.id,title:`dataValidation.panel.add`,type:o.MenuItemType.BUTTON}}let ie={[o.RibbonDataGroup.RULES]:{[Y]:{order:0,menuItemFactory:te,[R.id]:{order:0,menuItemFactory:ne},[U.id]:{order:1,menuItemFactory:re}}}},ae={tr:{size:6,color:`#fe4b4b`}},X=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this._commandService=e,this._menuManagerService=t,this._renderManagerService=n,this._univerInstanceService=r,this._autoHeightController=i,this._dropdownManagerService=a,this._sheetDataValidationModel=o,this._dataValidatorRegistryService=s,this._sheetInterceptorService=c,this._dataValidationCacheService=l,this._editorBridgeService=u,this._initMenu(),this._initDropdown(),this._initViewModelIntercept(),this._initAutoHeight()}_initMenu(){this._menuManagerService.mergeMenu(ie)}_initDropdown(){this._editorBridgeService&&this.disposeWithMe(this._editorBridgeService.visible$.subscribe(e=>{if(!e.visible){var t;((t=this._dropdownManagerService.activeDropdown)==null?void 0:t.trigger)===`editor-bridge`&&this._dropdownManagerService.hideDropdown();return}let n=this._editorBridgeService.getEditCellState();if(n){let{unitId:e,sheetId:t,row:r,column:i}=n,a=this._univerInstanceService.getUniverSheetInstance(e);if(!a)return;let o=this._sheetDataValidationModel.getRuleByLocation(e,t,r,i);if(!o)return;let s=this._dataValidatorRegistryService.getValidatorItem(o.type);if(!(s!=null&&s.dropdownType))return;let c=a.getActiveSheet();if(!c)return;let l=this._dropdownManagerService.activeDropdown,u=l==null?void 0:l.location;if(u&&u.unitId===e&&u.subUnitId===t&&u.row===r&&u.col===i)return;this._dropdownManagerService.showDropdown({location:{unitId:e,subUnitId:t,row:r,col:i,workbook:a,worksheet:c},trigger:`editor-bridge`,closeOnOutSide:!1})}}))}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(r.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,priority:r.InterceptCellContentPriority.DATA_VALIDATION,handler:(e,n,r)=>{var a,o,s,c,u;let{row:d,col:f,unitId:p,subUnitId:m,workbook:h,worksheet:g}=n,_=this._sheetDataValidationModel.getRuleIdByLocation(p,m,d,f);if(!_)return r(e);let v=this._sheetDataValidationModel.getRuleById(p,m,_);if(!v)return r(e);let y=(a=this._dataValidationCacheService.getValue(p,m,d,f))==null?t.DataValidationStatus.VALID:a,b=this._dataValidatorRegistryService.getValidatorItem(v.type),x=n.rawData,S,C={get value(){var e;return S===void 0&&(S=(e=(0,i.getCellValueOrigin)(x))==null?null:e),S}},w={get value(){var e;return`${(e=C.value)==null?``:e}`}};return(!e||e===n.rawData)&&(e={...n.rawData}),e.markers={...e==null?void 0:e.markers,...y===t.DataValidationStatus.INVALID?ae:null},e.customRender=[...(o=e==null?void 0:e.customRender)==null?[]:o,...b!=null&&b.canvasRender?[b.canvasRender]:[]],e.fontRenderExtension={...e==null?void 0:e.fontRenderExtension,isSkip:(e==null||(s=e.fontRenderExtension)==null?void 0:s.isSkip)||(b==null||(c=b.skipDefaultFontRender)==null?void 0:c.call(b,v,C.value,n))},e.interceptorStyle={...e==null?void 0:e.interceptorStyle,...b==null?void 0:b.getExtraStyle(v,w.value,{get style(){let t=h.getStyles();return(typeof(e==null?void 0:e.s)==`string`?t.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}}},d,f)},e.interceptorAutoHeight=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoHeight)==null?void 0:a.call(i,c)},e.interceptorAutoWidth=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoWidth)==null?void 0:a.call(i,c)},e.coverable=((u=e==null?void 0:e.coverable)==null?!0:u)&&!(v.type===t.DataValidationType.LIST||v.type===t.DataValidationType.LIST_MULTIPLE),r(e)}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe((0,s.filter)(e=>e.source===`command`),(0,s.bufferTime)(100)).subscribe(e=>{if(e.length===0)return;let n=[];e.forEach(e=>{if(e.rule.type===t.DataValidationType.LIST_MULTIPLE||e.rule.type===t.DataValidationType.LIST){var r;(r=e.rule)!=null&&r.ranges&&n.push(...e.rule.ranges)}}),n.length&&(0,t.sequenceExecute)(this._autoHeightController.getUndoRedoParamsOfAutoHeight(n).redos,this._commandService)})}};X=k([O(0,t.ICommandService),O(1,o.IMenuManagerService),O(2,n.IRenderManagerService),O(3,t.IUniverInstanceService),O(4,(0,t.Inject)(l.AutoHeightController)),O(5,(0,t.Inject)(I)),O(6,(0,t.Inject)(i.SheetDataValidationModel)),O(7,(0,t.Inject)(a.DataValidatorRegistryService)),O(8,(0,t.Inject)(r.SheetInterceptorService)),O(9,(0,t.Inject)(i.DataValidationCacheService)),O(10,(0,t.Optional)(l.IEditorBridgeService))],X);let oe=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o){super(),this._commandService=e,this._renderManagerService=t,this._autoHeightController=n,this._dataValidatorRegistryService=r,this._sheetInterceptorService=i,this._sheetDataValidationModel=a,this._dataValidationCacheService=o,this._initViewModelIntercept(),this._initAutoHeight()}_initViewModelIntercept(){this.disposeWithMe(this._sheetInterceptorService.intercept(r.INTERCEPTOR_POINT.CELL_CONTENT,{effect:t.InterceptorEffectEnum.Style,priority:r.InterceptCellContentPriority.DATA_VALIDATION,handler:(e,n,r)=>{var a,o,s,c,u;let{row:d,col:f,unitId:p,subUnitId:m,workbook:h,worksheet:g}=n,_=this._sheetDataValidationModel.getRuleIdByLocation(p,m,d,f);if(!_)return r(e);let v=this._sheetDataValidationModel.getRuleById(p,m,_);if(!v)return r(e);let y=(a=this._dataValidationCacheService.getValue(p,m,d,f))==null?t.DataValidationStatus.VALID:a,b=this._dataValidatorRegistryService.getValidatorItem(v.type),x=(0,i.getCellValueOrigin)(g.getCellRaw(d,f)),S=`${x==null?``:x}`;return(!e||e===n.rawData)&&(e={...n.rawData}),e.markers={...e==null?void 0:e.markers,...y===t.DataValidationStatus.INVALID?ae:null},e.customRender=[...(o=e==null?void 0:e.customRender)==null?[]:o,...b!=null&&b.canvasRender?[b.canvasRender]:[]],e.fontRenderExtension={...e==null?void 0:e.fontRenderExtension,isSkip:(e==null||(s=e.fontRenderExtension)==null?void 0:s.isSkip)||(b==null||(c=b.skipDefaultFontRender)==null?void 0:c.call(b,v,x,n))},e.interceptorStyle={...e==null?void 0:e.interceptorStyle,...b==null?void 0:b.getExtraStyle(v,S,{get style(){let t=h.getStyles();return(typeof(e==null?void 0:e.s)==`string`?t.get(e==null?void 0:e.s):e==null?void 0:e.s)||{}}},d,f)},e.interceptorAutoHeight=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoHeight)==null?void 0:a.call(i,c)},e.interceptorAutoWidth=()=>{var t,n,r,i,a;let o=(t=this._renderManagerService.getRenderById(p))==null||(t=t.with(l.SheetSkeletonManagerService).getSkeletonParam(m))==null?void 0:t.skeleton;if(!o)return;let s=o.worksheet.getMergedCell(d,f),c={data:e,style:o.getStyles().getStyleByCell(e),primaryWithCoord:o.getCellWithCoordByIndex((n=s==null?void 0:s.startRow)==null?d:n,(r=s==null?void 0:s.startColumn)==null?f:r),unitId:p,subUnitId:m,row:d,col:f,workbook:h,worksheet:g};return b==null||(i=b.canvasRender)==null||(a=i.calcCellAutoWidth)==null?void 0:a.call(i,c)},e.coverable=((u=e==null?void 0:e.coverable)==null?!0:u)&&!(v.type===t.DataValidationType.LIST||v.type===t.DataValidationType.LIST_MULTIPLE),r(e)}}))}_initAutoHeight(){this._sheetDataValidationModel.ruleChange$.pipe((0,s.filter)(e=>e.source===`command`),(0,s.bufferTime)(16)).subscribe(e=>{let n=[];e.forEach(e=>{if(e.rule.type===t.DataValidationType.LIST_MULTIPLE||e.rule.type===t.DataValidationType.LIST){var r;(r=e.rule)!=null&&r.ranges&&n.push(...e.rule.ranges)}}),n.length&&(0,t.sequenceExecute)(this._autoHeightController.getUndoRedoParamsOfAutoHeight(n).redos,this._commandService)})}};oe=k([O(0,t.ICommandService),O(1,n.IRenderManagerService),O(2,(0,t.Inject)(l.AutoHeightController)),O(3,(0,t.Inject)(a.DataValidatorRegistryService)),O(4,(0,t.Inject)(r.SheetInterceptorService)),O(5,(0,t.Inject)(i.SheetDataValidationModel)),O(6,(0,t.Inject)(i.DataValidationCacheService))],oe);let se=class extends t.Disposable{constructor(e,t,n){super(),this._context=e,this._sheetDataValidationModel=t,this._sheetSkeletonManagerService=n,this._initSkeletonChange()}_initSkeletonChange(){this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe((0,t.bufferDebounceTime)(16)).subscribe(e=>{var t;if(!e.length)return;let n=new Set;e.forEach(e=>{n.add(e.subUnitId)}),n.forEach(e=>{var t;(t=this._sheetSkeletonManagerService.getSkeletonParam(e))==null||t.skeleton.makeDirty(!0)}),(t=this._context.mainComponent)==null||t.makeForceDirty()}))}};se=k([O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(l.SheetSkeletonManagerService))],se);function Z({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,d.useRef)(`_${de()}`);return ce(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function ce(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...le(e,n,i),...r},(ue(e,n).children||[]).map((r,a)=>ce(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function le(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function ue(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function de(){return Math.random().toString(36).substring(2,8)}Z.displayName=`UniverIcon`;let fe={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M1.4917 3.07803C1.4917 2.19437 2.20804 1.47803 3.0917 1.47803H5.6917C6.57536 1.47803 7.2917 2.19437 7.2917 3.07803V5.67803C7.2917 6.56168 6.57535 7.27803 5.6917 7.27803H3.0917C2.20804 7.27803 1.4917 6.56168 1.4917 5.67803V3.07803ZM3.0917 2.67803C2.87078 2.67803 2.6917 2.85711 2.6917 3.07803V5.67803C2.6917 5.89894 2.87079 6.07803 3.0917 6.07803H5.6917C5.91261 6.07803 6.0917 5.89894 6.0917 5.67803V3.07803C6.0917 2.85711 5.91261 2.67803 5.6917 2.67803H3.0917Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M14.6175 2.45279C14.8518 2.68711 14.8518 3.06701 14.6175 3.30132L11.6151 6.30365C11.3957 6.52307 11.0451 6.53897 10.8067 6.34031L8.80915 4.67566C8.55458 4.46352 8.52019 4.08518 8.73233 3.83062C8.94447 3.57605 9.32281 3.54166 9.57737 3.7538L11.154 5.06767L13.769 2.45278C14.0033 2.21847 14.3832 2.21848 14.6175 2.45279Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M14.1175 9.19746C14.3518 9.43178 14.3518 9.81168 14.1175 10.046L12.5418 11.6217L14.1175 13.1975C14.3518 13.4318 14.3518 13.8117 14.1175 14.046C13.8832 14.2803 13.5033 14.2803 13.269 14.046L11.6933 12.4703L10.1175 14.046C9.88321 14.2803 9.50331 14.2803 9.269 14.046C9.03468 13.8117 9.03468 13.4318 9.269 13.1975L10.8447 11.6217L9.269 10.046C9.03468 9.81168 9.03468 9.43178 9.269 9.19746C9.50331 8.96315 9.88321 8.96315 10.1175 9.19746L11.6933 10.7732L13.269 9.19746C13.5033 8.96315 13.8832 8.96315 14.1175 9.19746Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M3.0917 8.72168C2.20804 8.72168 1.4917 9.43802 1.4917 10.3217V12.9217C1.4917 13.8053 2.20804 14.5217 3.0917 14.5217H5.6917C6.57535 14.5217 7.2917 13.8053 7.2917 12.9217V10.3217C7.2917 9.43802 6.57536 8.72168 5.6917 8.72168H3.0917ZM2.6917 10.3217C2.6917 10.1008 2.87078 9.92168 3.0917 9.92168H5.6917C5.91261 9.92168 6.0917 10.1008 6.0917 10.3217V12.9217C6.0917 13.1426 5.91261 13.3217 5.6917 13.3217H3.0917C2.87079 13.3217 2.6917 13.1426 2.6917 12.9217V10.3217Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},pe=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(Z,Object.assign({},e,{id:`data-validation-icon`,ref:t,icon:fe}))});pe.displayName=`DataValidationIcon`;let me={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928L9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171C10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778L9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539C9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263L6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539C5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778L6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},he=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(Z,Object.assign({},e,{id:`delete-icon`,ref:t,icon:me}))});he.displayName=`DeleteIcon`;let ge={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z`}}]},_e=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(Z,Object.assign({},e,{id:`increase-icon`,ref:t,icon:ge}))});_e.displayName=`IncreaseIcon`;let ve={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},ye=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(Z,Object.assign({},e,{id:`more-down-icon`,ref:t,icon:ve}))});ye.displayName=`MoreDownIcon`;let be={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M4.64645 9.85355C4.45118 9.65829 4.45118 9.34171 4.64645 9.14645L7.64645 6.14645C7.84171 5.95118 8.15829 5.95118 8.35355 6.14645L11.3536 9.14645C11.5488 9.34171 11.5488 9.65829 11.3536 9.85355C11.1583 10.0488 10.8417 10.0488 10.6464 9.85355L8 7.20711L5.35355 9.85355C5.15829 10.0488 4.84171 10.0488 4.64645 9.85355Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},xe=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(Z,Object.assign({},e,{id:`more-up-icon`,ref:t,icon:be}))});xe.displayName=`MoreUpIcon`;let Se={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z`}}]},Ce=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(Z,Object.assign({},e,{id:`sequence-icon`,ref:t,icon:Se}))});Ce.displayName=`SequenceIcon`;function we(e){var n;let r=(0,o.useDependency)(t.LocaleService),i=(0,o.useDependency)(o.ComponentManager),{value:a,onChange:s,extraComponent:c}=e,[l,f]=(0,d.useState)(!1),p=c?i.get(c):null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`univer-mb-3 univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-text-gray-900 dark:!univer-text-white`,onClick:()=>f(!l),children:[r.t(`dataValidation.panel.options`),l?(0,m.jsx)(xe,{className:`univer-ml-1`}):(0,m.jsx)(ye,{className:`univer-ml-1`})]}),l&&(0,m.jsxs)(m.Fragment,{children:[p?(0,m.jsx)(p,{value:a,onChange:s}):null,(0,m.jsx)(u.FormLayout,{label:r.t(`dataValidation.panel.invalid`),children:(0,m.jsxs)(u.RadioGroup,{value:`${(n=a.errorStyle)==null?t.DataValidationErrorStyle.WARNING:n}`,onChange:e=>s({...a,errorStyle:+e}),children:[(0,m.jsx)(u.Radio,{value:`${t.DataValidationErrorStyle.WARNING}`,children:r.t(`dataValidation.panel.showWarning`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationErrorStyle.STOP}`,children:r.t(`dataValidation.panel.rejectInput`)})]})}),(0,m.jsx)(u.FormLayout,{label:r.t(`dataValidation.panel.messageInfo`),children:(0,m.jsx)(u.Checkbox,{checked:a.showErrorMessage,onChange:()=>s({...a,showErrorMessage:!a.showErrorMessage}),children:r.t(`dataValidation.panel.showInfo`)})}),a.showErrorMessage?(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Input,{value:a.error,onChange:e=>s({...a,error:e})})}):null]})]})}let Te=e=>(0,t.debounce)(async(t,n,r,i)=>{let a=await e.executeCommand(t,n,r);i==null||i(a)},1e3);function Ee(e,n,r){var i;if(n){var a;return((a=e.getUnit(n))==null||(a=a.getSheetBySheetName(r))==null?void 0:a.getSheetId())||``}return((i=e.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET))==null||(i=i.getSheetBySheetName(r))==null?void 0:i.getSheetId())||``}function De(){var e,n;let[c,l]=(0,d.useState)(0),h=(0,o.useDependency)(A),{unitId:g,subUnitId:_,rule:v}=(0,o.useObservable)(h.activeRule$,h.activeRule)||{},y=v.uid,b=(0,o.useDependency)(a.DataValidatorRegistryService),x=(0,o.useDependency)(t.IUniverInstanceService),S=(0,o.useDependency)(o.ComponentManager),C=(0,o.useDependency)(t.ICommandService),w=(0,o.useDependency)(a.DataValidationModel),T=(0,o.useDependency)(t.LocaleService),E=(0,o.useObservable)(()=>x.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),D=(0,o.useObservable)(()=>{var e;return(e=E==null?void 0:E.activeSheet$)==null?(0,s.of)(null):e},void 0,void 0,[]),[O,k]=(0,d.useState)(v),j=b.getValidatorItem(O.type),[M,N]=(0,d.useState)(!1),P=b.getValidatorsByScope(a.DataValidatorRegistryScope.SHEET),[F,I]=(0,d.useState)(()=>O.ranges.map(e=>({unitId:``,sheetId:``,range:e}))),L=(0,d.useMemo)(()=>Te(C),[C]),[R,z]=(0,d.useState)(!1),[B,V]=(0,d.useState)(!1),H=(0,d.useRef)(null),U=(0,o.useDependency)(r.SheetsSelectionsService);if((0,d.useEffect)(()=>()=>{let e=U.getCurrentLastSelection();e&&U.setSelections([e])},[U]),(0,d.useEffect)(()=>{C.onCommandExecuted(e=>{(e.id===t.UndoCommand.id||e.id===t.RedoCommand.id)&&setTimeout(()=>{let e=w.getRuleById(g,_,y);l(e=>e+1),e&&(k(e),I(e.ranges.map(e=>({unitId:``,sheetId:``,range:e}))))},20)})},[C,w,y,_,g]),!j)return null;let W=j.operators,G=j.operatorNames,K=O.operator?a.TWO_FORMULA_OPERATOR_COUNT.includes(O.operator):!1,ee=()=>{(D==null?void 0:D.getSheetId())!==_&&C.syncExecuteCommand(r.SetWorksheetActiveOperation.id,{unitId:g,subUnitId:_})},q=()=>{var e;if(!((e=H.current)==null||(e=e.editor)==null)&&e.isFocus()){var t;J((t=H.current)==null?void 0:t.getValue())}!O.ranges.length||R||(j.validatorFormula(O,g,_).success?h.setActiveRule(null):N(!0),ee())},J=(0,o.useEvent)(e=>{let n=e.split(`,`).filter(Boolean).map(f.deserializeRangeWithSheet).map(e=>{let t=e.sheetName;if(t){let n=Ee(x,e.unitId,t);return{...e,sheetId:n}}return{...e,sheetId:``}});if((0,t.isUnitRangesEqual)(n,F))return;I(n);let r=n.filter(e=>(!e.unitId||e.unitId===g)&&(!e.sheetId||e.sheetId===_)).map(e=>e.range);if(k({...O,ranges:r}),r.length===0)return;let a={unitId:g,subUnitId:_,ruleId:y,ranges:r};L(i.UpdateSheetDataValidationRangeCommand.id,a)}),Y=e=>{if((0,t.shallowEqual)(e,(0,a.getRuleSetting)(O)))return;k({...O,...e});let n={unitId:g,subUnitId:_,ruleId:y,setting:e};L(i.UpdateSheetDataValidationSettingCommand.id,n,void 0)},te=async()=>{await C.executeCommand(i.RemoveSheetDataValidationCommand.id,{ruleId:y,unitId:g,subUnitId:_}),h.setActiveRule(null),ee()},ne={type:O.type,operator:O.operator,formula1:O.formula1,formula2:O.formula2,allowBlank:O.allowBlank},re=e=>{let t=b.getValidatorItem(e);if(!t)return;let n=t.operators,r=w.getRuleById(g,_,y),o=e===(r==null?void 0:r.type)||e.includes(`list`)&&r!=null&&r.type.includes(`list`)?{...r,type:e}:{...O,type:e,operator:n[0],formula1:void 0,formula2:void 0};k(o),C.executeCommand(i.UpdateSheetDataValidationSettingCommand.id,{unitId:g,subUnitId:_,ruleId:O.uid,setting:(0,a.getRuleSetting)(o)})},ie=S.get(j.formulaInput),ae=(0,d.useMemo)(()=>F.map(e=>(0,f.serializeRange)(e.range)).join(`,`),[]),X=(0,a.getRuleOptions)(O),oe=e=>{(0,t.shallowEqual)(e,(0,a.getRuleOptions)(O))||(k({...O,...e}),L(i.UpdateSheetDataValidationOptionsCommand.id,{unitId:g,subUnitId:_,ruleId:y,options:e}))},se=W.length&&!O.operator;return(0,m.jsxs)(`div`,{"data-u-comp":`data-validation-detail`,className:`univer-py-2`,children:[(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.panel.range`),error:!O.ranges.length||R?T.t(`dataValidation.panel.rangeError`):``,children:(0,m.jsx)(p.RangeSelector,{selectorRef:H,unitId:g,subUnitId:_,initialValue:ae,onChange:(e,t)=>{var n;!B&&(n=H.current)!=null&&n.verify()&&J(t)},onFocusChange:(e,t)=>{var n;V(e),!e&&t&&(n=H.current)!=null&&n.verify()&&J(t)},onVerify:e=>z(!e)})}),(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.panel.type`),children:(0,m.jsx)(u.Select,{className:`univer-w-full`,value:O.type,options:P==null||(e=P.sort((e,t)=>e.order-t.order))==null?void 0:e.map(e=>({label:T.t(e.title),value:e.id})),onChange:re})}),W!=null&&W.length?(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.panel.operator`),children:(0,m.jsx)(u.Select,{className:`univer-w-full`,value:`${O.operator}`,options:[{value:``,label:T.t(`dataValidation.operators.legal`)},...W.map((e,t)=>({value:`${e}`,label:G[t]}))],onChange:e=>{Y({...ne,operator:e})}})}):null,ie&&!se?(0,m.jsx)(ie,{isTwoFormula:K,value:{formula1:O.formula1,formula2:O.formula2},onChange:e=>{Y({...ne,...e})},showError:M,validResult:j.validatorFormula(O,g,_),unitId:g,subUnitId:_,ruleId:y},c+O.type):null,(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Checkbox,{checked:(n=O.allowBlank)==null?!0:n,onChange:()=>{var e;return Y({...ne,allowBlank:!((e=O.allowBlank)==null||e)})},children:T.t(`dataValidation.panel.allowBlank`)})}),(0,m.jsx)(we,{value:X,onChange:oe,extraComponent:j.optionsInput}),(0,m.jsxs)(`div`,{className:`univer-mt-5 univer-flex univer-flex-row univer-justify-end`,children:[(0,m.jsx)(u.Button,{className:`univer-ml-3`,onClick:te,children:T.t(`dataValidation.panel.removeRule`)}),(0,m.jsx)(u.Button,{className:`univer-ml-3`,variant:`primary`,onClick:q,children:T.t(`dataValidation.panel.done`)})]})]})}let Oe=e=>{let{rule:n,onClick:r,unitId:s,subUnitId:c,disable:p}=e,h=(0,o.useDependency)(a.DataValidatorRegistryService),g=(0,o.useDependency)(t.ICommandService),_=(0,o.useDependency)(l.IMarkSelectionService),v=h.getValidatorItem(n.type),y=(0,d.useRef)(void 0),[b,x]=(0,d.useState)(!1),S=(0,o.useDependency)(t.ThemeService),C=(0,d.useMemo)(()=>{var e;let n=S.getColorFromTheme(`primary.600`),r=S.getColorFromTheme(`loop-color.2`),i=(e=S.getColorFromTheme(r))==null?n:e,a=new t.ColorKit(i).toRgb();return{fill:`rgba(${a.r}, ${a.g}, ${a.b}, 0.1)`,stroke:i}},[(0,o.useObservable)(S.currentTheme$)]),w=e=>{g.executeCommand(i.RemoveSheetDataValidationCommand.id,{ruleId:n.uid,unitId:s,subUnitId:c}),e.stopPropagation()};return(0,d.useEffect)(()=>()=>{if(y.current){var e;(e=y.current)==null||e.forEach(e=>{e&&_.removeShape(e)})}},[_]),(0,m.jsxs)(`div`,{className:(0,u.clsx)(`univer-bg-secondary univer-relative univer--mx-2 univer-box-border univer-flex univer-w-[287px] univer-cursor-pointer univer-flex-col univer-justify-between univer-overflow-hidden univer-rounded-md univer-p-2 univer-pr-9`,{"hover:univer-bg-gray-50 dark:hover:!univer-bg-gray-700":!p,"univer-opacity-50":p}),onClick:r,onMouseEnter:()=>{p||(x(!0),y.current=n.ranges.map(e=>_.addShape({range:e,style:C,primary:null})))},onMouseLeave:()=>{var e;x(!1),(e=y.current)==null||e.forEach(e=>{e&&_.removeShape(e)}),y.current=void 0},children:[(0,m.jsx)(`div`,{className:`univer-truncate univer-text-sm univer-font-medium univer-leading-[22px] univer-text-gray-900 dark:!univer-text-white`,children:v==null?void 0:v.generateRuleName(n)}),(0,m.jsx)(`div`,{className:`univer-text-secondary univer-truncate univer-text-xs univer-leading-[18px] dark:!univer-text-gray-300`,children:n.ranges.map(e=>(0,f.serializeRange)(e)).join(`,`)}),b?(0,m.jsx)(`div`,{className:`univer-absolute univer-right-2 univer-top-[19px] univer-flex univer-size-5 univer-items-center univer-justify-center univer-rounded hover:univer-bg-gray-200 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700`,onClick:w,children:(0,m.jsx)(he,{})}):null]})};function ke(e){let n=(0,o.useDependency)(i.SheetDataValidationModel),a=(0,o.useDependency)(t.IUniverInstanceService),s=(0,o.useDependency)(t.ICommandService),c=(0,o.useDependency)(t.Injector),l=(0,o.useDependency)(A),f=(0,o.useDependency)(t.LocaleService),[p,h]=(0,d.useState)([]),{workbook:g}=e,_=(0,o.useObservable)(g.activeSheet$,void 0,!0),v=g.getUnitId(),y=_==null?void 0:_.getSheetId();(0,d.useEffect)(()=>{h(n.getRules(v,y));let e=n.ruleChange$.subscribe(e=>{e.unitId===v&&e.subUnitId===y&&h(n.getRules(v,y))});return()=>{e.unsubscribe()}},[v,y,n]);let b=async()=>{let e=(0,i.createDefaultNewRule)(c),t={unitId:v,subUnitId:y,rule:e};await s.executeCommand(i.AddSheetDataValidationCommand.id,t),l.setActiveRule({unitId:v,subUnitId:y,rule:e})},x=()=>{s.executeCommand(i.RemoveSheetAllDataValidationCommand.id,{unitId:v,subUnitId:y})},S=(e=>{let n=a.getCurrentUnitForType(t.UniverInstanceType.UNIVER_SHEET),i=n.getActiveSheet(),o=n.getUnitId(),s=i.getSheetId();return e.map(e=>(0,r.checkRangesEditablePermission)(c,o,s,e.ranges)?{...e}:{...e,disable:!0})})(p),C=S==null?void 0:S.some(e=>e.disable);return(0,m.jsxs)(`div`,{className:`univer-pb-4`,children:[S==null?void 0:S.map(e=>{var t;return(0,m.jsx)(Oe,{unitId:v,subUnitId:y,onClick:()=>{e.disable||l.setActiveRule({unitId:v,subUnitId:y,rule:e})},rule:e,disable:(t=e.disable)==null?!1:t},e.uid)}),(0,m.jsxs)(`div`,{className:`univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2`,children:[p.length&&!C?(0,m.jsx)(u.Button,{onClick:x,children:f.t(`dataValidation.panel.removeAll`)}):null,(0,m.jsx)(u.Button,{variant:`primary`,onClick:b,children:f.t(`dataValidation.panel.add`)})]})]})}let Ae=()=>{let e=(0,o.useDependency)(A),n=(0,o.useObservable)(e.activeRule$,e.activeRule),r=(0,o.useDependency)(t.IUniverInstanceService),i=(0,o.useObservable)(()=>r.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_SHEET),void 0,void 0,[]),a=(0,o.useObservable)(()=>{var e;return(e=i==null?void 0:i.activeSheet$)==null?(0,s.of)(null):e},void 0,void 0,[]);return!i||!a?null:n&&(n.subUnitId===a.getSheetId()||n.subUnitId===e.getFocusFormulaEditorActiveRuleSubUnitId())?(0,m.jsx)(De,{},n.rule.uid):(0,m.jsx)(ke,{workbook:i})},je=e=>{let{isTwoFormula:n=!1,value:r,onChange:i,showError:a,validResult:s}=e,c=(0,o.useDependency)(t.LocaleService),l=a?s==null?void 0:s.formula1:``,d=a?s==null?void 0:s.formula2:``;return n?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.FormLayout,{error:l,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:c.t(`dataValidation.panel.formulaPlaceholder`),value:r==null?void 0:r.formula1,onChange:e=>{i==null||i({...r,formula1:e})}})}),(0,m.jsx)(`div`,{className:`-univer-mt-2 univer-mb-1 univer-text-sm univer-text-gray-400`,children:c.t(`dataValidation.panel.formulaAnd`)}),(0,m.jsx)(u.FormLayout,{error:d,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:c.t(`dataValidation.panel.formulaPlaceholder`),value:r==null?void 0:r.formula2,onChange:e=>{i==null||i({...r,formula2:e})}})})]}):(0,m.jsx)(u.FormLayout,{error:l,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:c.t(`dataValidation.panel.formulaPlaceholder`),value:r==null?void 0:r.formula1,onChange:e=>{i==null||i({formula1:e})}})})};function Me(e){let{value:n,onChange:r,showError:i,validResult:a}=e,s=(0,o.useDependency)(t.LocaleService),c=i?a==null?void 0:a.formula1:``,l=i?a==null?void 0:a.formula2:``,[f,p]=(0,d.useState)(!((n==null?void 0:n.formula1)===void 0&&(n==null?void 0:n.formula2)===void 0));return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Checkbox,{checked:f,onChange:e=>{e?p(!0):(p(!1),r==null||r({...n,formula1:void 0,formula2:void 0}))},children:s.t(`dataValidation.checkbox.tips`)})}),f?(0,m.jsx)(u.FormLayout,{label:s.t(`dataValidation.checkbox.checked`),error:c,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:s.t(`dataValidation.panel.valuePlaceholder`),value:n==null?void 0:n.formula1,onChange:e=>{r==null||r({...n,formula1:e||void 0})}})}):null,f?(0,m.jsx)(u.FormLayout,{label:s.t(`dataValidation.checkbox.unchecked`),error:l,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:s.t(`dataValidation.panel.valuePlaceholder`),value:n==null?void 0:n.formula2,onChange:e=>{r==null||r({...n,formula2:e||void 0})}})}):null]})}function Ne(e){var t;let{unitId:n,subUnitId:r,value:i,onChange:a,showError:s,validResult:c}=e,l=s?c==null?void 0:c.formula1:void 0,f=(0,d.useRef)(null),[h,g]=(0,d.useState)(!1);return(0,o.useSidebarClick)(e=>{var t;(t=f.current)!=null&&t.isClickOutSide(e)&&g(!1)}),(0,m.jsx)(u.FormLayout,{error:l,children:(0,m.jsx)(p.FormulaEditor,{ref:f,className:(0,u.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,u.borderClassName),initValue:(t=i==null?void 0:i.formula1)==null?`=`:t,unitId:n,subUnitId:r,isFocus:h,isSupportAcrossSheet:!0,onChange:e=>{let t=(e==null?``:e).trim();t!==(i==null?void 0:i.formula1)&&(a==null||a({...i,formula1:t}))},onFocus:()=>g(!0)})})}let Pe=[`#FFFFFF`,`#FEE7E7`,`#FEF0E6`,`#EFFBD0`,`#E4F4FE`,`#E8ECFD`,`#F1EAFA`,`#FDE8F3`,`#E5E5E5`,`#FDCECE`,`#FDC49B`,`#DEF6A2`,`#9FDAFF`,`#D0D9FB`,`#E3D5F6`,`#FBD0E8`,`#656565`,`#FE4B4B`,`#FF8C51`,`#8BBB11`,`#0B9EFB`,`#3A60F7`,`#9E6DE3`,`#F248A6`],Fe=e=>{let{value:t,onChange:n,disabled:r}=e,[i,a]=(0,d.useState)(!1);return(0,m.jsx)(u.Dropdown,{align:`start`,disabled:r,open:i,onOpenChange:a,overlay:(0,m.jsx)(`div`,{className:`univer-box-border univer-grid univer-w-fit univer-grid-cols-6 univer-flex-wrap univer-gap-2 univer-p-1.5`,children:Pe.map(e=>(0,m.jsx)(`div`,{className:(0,u.clsx)(`univer-box-border univer-size-4 univer-cursor-pointer univer-rounded`,u.borderClassName),style:{background:e},onClick:()=>{n(e),a(!1)}},e))}),children:(0,m.jsxs)(`div`,{className:(0,u.clsx)(`univer-box-border univer-inline-flex univer-h-8 univer-w-16 univer-cursor-pointer univer-items-center univer-justify-between univer-gap-2 univer-rounded-lg univer-bg-white univer-px-2.5 univer-transition-colors univer-duration-200 hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white`,u.borderClassName),children:[(0,m.jsx)(`div`,{className:`univer-box-border univer-size-4 univer-rounded univer-text-base`,style:{background:t}}),(0,m.jsx)(ye,{})]})})},Ie=e=>{let{item:t,commonProps:n,className:r}=e,{onItemChange:i,onItemDelete:a}=n;return(0,m.jsxs)(`div`,{className:(0,u.clsx)(`univer-flex univer-items-center univer-gap-2`,r),children:[!t.isRef&&(0,m.jsx)(`div`,{className:(0,u.clsx)(`univer-cursor-move`,`draggableHandle`),children:(0,m.jsx)(Ce,{})}),(0,m.jsx)(Fe,{value:t.color,onChange:e=>{i(t.id,t.label,e)}}),(0,m.jsx)(u.Input,{disabled:t.isRef,value:t.label,onChange:e=>{i(t.id,e,t.color)}}),t.isRef?null:(0,m.jsx)(`div`,{className:`univer-ml-1 univer-cursor-pointer univer-rounded univer-text-base hover:univer-bg-gray-200`,children:(0,m.jsx)(he,{onClick:()=>a(t.id)})})]})};function Le(e){let{value:n,onChange:r=()=>{},unitId:c,subUnitId:l,validResult:f,showError:h,ruleId:g}=e,{formula1:_=``,formula2:v=``}=n||{},[y,b]=(0,d.useState)(()=>(0,t.isFormulaString)(_)?`1`:`0`),[x,S]=(0,d.useState)(y===`1`?_:`=`),[C,w]=(0,d.useState)(y===`1`?_:`=`),T=(0,o.useDependency)(t.LocaleService),E=(0,o.useDependency)(a.DataValidatorRegistryService),D=(0,o.useDependency)(a.DataValidationModel),O=(0,o.useDependency)(i.DataValidationFormulaController),k=(0,o.useDependency)(A),[j,M]=(0,d.useState)(()=>v.split(`,`)),N=E.getValidatorItem(t.DataValidationType.LIST),[P,F]=(0,d.useState)([]),[I,L]=(0,d.useState)(``),R=h?f==null?void 0:f.formula1:``,z=(0,o.useObservable)((0,d.useMemo)(()=>D.ruleChange$.pipe((0,s.debounceTime)(16)),[])),B=(0,o.useEvent)(r);(0,d.useEffect)(()=>{(async()=>{await new Promise(e=>{setTimeout(()=>e(!0),100)});let e=D.getRuleById(c,l,g);(0,t.isFormulaString)(e==null?void 0:e.formula1)&&N&&e&&F(await N.getListAsync(e,c,l))})()},[D,z,N,g,l,c]),(0,d.useEffect)(()=>{(0,t.isFormulaString)(_)&&_!==C&&(S(_),w(C))},[C,_]);let[V,H]=(0,d.useState)(()=>{let e=y===`1`?[]:(0,i.deserializeListOptions)(_),n=v.split(`,`);return e.map((e,r)=>({label:e,color:n[r]||`#ECECEC`,isRef:!1,id:(0,t.generateRandomId)(4)}))}),U=(e,t,n)=>{let r=V.find(t=>t.id===e);r&&(r.label=t,r.color=n,H([...V]))},W=e=>{let t=V.findIndex(t=>t.id===e);t!==-1&&(V.splice(t,1),H([...V]))},G=v.split(`,`),K=(0,d.useMemo)(()=>P.map((e,t)=>({label:e,color:G[t]||`#ECECEC`,id:`${t}`,isRef:!0})),[G,P]),ee=(e,t,n)=>{let r=[...j];r[+e]=n,M(r),B({formula1:_,formula2:r.join(`,`)})},q=()=>{H([...V,{label:``,color:`#ECECEC`,isRef:!1,id:(0,t.generateRandomId)(4)}])};(0,d.useEffect)(()=>{if(y===`1`)return;let e=new Set,t=[];V.map(e=>({labelList:e.label.split(`,`),item:e})).forEach(({item:n,labelList:r})=>{r.forEach(r=>{e.has(r)||(e.add(r),t.push({label:r,color:n.color}))})}),B({formula1:(0,i.serializeListOptions)(t.map(e=>e.label)),formula2:t.map(e=>e.color===`#ECECEC`?``:e.color).join(`,`)})},[V,B,y,C,j]);let J=(0,o.useEvent)(async e=>{if(!(0,t.isFormulaString)(e)){B==null||B({formula1:``,formula2:v});return}O.getFormulaRefCheck(e)?(B==null||B({formula1:(0,t.isFormulaString)(e)?e:``,formula2:v}),L(``)):(B==null||B({formula1:``,formula2:v}),S(`=`),L(T.t(`dataValidation.validFail.formulaError`)))}),Y=(0,d.useRef)(null),[te,ne]=(0,d.useState)(!1);return(0,o.useSidebarClick)(e=>{var t;(t=Y.current)!=null&&t.isClickOutSide(e)&&ne(!1)}),(0,d.useEffect)(()=>{te?k.setFocusFormulaEditorActiveRuleSubUnitId(l):k.setFocusFormulaEditorActiveRuleSubUnitId(null)},[te,l,k]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.FormLayout,{label:T.t(`dataValidation.list.options`),children:(0,m.jsxs)(u.RadioGroup,{value:y,onChange:e=>{b(e),S(C),e===`1`&&B({formula1:C===`=`?``:C,formula2:j.join(`,`)})},children:[(0,m.jsx)(u.Radio,{value:`0`,children:T.t(`dataValidation.list.customOptions`)}),(0,m.jsx)(u.Radio,{value:`1`,children:T.t(`dataValidation.list.refOptions`)})]})}),y===`1`?(0,m.jsxs)(u.FormLayout,{error:R||I||void 0,children:[(0,m.jsx)(p.FormulaEditor,{ref:Y,className:(0,u.clsx)(`univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent`,u.borderClassName),initValue:x,unitId:c,subUnitId:l,isFocus:te,isSupportAcrossSheet:!0,onFocus:()=>ne(!0),onChange:(e=``)=>{let t=(e==null?``:e).trim();w(t),J(t)}}),K.length>0&&(0,m.jsx)(`div`,{className:`univer-mt-3`,children:K.map(e=>(0,m.jsx)(Ie,{className:`univer-mb-3`,item:e,commonProps:{onItemChange:ee}},e.id))})]}):(0,m.jsx)(u.FormLayout,{error:R,children:(0,m.jsxs)(`div`,{className:`-univer-mt-3`,children:[(0,m.jsx)(u.DraggableList,{list:V,onListChange:H,rowHeight:28,margin:[0,12],draggableHandle:`.draggableHandle`,itemRender:e=>(0,m.jsx)(Ie,{item:e,commonProps:{onItemChange:U,onItemDelete:W}},e.id),idKey:`id`}),(0,m.jsxs)(`a`,{className:`univer-text-primary univer-flex univer-w-fit univer-cursor-pointer univer-flex-row univer-items-center univer-rounded univer-p-1 univer-px-2 univer-text-sm hover:univer-bg-primary-50 dark:hover:!univer-bg-gray-800`,onClick:q,children:[(0,m.jsx)(_e,{className:`univer-mr-1`}),T.t(`dataValidation.list.add`)]})]})})]})}let Re=[[i.CUSTOM_FORMULA_INPUT_NAME,Ne],[i.BASE_FORMULA_INPUT_NAME,je],[i.LIST_FORMULA_INPUT_NAME,Le],[i.CHECKBOX_FORMULA_INPUT_NAME,Me]];function ze(e){var n;let{value:r,onChange:i}=e,a=(0,o.useDependency)(t.LocaleService);return(0,m.jsx)(u.FormLayout,{label:a.t(`dataValidation.renderMode.label`),children:(0,m.jsxs)(u.RadioGroup,{value:`${(n=r.renderMode)==null?t.DataValidationRenderMode.CUSTOM:n}`,onChange:e=>i({...r,renderMode:+e}),children:[(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.CUSTOM}`,children:a.t(`dataValidation.renderMode.chip`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.ARROW}`,children:a.t(`dataValidation.renderMode.arrow`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.TEXT}`,children:a.t(`dataValidation.renderMode.text`)})]})})}ze.componentKey=`LIST_RENDER_MODE_OPTION_INPUT`;function Be(e){var n;let{value:r,onChange:i}=e,a=(0,o.useDependency)(t.LocaleService);return(0,m.jsx)(u.FormLayout,{children:(0,m.jsx)(u.Checkbox,{checked:(n=r.bizInfo)==null?void 0:n.showTime,onChange:e=>{i({...r,bizInfo:{...r.bizInfo,showTime:e}})},children:a.t(`dataValidation.showTime.label`)})})}Be.componentKey=`DATE_SHOW_TIME_OPTION`;let Ve=class{_calc(e,n){var r,i,a;let{vt:o,ht:s}=n||{},c=e.endX-e.startX-12,l=e.endY-e.startY,u=((r=n==null?void 0:n.fs)==null?10:r)*1.6,d=0,f=0;switch(o){case t.VerticalAlign.TOP:f=0;break;case t.VerticalAlign.BOTTOM:f=0+(l-u);break;default:f=0+(l-u)/2;break}switch(s){case t.HorizontalAlign.LEFT:d=6;break;case t.HorizontalAlign.RIGHT:d=6+(c-u);break;default:d=6+(c-u)/2;break}return{left:e.startX+d,top:e.startY+f,width:((i=n==null?void 0:n.fs)==null?10:i)*1.6,height:((a=n==null?void 0:n.fs)==null?10:a)*1.6}}constructor(e,t,n,r,i,a){this._commandService=e,this._univerInstanceService=t,this._formulaService=n,this._themeService=r,this._renderManagerService=i,this._dataValidationModel=a}calcCellAutoHeight(e){var t;let{style:n}=e;return((t=n==null?void 0:n.fs)==null?10:t)*1.6}calcCellAutoWidth(e){var t;let{style:n}=e;return((t=n==null?void 0:n.fs)==null?10:t)*1.6}async _parseFormula(e,n,r){var a,o,s;let{formula1:c=i.CHECKBOX_FORMULA_1,formula2:l=i.CHECKBOX_FORMULA_2}=e,u=await this._formulaService.getRuleFormulaResult(n,r,e.uid),d=(0,i.getFormulaResult)(u==null||(a=u[0])==null||(a=a.result)==null||(a=a[0])==null?void 0:a[0]),f=(0,i.getFormulaResult)(u==null||(o=u[1])==null||(o=o.result)==null||(o=o[0])==null?void 0:o[0]),p=(0,i.isLegalFormulaResult)(String(d))&&(0,i.isLegalFormulaResult)(String(f));return{formula1:(0,t.isFormulaString)(c)?(0,i.getFormulaResult)(u==null||(s=u[0])==null||(s=s.result)==null||(s=s[0])==null?void 0:s[0]):c,formula2:(0,t.isFormulaString)(l)?f:l,isFormulaValid:p}}drawWith(e,t){var r,a,o,s;let{style:c,primaryWithCoord:l,unitId:u,subUnitId:d,worksheet:f,row:p,col:m}=t,h=l.isMergedMainCell?l.mergeInfo:l,g=(0,i.getCellValueOrigin)(f.getCellRaw(p,m)),_=this._dataValidationModel.getRuleByLocation(u,d,p,m);if(!_)return;let v=this._dataValidationModel.getValidator(_.type);if(!v||!((r=v.skipDefaultFontRender)!=null&&r.call(v,_,g,{unitId:u,subUnitId:d,row:p,column:m})))return;let{formula1:y}=v.parseFormulaSync(_,u,d),b=this._calc(h,c),{a:x,d:S}=e.getTransform(),C=(0,n.fixLineWidthByScale)(b.left,x),w=(0,n.fixLineWidthByScale)(b.top,S),T=n.Transform.create().composeMatrix({left:C,top:w,scaleX:1,scaleY:1,angle:0,skewX:0,skewY:0,flipX:!1,flipY:!1}),E=h.endX-h.startX,D=h.endY-h.startY;e.save(),e.beginPath(),e.rect(h.startX,h.startY,E,D),e.clip();let O=T.getMatrix();e.transform(O[0],O[1],O[2],O[3],O[4],O[5]);let k=((a=c==null?void 0:c.fs)==null?10:a)*1.6,A=String(g)===String(y),j=this._themeService.getColorFromTheme(`primary.600`);n.CheckboxShape.drawWith(e,{checked:A,width:k,height:k,fill:(o=c==null||(s=c.cl)==null?void 0:s.rgb)==null?j:o}),e.restore()}isHit(e,t){let n=t.primaryWithCoord.isMergedMainCell?t.primaryWithCoord.mergeInfo:t.primaryWithCoord,r=this._calc(n,t.style),i=r.top,a=r.top+r.height,o=r.left,s=r.left+r.width,{x:c,y:l}=e;return c<=s&&c>=o&&l<=a&&l>=i}async onPointerDown(e,t){var n;if(t.button===2)return;let{primaryWithCoord:a,unitId:o,subUnitId:s,worksheet:c,row:l,col:u}=e,d=(0,i.getCellValueOrigin)(c.getCellRaw(l,u)),f=this._dataValidationModel.getRuleByLocation(o,s,l,u);if(!f)return;let p=this._dataValidationModel.getValidator(f.type);if(!p||!((n=p.skipDefaultFontRender)!=null&&n.call(p,f,d,{unitId:o,subUnitId:s,row:l,column:u})))return;let{formula1:m,formula2:h}=await this._parseFormula(f,o,s),g={range:{startColumn:a.actualColumn,endColumn:a.actualColumn,startRow:a.actualRow,endRow:a.actualRow},value:{v:String(d)===(0,i.transformCheckboxValue)(String(m))?h:m,p:null}};this._commandService.executeCommand(r.SetRangeValuesCommand.id,g)}onPointerEnter(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.POINTER)}onPointerLeave(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.DEFAULT)}};Ve=k([O(0,t.ICommandService),O(1,t.IUniverInstanceService),O(2,(0,t.Inject)(i.DataValidationFormulaService)),O(3,(0,t.Inject)(t.ThemeService)),O(4,(0,t.Inject)(n.IRenderManagerService)),O(5,(0,t.Inject)(i.SheetDataValidationModel))],Ve);let Q=class{constructor(e){this.injector=e,D(this,`canvasRender`,null),D(this,`dropdownType`,void 0),D(this,`optionsInput`,void 0),D(this,`formulaInput`,i.LIST_FORMULA_INPUT_NAME)}};Q=k([O(0,(0,t.Inject)(t.Injector))],Q);var He=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.CHECKBOX),D(this,`canvasRender`,this.injector.createInstance(Ve)),D(this,`formulaInput`,i.CHECKBOX_FORMULA_INPUT_NAME)}},Ue=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.CUSTOM),D(this,`formulaInput`,i.CUSTOM_FORMULA_INPUT_NAME)}},We=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.DATE),D(this,`formulaInput`,`data-validation.formula-input`),D(this,`optionsInput`,Be.componentKey),D(this,`dropdownType`,a.DataValidatorDropdownType.DATE)}},Ge=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.DECIMAL),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}};function Ke(e,t){let r=n.FontCache.getTextSize(e,t),i=r.width+8,{ba:a,bd:o}=r;return{width:i,height:a+o+0,ba:a}}function qe(e,t,n,r){let i=n-26,a=r-12,o=e.map(e=>({layout:Ke(e,t),text:e})),s,c=[];o.forEach(e=>{let{layout:t}=e,{width:n,height:r}=t;!s||s.width+n+4>i?(s={width:n,height:r,items:[{...e,left:0}]},c.push(s)):(s.items.push({...e,left:s.width+4}),s.width=s.width+n+4)});let l=0,u=0;return c.forEach((e,t)=>{u=Math.max(u,e.width),t===c.length-1?l+=e.height:l+=e.height+4}),{lines:c,totalHeight:l,contentWidth:i,contentHeight:a,cellAutoHeight:l+12,calcAutoWidth:u+26}}var Je=class extends n.Shape{static drawWith(e,t){let{fontString:r,info:i,fill:a,color:o}=t,{layout:s,text:c}=i;e.save(),n.Rect.drawWith(e,{width:s.width,height:s.height,radius:8,fill:a||`#ECECEC`}),e.translateWithPrecision(4,s.ba),e.font=r,e.fillStyle=o,e.fillText(c,0,0),e.restore()}};let Ye=new Path2D(`M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z`),Xe=class{constructor(e,t,n,r){this._commandService=e,this._univerInstanceService=t,this._renderManagerService=n,this._dataValidationModel=r,D(this,`zIndex`,void 0),D(this,`_dropdownInfoMap`,new Map)}_ensureMap(e){let t=this._dropdownInfoMap.get(e);return t||(t=new Map,this._dropdownInfoMap.set(e,t)),t}_generateKey(e,t){return`${e}.${t}`}_drawDownIcon(e,n,r,i,a){let o=r-14+4,s=4;switch(a){case t.VerticalAlign.MIDDLE:s=(i-14)/2+4;break;case t.VerticalAlign.BOTTOM:s=i-14+4;break;default:break}e.save(),e.translateWithPrecision(n.startX+o,n.startY+s),e.fillStyle=`#565656`,e.fill(Ye),e.restore()}drawWith(e,r,a,o){var s,c;let{primaryWithCoord:l,row:u,col:d,style:f,data:p,subUnitId:m}=r,h=l.isMergedMainCell?l.mergeInfo:l,{leftOffset:g=0,rightOffset:_=0,topOffset:v=0,downOffset:y=0}=(p==null?void 0:p.fontRenderExtension)||{},b=this._ensureMap(m),x=this._generateKey(u,d),S=l.isMergedMainCell?l.mergeInfo.startRow:u,C=l.isMergedMainCell?l.mergeInfo.startColumn:d,w=this._dataValidationModel.getRuleByLocation(r.unitId,r.subUnitId,S,C);if(!w)return;let T=this._dataValidationModel.getValidator(w.type);if(!T)return;let E={startX:h.startX+g,endX:h.endX-_,startY:h.startY+v,endY:h.endY-y},D=E.endX-E.startX,O=E.endY-E.startY,{cl:k}=f||{},A=(s=typeof k==`object`?k==null?void 0:k.rgb:k)==null?`#000`:s,j=(0,n.getFontStyleString)(f==null?void 0:f),{vt:M,ht:N}=f||{},P=M==null?t.VerticalAlign.MIDDLE:M,F=(c=(0,i.getCellValueOrigin)(p))==null?``:c,I=T.parseCellValue(F),L=T.getListWithColorMap(w),R=qe(I,j,D,O);this._drawDownIcon(e,E,D,O,P),e.save(),e.translateWithPrecision(E.startX,E.startY),e.beginPath(),e.rect(0,0,D-14,O),e.clip(),e.translateWithPrecision(6,6);let z=0;switch(P){case t.VerticalAlign.MIDDLE:z=(R.contentHeight-R.totalHeight)/2;break;case t.VerticalAlign.BOTTOM:z=R.contentHeight-R.totalHeight;break;default:break}e.translateWithPrecision(0,z),R.lines.forEach((n,r)=>{e.save();let{width:i,height:a,items:o}=n,s=0;switch(N){case t.HorizontalAlign.RIGHT:s=R.contentWidth-i;break;case t.HorizontalAlign.CENTER:s=(R.contentWidth-i)/2;break;default:break}e.translate(s,r*(a+4)),o.forEach(t=>{e.save(),e.translateWithPrecision(t.left,0),Je.drawWith(e,{...j,info:t,color:A,fill:L[t.text]}),e.restore()}),e.restore()}),e.restore(),b.set(x,{left:E.startX,top:E.startY,width:R.contentWidth+6+14,height:R.contentHeight+12})}calcCellAutoHeight(e){var t;let{primaryWithCoord:r,style:a,data:o,row:s,col:c}=e,{leftOffset:l=0,rightOffset:u=0,topOffset:d=0,downOffset:f=0}=(o==null?void 0:o.fontRenderExtension)||{},p=r.isMergedMainCell?r.mergeInfo:r,m={startX:p.startX+l,endX:p.endX-u,startY:p.startY+d,endY:p.endY-f},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,s,c);if(!h)return;let g=this._dataValidationModel.getValidator(h.type);if(!g)return;let _=m.endX-m.startX,v=m.endY-m.startY,y=(t=(0,i.getCellValueOrigin)(o))==null?``:t;return qe(g.parseCellValue(y),(0,n.getFontStyleString)(a==null?void 0:a),_,v).cellAutoHeight}calcCellAutoWidth(e){var t;let{primaryWithCoord:r,style:a,data:o,row:s,col:c}=e,{leftOffset:l=0,rightOffset:u=0,topOffset:d=0,downOffset:f=0}=(o==null?void 0:o.fontRenderExtension)||{},p=r.isMergedMainCell?r.mergeInfo:r,m={startX:p.startX+l,endX:p.endX-u,startY:p.startY+d,endY:p.endY-f},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,s,c);if(!h)return;let g=this._dataValidationModel.getValidator(h.type);if(!g)return;let _=m.endX-m.startX,v=m.endY-m.startY,y=(t=(0,i.getCellValueOrigin)(o))==null?``:t;return qe(g.parseCellValue(y),(0,n.getFontStyleString)(a==null?void 0:a),_,v).calcAutoWidth}isHit(e,t){let{primaryWithCoord:n}=t,{endX:r}=n.isMergedMainCell?n.mergeInfo:n,{x:i}=e;return i>=r-14&&i<=r}onPointerDown(e,t){if(t.button===2)return;let{unitId:n,subUnitId:r,row:i,col:a}=e,o={unitId:n,subUnitId:r,row:i,column:a};this._commandService.executeCommand(V.id,o)}onPointerEnter(e,r){var i;return(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null?void 0:i.setCursor(n.CURSOR_TYPE.POINTER)}onPointerLeave(e,r){var i;return(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null?void 0:i.setCursor(n.CURSOR_TYPE.DEFAULT)}};Xe=k([O(0,t.ICommandService),O(1,t.IUniverInstanceService),O(2,(0,t.Inject)(n.IRenderManagerService)),O(3,(0,t.Inject)(i.SheetDataValidationModel))],Xe);var Ze=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.LIST_MULTIPLE),D(this,`canvasRender`,this.injector.createInstance(Xe)),D(this,`dropdownType`,a.DataValidatorDropdownType.MULTIPLE_LIST)}};let Qe=new Path2D(`M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z`);function $e(e,n,r,i,a,o,s=!0){let c=0,l=s?3:0;switch(a){case t.VerticalAlign.BOTTOM:c=n-i-l;break;case t.VerticalAlign.MIDDLE:c=(n-i)/2;break;default:c=l;break}c=Math.max(3,c);let u=0;switch(o){case t.HorizontalAlign.CENTER:u=(e-r)/2;break;case t.HorizontalAlign.RIGHT:u=e-r;break;default:break}return u=Math.max(6,u),{paddingLeft:u,paddingTop:c}}let et=class{constructor(e,t,n,r,i){this._univerInstanceService=e,this._localeService=t,this._commandService=n,this._renderManagerService=r,this._dataValidationModel=i,D(this,`_dropdownInfoMap`,new Map),D(this,`zIndex`,void 0)}_ensureMap(e){let t=this._dropdownInfoMap.get(e);return t||(t=new Map,this._dropdownInfoMap.set(e,t)),t}_generateKey(e,t){return`${e}.${t}`}_drawDownIcon(e,n,r,i,a,o,s){let{t:c=t.DEFAULT_STYLES.pd.t,b:l=t.DEFAULT_STYLES.pd.b}=s,u=r-14,d;switch(o){case t.VerticalAlign.MIDDLE:d=(i-4)/2;break;case t.VerticalAlign.BOTTOM:d=i-l-a-3+(a/2-4/2);break;default:d=c+3+(a/2-4/2);break}e.save(),e.translateWithPrecision(n.startX+u,n.startY+d),e.fillStyle=`#565656`,e.fill(Qe),e.restore()}drawWith(e,r,a){var o,s,c,l;let{primaryWithCoord:u,row:d,col:f,style:p,data:m,subUnitId:h}=r,g=u.isMergedMainCell?u.mergeInfo:u,_=u.isMergedMainCell?u.mergeInfo.startRow:d,v=u.isMergedMainCell?u.mergeInfo.startColumn:f,y=this._dataValidationModel.getRuleByLocation(r.unitId,r.subUnitId,_,v);if(!y)return;let b=this._dataValidationModel.getValidator(y.type);if(!b)return;let{leftOffset:x=0,rightOffset:S=0,topOffset:C=0,downOffset:w=0}=(m==null?void 0:m.fontRenderExtension)||{};if(!y||!b||!b||b.id.indexOf(t.DataValidationType.LIST)!==0||!b.skipDefaultFontRender(y))return;let T={startX:g.startX+x,endX:g.endX-S,startY:g.startY+C,endY:g.endY-w},E=T.endX-T.startX,D=T.endY-T.startY,O=this._ensureMap(h),k=this._generateKey(d,f),A=b.getListWithColorMap(y),j=(0,i.getCellValueOrigin)(m),M=`${j==null?``:j}`,N=A[M],{tb:P,vt:F,ht:I,pd:L}=p||{};P=(o=P)==null?t.WrapStrategy.WRAP:o,F=(s=F)==null?t.VerticalAlign.BOTTOM:s,I=(c=I)==null?t.DEFAULT_STYLES.ht:c,L=(l=L)==null?t.DEFAULT_STYLES.pd:l;let R=(0,n.getFontStyleString)(p).fontCache;if(y.renderMode===t.DataValidationRenderMode.ARROW){var z,B,V;let{l:r=t.DEFAULT_STYLES.pd.l,t:i=t.DEFAULT_STYLES.pd.t,r:o=t.DEFAULT_STYLES.pd.r,b:s=t.DEFAULT_STYLES.pd.b}=L,c=E-r-o-14-4,l=new n.DocSimpleSkeleton(M,R,P===t.WrapStrategy.WRAP,c,1/0);l.calculate();let u=l.getTotalWidth(),d=l.getTotalHeight(),{paddingTop:f,paddingLeft:m}=$e(c,D-i-s,u,d,F,I,!0);this._drawDownIcon(e,T,E,D,d,F,L),e.save(),e.translateWithPrecision(T.startX+r,T.startY+i),e.beginPath(),e.rect(0,0,E-r-o,D-i-s),e.clip(),e.translateWithPrecision(0,f),e.save(),e.translateWithPrecision(m,0),e.beginPath(),e.rect(0,0,c,d),e.clip(),n.Text.drawWith(e,{text:M,fontStyle:R,width:c,height:d,color:p==null||(z=p.cl)==null?void 0:z.rgb,strokeLine:!!(!(p==null||(B=p.st)==null)&&B.s),underline:!!(!(p==null||(V=p.ul)==null)&&V.s),warp:P===t.WrapStrategy.WRAP,hAlign:t.HorizontalAlign.LEFT},l),e.restore(),e.restore(),O.set(k,{left:T.endX-14+a.rowHeaderWidth,top:T.startY+i+a.columnHeaderHeight,width:14,height:D-i-s})}else{var H,U,W;e.save(),e.translateWithPrecision(T.startX,T.startY),e.beginPath(),e.rect(0,0,E,D),e.clip();let r=E-12-4-14-4,i=new n.DocSimpleSkeleton(M,R,P===t.WrapStrategy.WRAP,r,1/0);i.calculate();let o=i.getTotalWidth(),s=i.getTotalHeight(),c=s+2,l=Math.max(E-12,1),{paddingTop:u}=$e(l,D,o,c,F,I);e.translateWithPrecision(6,u),n.Rect.drawWith(e,{width:l,height:c,fill:N||`#ECECEC`,radius:8}),e.save(),e.translateWithPrecision(4,1),e.beginPath(),e.rect(0,0,r,s),e.clip(),n.Text.drawWith(e,{text:M,fontStyle:R,width:r,height:s,color:p==null||(H=p.cl)==null?void 0:H.rgb,strokeLine:!!(!(p==null||(U=p.st)==null)&&U.s),underline:!!(!(p==null||(W=p.ul)==null)&&W.s),warp:P===t.WrapStrategy.WRAP,hAlign:t.HorizontalAlign.LEFT},i),e.restore(),e.translateWithPrecision(r+4+4,(s-4)/2),e.fillStyle=`#565656`,e.fill(Qe),e.restore(),O.set(k,{left:T.startX+6+a.rowHeaderWidth,top:T.startY+u+a.columnHeaderHeight,width:l,height:c})}}calcCellAutoHeight(e){var r;let{primaryWithCoord:a,style:o,data:s,row:c,col:l}=e,u=a.isMergedMainCell?a.mergeInfo:a,{leftOffset:d=0,rightOffset:f=0,topOffset:p=0,downOffset:m=0}=(s==null?void 0:s.fontRenderExtension)||{},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,c,l);if(!h||h.renderMode===t.DataValidationRenderMode.TEXT)return;let g={startX:u.startX+d,endX:u.endX-f,startY:u.startY+p,endY:u.endY-m},_=g.endX-g.startX,v=(0,i.getCellValueOrigin)(s),y=`${v==null?``:v}`,{tb:b,pd:x}=o||{},{t:S=t.DEFAULT_STYLES.pd.t,b:C=t.DEFAULT_STYLES.pd.b}=x==null?{}:x;if(b=(r=b)==null?t.WrapStrategy.WRAP:r,h.renderMode===t.DataValidationRenderMode.ARROW){let{l:e=t.DEFAULT_STYLES.pd.l,r=t.DEFAULT_STYLES.pd.r}=x==null?{}:x,i=_-e-r-14-4,a=new n.DocSimpleSkeleton(y,(0,n.getFontStyleString)(o).fontCache,b===t.WrapStrategy.WRAP,i,1/0);return a.calculate(),a.getTotalHeight()+S+C+6}else{let e=Math.max(_-12-4-14-4,10),r=new n.DocSimpleSkeleton(y,(0,n.getFontStyleString)(o).fontCache,b===t.WrapStrategy.WRAP,e,1/0);return r.calculate(),r.getTotalHeight()+6+2}}calcCellAutoWidth(e){var r;let{primaryWithCoord:a,style:o,data:s,row:c,col:l}=e,u=a.isMergedMainCell?a.mergeInfo:a,{leftOffset:d=0,rightOffset:f=0,topOffset:p=0,downOffset:m=0}=(s==null?void 0:s.fontRenderExtension)||{},h=this._dataValidationModel.getRuleByLocation(e.unitId,e.subUnitId,c,l);if(!h||h.renderMode===t.DataValidationRenderMode.TEXT)return;let g={startX:u.startX+d,endX:u.endX-f,startY:u.startY+p,endY:u.endY-m},_=g.endX-g.startX,v=(0,i.getCellValueOrigin)(s),y=`${v==null?``:v}`,{tb:b,pd:x}=o||{},{l:S=t.DEFAULT_STYLES.pd.l,r:C=t.DEFAULT_STYLES.pd.r}=x==null?{}:x;b=(r=b)==null?t.WrapStrategy.WRAP:r;let w=26;switch(h.renderMode){case t.DataValidationRenderMode.ARROW:w=18+C+S;break;case t.DataValidationRenderMode.CUSTOM:w=34+C+S+8/2+1;break;default:w=34+C+S+8/2+1}let T=_-w,E=new n.DocSimpleSkeleton(y,(0,n.getFontStyleString)(o).fontCache,b===t.WrapStrategy.WRAP,T,1/0);return E.calculate(),E.getTotalWidth()+w}isHit(e,n){let{subUnitId:r,row:i,col:a}=n,o=this._ensureMap(r).get(this._generateKey(i,a)),s=this._dataValidationModel.getRuleByLocation(n.unitId,n.subUnitId,i,a);if(!s||!o||s.renderMode===t.DataValidationRenderMode.TEXT)return!1;let{top:c,left:l,width:u,height:d}=o,{x:f,y:p}=e;return f>=l&&f<=l+u&&p>=c&&p<=c+d}onPointerDown(e,t){if(t.button===2)return;let{unitId:n,subUnitId:r,row:i,col:a}=e,o={unitId:n,subUnitId:r,row:i,column:a};this._commandService.executeCommand(V.id,o)}onPointerEnter(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.POINTER)}onPointerLeave(e,r){var i;(i=(0,n.getCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_SHEET,this._univerInstanceService,this._renderManagerService))==null||(i=i.mainComponent)==null||i.setCursor(n.CURSOR_TYPE.DEFAULT)}};et=k([O(0,t.IUniverInstanceService),O(1,(0,t.Inject)(t.LocaleService)),O(2,t.ICommandService),O(3,(0,t.Inject)(n.IRenderManagerService)),O(4,(0,t.Inject)(i.SheetDataValidationModel))],et);var tt=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.LIST),D(this,`canvasRender`,this.injector.createInstance(et)),D(this,`dropdownType`,a.DataValidatorDropdownType.LIST),D(this,`optionsInput`,ze.componentKey),D(this,`formulaInput`,i.LIST_FORMULA_INPUT_NAME)}},nt=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.TEXT_LENGTH),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}},rt=class extends Q{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.WHOLE),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}};let it=class extends t.RxDisposable{constructor(e,t,n){super(),this._injector=e,this._componentManger=t,this._dataValidatorRegistryService=n,this._initComponents(),this._registerValidatorViews()}_initComponents(){[[`DataValidationIcon`,pe],[L,Ae],[ze.componentKey,ze],[Be.componentKey,Be],...Re].forEach(([e,t])=>{this.disposeWithMe(this._componentManger.register(e,t))})}_registerValidatorViews(){[Ge,rt,nt,We,He,tt,Ze,Ue].forEach(e=>{let t=this._injector.createInstance(e),n=this._dataValidatorRegistryService.getValidatorItem(t.id);n&&(n.formulaInput=t.formulaInput,n.canvasRender=t.canvasRender,n.dropdownType=t.dropdownType,n.optionsInput=t.optionsInput)})}};it=k([O(0,(0,t.Inject)(t.Injector)),O(1,(0,t.Inject)(o.ComponentManager)),O(2,(0,t.Inject)(a.DataValidatorRegistryService))],it);let $=class extends t.Plugin{constructor(e=M,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},M,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(j,o)}onStarting(){[[A],[I],[G],[K],[X],[J],[q],[it]].forEach(e=>{this._injector.add(e)}),[U,V,H,z,R,B].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(q),this._injector.get(J),this._injector.get(n.IRenderManagerService).registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[se])}onRendered(){this._injector.get(it),this._injector.get(X)}onSteady(){this._injector.get(K)}};D($,`pluginName`,`SHEET_DATA_VALIDATION_UI_PLUGIN`),D($,`packageName`,S),D($,`version`,C),D($,`type`,t.UniverInstanceType.UNIVER_SHEET),$=k([O(1,(0,t.Inject)(t.Injector)),O(2,t.ICommandService),O(3,t.IConfigService)],$);let at=class extends t.Plugin{constructor(e=M,n,r,i){super(),this._config=e,this._injector=n,this._commandService=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},M,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(j,o)}onStarting(){[[A],[I],[G],[K],[X],[J],[q],[N],[it]].forEach(e=>{this._injector.add(e)}),[U,V,H,z,R,B].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(q),this._injector.get(J),this._injector.get(N),this._injector.get(G),this._injector.get(n.IRenderManagerService).registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[se])}onRendered(){this._injector.get(it),this._injector.get(X)}onSteady(){this._injector.get(K)}};D(at,`pluginName`,`SHEET_DATA_VALIDATION_UI_PLUGIN`),D(at,`packageName`,S),D(at,`version`,C),D(at,`type`,t.UniverInstanceType.UNIVER_SHEET),at=k([(0,t.DependentOn)(i.UniverSheetsDataValidationPlugin),O(1,(0,t.Inject)(t.Injector)),O(2,t.ICommandService),O(3,t.IConfigService)],at),Object.defineProperty(e,`BaseSheetDataValidatorView`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,`UniverSheetsDataValidationMobileUIPlugin`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,`UniverSheetsDataValidationUIPlugin`,{enumerable:!0,get:function(){return at}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-data-validation-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Data validation UI for Univer Sheets",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -55,26 +55,26 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@univerjs/icons": "^1.1.1",
|
|
58
|
-
"@univerjs/core": "0.
|
|
59
|
-
"@univerjs/design": "0.
|
|
60
|
-
"@univerjs/engine-formula": "0.
|
|
61
|
-
"@univerjs/data-validation": "0.
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/
|
|
64
|
-
"@univerjs/sheets-
|
|
65
|
-
"@univerjs/sheets-
|
|
66
|
-
"@univerjs/sheets-ui": "0.
|
|
67
|
-
"@univerjs/ui": "0.
|
|
68
|
-
"@univerjs/sheets-
|
|
58
|
+
"@univerjs/core": "0.19.0",
|
|
59
|
+
"@univerjs/design": "0.19.0",
|
|
60
|
+
"@univerjs/engine-formula": "0.19.0",
|
|
61
|
+
"@univerjs/data-validation": "0.19.0",
|
|
62
|
+
"@univerjs/engine-render": "0.19.0",
|
|
63
|
+
"@univerjs/sheets": "0.19.0",
|
|
64
|
+
"@univerjs/sheets-formula-ui": "0.19.0",
|
|
65
|
+
"@univerjs/sheets-numfmt": "0.19.0",
|
|
66
|
+
"@univerjs/sheets-ui": "0.19.0",
|
|
67
|
+
"@univerjs/ui": "0.19.0",
|
|
68
|
+
"@univerjs/sheets-data-validation": "0.19.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"postcss": "^8.5.8",
|
|
72
72
|
"react": "18.3.1",
|
|
73
73
|
"rxjs": "^7.8.2",
|
|
74
74
|
"tailwindcss": "3.4.18",
|
|
75
|
-
"typescript": "^
|
|
76
|
-
"vitest": "^4.1.
|
|
77
|
-
"@univerjs-infra/shared": "0.
|
|
75
|
+
"typescript": "^6.0.2",
|
|
76
|
+
"vitest": "^4.1.1",
|
|
77
|
+
"@univerjs-infra/shared": "0.19.0"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"dev": "vite",
|