@univerjs/sheets-data-validation-ui 0.24.0 → 0.25.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.
Files changed (91) hide show
  1. package/lib/cjs/index.js +116 -112
  2. package/lib/cjs/locale/ar-SA.js +94 -0
  3. package/lib/cjs/locale/ca-ES.js +6 -86
  4. package/lib/cjs/locale/de-DE.js +94 -0
  5. package/lib/cjs/locale/en-US.js +6 -86
  6. package/lib/cjs/locale/es-ES.js +6 -86
  7. package/lib/cjs/locale/fa-IR.js +6 -86
  8. package/lib/cjs/locale/fr-FR.js +6 -86
  9. package/lib/cjs/locale/id-ID.js +94 -0
  10. package/lib/cjs/locale/it-IT.js +94 -0
  11. package/lib/cjs/locale/ja-JP.js +6 -86
  12. package/lib/cjs/locale/ko-KR.js +6 -86
  13. package/lib/cjs/locale/pl-PL.js +94 -0
  14. package/lib/cjs/locale/pt-BR.js +94 -0
  15. package/lib/cjs/locale/ru-RU.js +6 -86
  16. package/lib/cjs/locale/sk-SK.js +6 -86
  17. package/lib/cjs/locale/vi-VN.js +6 -86
  18. package/lib/cjs/locale/zh-CN.js +6 -86
  19. package/lib/cjs/locale/zh-HK.js +94 -0
  20. package/lib/cjs/locale/zh-TW.js +6 -86
  21. package/lib/es/index.js +117 -113
  22. package/lib/es/locale/ar-SA.js +93 -0
  23. package/lib/es/locale/ca-ES.js +6 -86
  24. package/lib/es/locale/de-DE.js +93 -0
  25. package/lib/es/locale/en-US.js +6 -86
  26. package/lib/es/locale/es-ES.js +6 -86
  27. package/lib/es/locale/fa-IR.js +6 -86
  28. package/lib/es/locale/fr-FR.js +6 -86
  29. package/lib/es/locale/id-ID.js +93 -0
  30. package/lib/es/locale/it-IT.js +93 -0
  31. package/lib/es/locale/ja-JP.js +6 -86
  32. package/lib/es/locale/ko-KR.js +6 -86
  33. package/lib/es/locale/pl-PL.js +93 -0
  34. package/lib/es/locale/pt-BR.js +93 -0
  35. package/lib/es/locale/ru-RU.js +6 -86
  36. package/lib/es/locale/sk-SK.js +6 -86
  37. package/lib/es/locale/vi-VN.js +6 -86
  38. package/lib/es/locale/zh-CN.js +6 -86
  39. package/lib/es/locale/zh-HK.js +93 -0
  40. package/lib/es/locale/zh-TW.js +6 -86
  41. package/lib/index.css +0 -4
  42. package/lib/index.js +117 -113
  43. package/lib/locale/ar-SA.js +93 -0
  44. package/lib/locale/ca-ES.js +6 -86
  45. package/lib/locale/de-DE.js +93 -0
  46. package/lib/locale/en-US.js +6 -86
  47. package/lib/locale/es-ES.js +6 -86
  48. package/lib/locale/fa-IR.js +6 -86
  49. package/lib/locale/fr-FR.js +6 -86
  50. package/lib/locale/id-ID.js +93 -0
  51. package/lib/locale/it-IT.js +93 -0
  52. package/lib/locale/ja-JP.js +6 -86
  53. package/lib/locale/ko-KR.js +6 -86
  54. package/lib/locale/pl-PL.js +93 -0
  55. package/lib/locale/pt-BR.js +93 -0
  56. package/lib/locale/ru-RU.js +6 -86
  57. package/lib/locale/sk-SK.js +6 -86
  58. package/lib/locale/vi-VN.js +6 -86
  59. package/lib/locale/zh-CN.js +6 -86
  60. package/lib/locale/zh-HK.js +93 -0
  61. package/lib/locale/zh-TW.js +6 -86
  62. package/lib/types/locale/ar-SA.d.ts +18 -0
  63. package/lib/types/locale/de-DE.d.ts +18 -0
  64. package/lib/types/locale/en-US.d.ts +6 -78
  65. package/lib/types/locale/id-ID.d.ts +18 -0
  66. package/lib/types/locale/it-IT.d.ts +18 -0
  67. package/lib/types/locale/pl-PL.d.ts +18 -0
  68. package/lib/types/locale/pt-BR.d.ts +18 -0
  69. package/lib/types/locale/zh-HK.d.ts +18 -0
  70. package/lib/types/views/components/formula-input/utils.d.ts +24 -0
  71. package/lib/umd/index.js +1 -1
  72. package/lib/umd/locale/ar-SA.js +1 -0
  73. package/lib/umd/locale/ca-ES.js +1 -1
  74. package/lib/umd/locale/de-DE.js +1 -0
  75. package/lib/umd/locale/en-US.js +1 -1
  76. package/lib/umd/locale/es-ES.js +1 -1
  77. package/lib/umd/locale/fa-IR.js +1 -1
  78. package/lib/umd/locale/fr-FR.js +1 -1
  79. package/lib/umd/locale/id-ID.js +1 -0
  80. package/lib/umd/locale/it-IT.js +1 -0
  81. package/lib/umd/locale/ja-JP.js +1 -1
  82. package/lib/umd/locale/ko-KR.js +1 -1
  83. package/lib/umd/locale/pl-PL.js +1 -0
  84. package/lib/umd/locale/pt-BR.js +1 -0
  85. package/lib/umd/locale/ru-RU.js +1 -1
  86. package/lib/umd/locale/sk-SK.js +1 -1
  87. package/lib/umd/locale/vi-VN.js +1 -1
  88. package/lib/umd/locale/zh-CN.js +1 -1
  89. package/lib/umd/locale/zh-HK.js +1 -0
  90. package/lib/umd/locale/zh-TW.js +1 -1
  91. package/package.json +15 -15
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type enUS from './en-US';
17
+ declare const locale: typeof enUS;
18
+ export default locale;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type enUS from './en-US';
17
+ declare const locale: typeof enUS;
18
+ export default locale;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type enUS from './en-US';
17
+ declare const locale: typeof enUS;
18
+ export default locale;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ interface ICustomListItem {
17
+ color: string;
18
+ label: string;
19
+ }
20
+ export declare function buildCustomListFormulaPayload(items: ICustomListItem[], defaultColor: string): {
21
+ formula1: string;
22
+ formula2: string;
23
+ };
24
+ export {};
package/lib/umd/index.js CHANGED
@@ -1 +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,1);var S=`@univerjs/sheets-data-validation-ui`,C=`0.24.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.dateKit)();if(typeof e==`number`||!Number.isNaN(+e))return(0,t.dateKit)(t.numfmt.format(`yyyy-MM-dd HH:mm:ss`,Number(e)));let n=(0,t.dateKit)(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.getCurrentUnitOfType(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.getCurrentUnitOfType(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$)]);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:e=>{g.executeCommand(i.RemoveSheetDataValidationCommand.id,{ruleId:n.uid,unitId:s,subUnitId:c}),e.stopPropagation()},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.getCurrentUnitOfType(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(0,t.awaitTime)(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}})});
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,1);var S=`@univerjs/sheets-data-validation-ui`,C=`0.25.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`,M={},ee=`#ECECEC`,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(`sheets-data-validation-ui.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(`sheets-data-validation-ui.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(`sheets-data-validation-ui.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(`sheets-data-validation-ui.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.dateKit)();if(typeof e==`number`||!Number.isNaN(+e))return(0,t.dateKit)(t.numfmt.format(`yyyy-MM-dd HH:mm:ss`,Number(e)));let n=(0,t.dateKit)(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.getCurrentUnitOfType(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=>{var i;let a=e?(0,r.serializeListOptions)(t):(i=t[0])==null?``:i,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?`sheets-data-validation-ui.panel.addTitle`:`sheets-data-validation-ui.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}},te={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}},B={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}},V={type:t.CommandType.OPERATION,id:`sheet.operation.hide-data-validation-dropdown`,handler(e,t){return t?(e.get(I).hideDropdown(),!0):!1}},H={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}},U=`SHEET_DATA_VALIDATION_ALERT`,W=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(U);return}if(this._dataValidationModel.validator(a,{...e.location,workbook:r,worksheet:i})===t.DataValidationStatus.INVALID){var n;let t=this._cellAlertManagerService.currentAlert.get(U),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(U);return}let i=this._dataValidationModel.getValidator(a.type);if(!i){this._cellAlertManagerService.removeAlert(U);return}this._cellAlertManagerService.showAlert({type:l.CellAlertType.ERROR,title:this._localeService.t(`sheets-data-validation-ui.error.title`),message:i==null?void 0:i.getRuleFinalError(a,e.location),location:e.location,width:200,height:74,key:U});return}}this._cellAlertManagerService.removeAlert(U)}))}_initZenService(){this.disposeWithMe(this._zenZoneService.visible$.subscribe(e=>{e&&this._cellAlertManagerService.removeAlert(U)}))}};W=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))],W);let G=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))}};G=k([O(0,r.IAutoFillService),O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(t.Injector))],G);let ne=[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],K=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||ne.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:_}}}};K=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))],K);let q=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(`sheets-data-validation-ui.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(`sheets-data-validation-ui.permission.dialog.setStyleErr`))}}))}};q=k([O(0,(0,t.Inject)(t.LocaleService)),O(1,t.ICommandService),O(2,(0,t.Inject)(r.SheetPermissionCheckController))],q);let re=`sheet.menu.data-validation`;function J(e){return{id:re,type:o.MenuItemType.SUBITEMS,icon:`DataValidationIcon`,tooltip:`sheets-data-validation-ui.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 ie(e){return{id:R.id,title:`sheets-data-validation-ui.panel.title`,type:o.MenuItemType.BUTTON}}function ae(e){return{id:H.id,title:`sheets-data-validation-ui.panel.add`,type:o.MenuItemType.BUTTON}}let oe={[o.RibbonDataGroup.RULES]:{[re]:{order:0,menuItemFactory:J,[R.id]:{order:0,menuItemFactory:ie},[H.id]:{order:1,menuItemFactory:ae}}}},se={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(oe)}_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?se: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 ce=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?se: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)})}};ce=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))],ce);let le=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()}))}};le=k([O(1,(0,t.Inject)(i.SheetDataValidationModel)),O(2,(0,t.Inject)(l.SheetSkeletonManagerService))],le);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)(`_${pe()}`);return ue(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function ue(e,t,n,r,i){return(0,d.createElement)(e.tag,{key:t,...de(e,n,i),...r},(fe(e,n).children||[]).map((r,a)=>ue(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function de(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 fe(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 pe(){return Math.random().toString(36).substring(2,8)}X.displayName=`UniverIcon`;let me={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`}}]},he=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`data-validation-icon`,ref:t,icon:me}))});he.displayName=`DataValidationIcon`;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:`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`}}]},_e=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`delete-icon`,ref:t,icon:ge}))});_e.displayName=`DeleteIcon`;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:`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`}}]},ye=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`increase-icon`,ref:t,icon:ve}))});ye.displayName=`IncreaseIcon`;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:`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`}}]},xe=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`more-down-icon`,ref:t,icon:be}))});xe.displayName=`MoreDownIcon`;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:`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`}}]},Ce=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`more-up-icon`,ref:t,icon:Se}))});Ce.displayName=`MoreUpIcon`;let we={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`}}]},Te=(0,d.forwardRef)(function(e,t){return(0,d.createElement)(X,Object.assign({},e,{id:`sequence-icon`,ref:t,icon:we}))});Te.displayName=`SequenceIcon`;function Ee(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(`sheets-data-validation-ui.panel.options`),l?(0,m.jsx)(Ce,{className:`univer-ml-1`}):(0,m.jsx)(xe,{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(`sheets-data-validation-ui.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(`sheets-data-validation-ui.panel.showWarning`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationErrorStyle.STOP}`,children:r.t(`sheets-data-validation-ui.panel.rejectInput`)})]})}),(0,m.jsx)(u.FormLayout,{label:r.t(`sheets-data-validation-ui.panel.messageInfo`),children:(0,m.jsx)(u.Checkbox,{checked:a.showErrorMessage,onChange:()=>s({...a,showErrorMessage:!a.showErrorMessage}),children:r.t(`sheets-data-validation-ui.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 De=e=>(0,t.debounce)(async(t,n,r,i)=>{let a=await e.executeCommand(t,n,r);i==null||i(a)},1e3);function Oe(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.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_SHEET))==null||(i=i.getSheetBySheetName(r))==null?void 0:i.getSheetId())||``}function ke(){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,ee]=(0,d.useState)(!1),N=b.getValidatorsByScope(a.DataValidatorRegistryScope.SHEET),[P,F]=(0,d.useState)(()=>O.ranges.map(e=>({unitId:``,sheetId:``,range:e}))),I=(0,d.useMemo)(()=>De(C),[C]),[L,R]=(0,d.useState)(!1),[z,te]=(0,d.useState)(!1),B=(0,d.useRef)(null),V=(0,o.useDependency)(r.SheetsSelectionsService);if((0,d.useEffect)(()=>()=>{let e=V.getCurrentLastSelection();e&&V.setSelections([e])},[V]),(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),F(e.ranges.map(e=>({unitId:``,sheetId:``,range:e}))))},20)})},[C,w,y,_,g]),!j)return null;let H=j.operators,U=j.operatorNames,W=O.operator?a.TWO_FORMULA_OPERATOR_COUNT.includes(O.operator):!1,G=()=>{(D==null?void 0:D.getSheetId())!==_&&C.syncExecuteCommand(r.SetWorksheetActiveOperation.id,{unitId:g,subUnitId:_})},ne=()=>{var e;if(!((e=B.current)==null||(e=e.editor)==null)&&e.isFocus()){var t;K((t=B.current)==null?void 0:t.getValue())}!O.ranges.length||L||(j.validatorFormula(O,g,_).success?h.setActiveRule(null):ee(!0),G())},K=(0,o.useEvent)(e=>{let n=e.split(`,`).filter(Boolean).map(f.deserializeRangeWithSheet).map(e=>{let t=e.sheetName;if(t){let n=Oe(x,e.unitId,t);return{...e,sheetId:n}}return{...e,sheetId:``}});if((0,t.isUnitRangesEqual)(n,P))return;F(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};I(i.UpdateSheetDataValidationRangeCommand.id,a)}),q=e=>{if((0,t.shallowEqual)(e,(0,a.getRuleSetting)(O)))return;k({...O,...e});let n={unitId:g,subUnitId:_,ruleId:y,setting:e};I(i.UpdateSheetDataValidationSettingCommand.id,n,void 0)},re=async()=>{await C.executeCommand(i.RemoveSheetDataValidationCommand.id,{ruleId:y,unitId:g,subUnitId:_}),h.setActiveRule(null),G()},J={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),oe=(0,d.useMemo)(()=>P.map(e=>(0,f.serializeRange)(e.range)).join(`,`),[]),se=(0,a.getRuleOptions)(O),Y=e=>{(0,t.shallowEqual)(e,(0,a.getRuleOptions)(O))||(k({...O,...e}),I(i.UpdateSheetDataValidationOptionsCommand.id,{unitId:g,subUnitId:_,ruleId:y,options:e}))},ce=H.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(`sheets-data-validation-ui.panel.range`),error:!O.ranges.length||L?T.t(`sheets-data-validation-ui.panel.rangeError`):``,children:(0,m.jsx)(p.RangeSelector,{selectorRef:B,unitId:g,subUnitId:_,initialValue:oe,onChange:(e,t)=>{var n;!z&&(n=B.current)!=null&&n.verify()&&K(t)},onFocusChange:(e,t)=>{var n;te(e),!e&&t&&(n=B.current)!=null&&n.verify()&&K(t)},onVerify:e=>R(!e)})}),(0,m.jsx)(u.FormLayout,{label:T.t(`sheets-data-validation-ui.panel.type`),children:(0,m.jsx)(u.Select,{className:`univer-w-full`,value:O.type,options:N==null||(e=N.sort((e,t)=>e.order-t.order))==null?void 0:e.map(e=>({label:T.t(e.title),value:e.id})),onChange:ie})}),H!=null&&H.length?(0,m.jsx)(u.FormLayout,{label:T.t(`sheets-data-validation-ui.panel.operator`),children:(0,m.jsx)(u.Select,{className:`univer-w-full`,value:`${O.operator}`,options:[{value:``,label:T.t(`data-validation.operators.legal`)},...H.map((e,t)=>({value:`${e}`,label:U[t]}))],onChange:e=>{q({...J,operator:e})}})}):null,ae&&!ce?(0,m.jsx)(ae,{isTwoFormula:W,value:{formula1:O.formula1,formula2:O.formula2},onChange:e=>{q({...J,...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 q({...J,allowBlank:!((e=O.allowBlank)==null||e)})},children:T.t(`sheets-data-validation-ui.panel.allowBlank`)})}),(0,m.jsx)(Ee,{value:se,onChange:Y,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:re,children:T.t(`sheets-data-validation-ui.panel.removeRule`)}),(0,m.jsx)(u.Button,{className:`univer-ml-3`,variant:`primary`,onClick:ne,children:T.t(`sheets-data-validation-ui.panel.done`)})]})]})}let Ae=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$)]);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:e=>{g.executeCommand(i.RemoveSheetDataValidationCommand.id,{ruleId:n.uid,unitId:s,subUnitId:c}),e.stopPropagation()},children:(0,m.jsx)(_e,{})}):null]})};function je(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.getCurrentUnitOfType(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)(Ae,{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(`sheets-data-validation-ui.panel.removeAll`)}):null,(0,m.jsx)(u.Button,{variant:`primary`,onClick:b,children:f.t(`sheets-data-validation-ui.panel.add`)})]})]})}let Me=()=>{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)(ke,{},n.rule.uid):(0,m.jsx)(je,{workbook:i})},Ne=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(`sheets-data-validation-ui.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(`sheets-data-validation-ui.panel.formulaAnd`)}),(0,m.jsx)(u.FormLayout,{error:d,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:c.t(`sheets-data-validation-ui.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(`sheets-data-validation-ui.panel.formulaPlaceholder`),value:r==null?void 0:r.formula1,onChange:e=>{i==null||i({formula1:e})}})})};function Pe(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(`sheets-data-validation-ui.checkbox.tips`)})}),f?(0,m.jsx)(u.FormLayout,{label:s.t(`sheets-data-validation-ui.checkbox.checked`),error:c,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:s.t(`sheets-data-validation-ui.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(`sheets-data-validation-ui.checkbox.unchecked`),error:l,children:(0,m.jsx)(u.Input,{className:`univer-w-full`,placeholder:s.t(`sheets-data-validation-ui.panel.valuePlaceholder`),value:n==null?void 0:n.formula2,onChange:e=>{r==null||r({...n,formula2:e||void 0})}})}):null]})}function Fe(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)})})}function Ie(e,t){let n=new Set,i=[];return e.forEach(e=>{!e.label||n.has(e.label)||(n.add(e.label),i.push(e))}),{formula1:(0,r.serializeListOptions)(i.map(e=>e.label)),formula2:i.map(e=>e.color===t?``:e.color).join(`,`)}}let Le=[`#FFFFFF`,`#FEE7E7`,`#FEF0E6`,`#EFFBD0`,`#E4F4FE`,`#E8ECFD`,`#F1EAFA`,`#FDE8F3`,`#E5E5E5`,`#FDCECE`,`#FDC49B`,`#DEF6A2`,`#9FDAFF`,`#D0D9FB`,`#E3D5F6`,`#FBD0E8`,`#656565`,`#FE4B4B`,`#FF8C51`,`#8BBB11`,`#0B9EFB`,`#3A60F7`,`#9E6DE3`,`#F248A6`],Re=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:Le.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)(xe,{})]})})},ze=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)(Te,{})}),(0,m.jsx)(Re,{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)(_e,{onClick:()=>a(t.id)})})]})},Be=()=>{};function Ve(e){let{value:n,onChange:c=Be,unitId:l,subUnitId:f,validResult:h,showError:g,ruleId:_}=e,{formula1:v=``,formula2:y=``}=n||{},[b,x]=(0,d.useState)(()=>(0,t.isFormulaString)(v)?`1`:`0`),[S,C]=(0,d.useState)(b===`1`?v:`=`),[w,T]=(0,d.useState)(b===`1`?v:`=`),E=(0,o.useDependency)(t.LocaleService),D=(0,o.useDependency)(a.DataValidatorRegistryService),O=(0,o.useDependency)(a.DataValidationModel),k=(0,o.useDependency)(i.DataValidationFormulaController),j=(0,o.useDependency)(A),[M,N]=(0,d.useState)(()=>y.split(`,`)),P=D.getValidatorItem(t.DataValidationType.LIST),[F,I]=(0,d.useState)([]),[L,R]=(0,d.useState)(``),z=g?h==null?void 0:h.formula1:``,te=(0,o.useObservable)((0,d.useMemo)(()=>O.ruleChange$.pipe((0,s.debounceTime)(16)),[])),B=(0,o.useEvent)(c);(0,d.useEffect)(()=>{(async()=>{await(0,t.awaitTime)(100);let e=O.getRuleById(l,f,_);(0,t.isFormulaString)(e==null?void 0:e.formula1)&&P&&e&&I(await P.getListAsync(e,l,f))})()},[O,te,P,_,f,l]),(0,d.useEffect)(()=>{(0,t.isFormulaString)(v)&&v!==w&&(C(v),T(w))},[w,v]);let[V,H]=(0,d.useState)(()=>{let e=b===`1`?[]:(0,r.deserializeListOptions)(v),n=y.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=(0,d.useMemo)(()=>F.map((e,t)=>({label:e,color:M[t]||`#ECECEC`,id:`${t}`,isRef:!0})),[M,F]),ne=(e,t,n)=>{let r=[...M];r[+e]=n,N(r),B({formula1:v,formula2:r.join(`,`)})},K=()=>{H([...V,{label:``,color:ee,isRef:!1,id:(0,t.generateRandomId)(4)}])};(0,d.useEffect)(()=>{b!==`1`&&B(Ie(V,ee))},[V,B,b]);let q=(0,o.useEvent)(async e=>{if(!(0,t.isFormulaString)(e)){B==null||B({formula1:``,formula2:y});return}k.getFormulaRefCheck(e)?(B==null||B({formula1:(0,t.isFormulaString)(e)?e:``,formula2:y}),R(``)):(B==null||B({formula1:``,formula2:y}),C(`=`),R(E.t(`sheets-data-validation-ui.validFail.formulaError`)))}),re=(0,d.useRef)(null),[J,ie]=(0,d.useState)(!1);return(0,o.useSidebarClick)(e=>{var t;(t=re.current)!=null&&t.isClickOutSide(e)&&ie(!1)}),(0,d.useEffect)(()=>{J?j.setFocusFormulaEditorActiveRuleSubUnitId(f):j.setFocusFormulaEditorActiveRuleSubUnitId(null)},[J,f,j]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.FormLayout,{label:E.t(`sheets-data-validation-ui.list.options`),children:(0,m.jsxs)(u.RadioGroup,{value:b,onChange:e=>{x(e),C(w),e===`1`&&B({formula1:w===`=`?``:w,formula2:M.join(`,`)})},children:[(0,m.jsx)(u.Radio,{value:`0`,children:E.t(`sheets-data-validation-ui.list.customOptions`)}),(0,m.jsx)(u.Radio,{value:`1`,children:E.t(`sheets-data-validation-ui.list.refOptions`)})]})}),b===`1`?(0,m.jsxs)(u.FormLayout,{error:z||L||void 0,children:[(0,m.jsx)(p.FormulaEditor,{ref:re,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:S,unitId:l,subUnitId:f,isFocus:J,isSupportAcrossSheet:!0,onFocus:()=>ie(!0),onChange:(e=``)=>{let t=(e==null?``:e).trim();T(t),q(t)}}),G.length>0&&(0,m.jsx)(`div`,{className:`univer-mt-3`,children:G.map(e=>(0,m.jsx)(ze,{className:`univer-mb-3`,item:e,commonProps:{onItemChange:ne}},e.id))})]}):(0,m.jsx)(u.FormLayout,{error:z,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(u.DraggableList,{list:V,onListChange:H,rowHeight:28,margin:[0,12],draggableHandle:`.draggableHandle`,itemRender:e=>(0,m.jsx)(ze,{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:K,children:[(0,m.jsx)(ye,{className:`univer-mr-1`}),E.t(`sheets-data-validation-ui.list.add`)]})]})})]})}let He=[[i.CUSTOM_FORMULA_INPUT_NAME,Fe],[i.BASE_FORMULA_INPUT_NAME,Ne],[i.LIST_FORMULA_INPUT_NAME,Ve],[i.CHECKBOX_FORMULA_INPUT_NAME,Pe]];function Ue(e){var n;let{value:r,onChange:i}=e,a=(0,o.useDependency)(t.LocaleService);return(0,m.jsx)(u.FormLayout,{label:a.t(`sheets-data-validation-ui.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(`sheets-data-validation-ui.renderMode.chip`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.ARROW}`,children:a.t(`sheets-data-validation-ui.renderMode.arrow`)}),(0,m.jsx)(u.Radio,{value:`${t.DataValidationRenderMode.TEXT}`,children:a.t(`sheets-data-validation-ui.renderMode.text`)})]})})}Ue.componentKey=`LIST_RENDER_MODE_OPTION_INPUT`;function We(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(`sheets-data-validation-ui.showTime.label`)})})}We.componentKey=`DATE_SHOW_TIME_OPTION`;let Ge=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)}};Ge=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))],Ge);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 Ke=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.CHECKBOX),D(this,`canvasRender`,this.injector.createInstance(Ge)),D(this,`formulaInput`,i.CHECKBOX_FORMULA_INPUT_NAME)}},qe=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.CUSTOM),D(this,`formulaInput`,i.CUSTOM_FORMULA_INPUT_NAME)}},Je=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.DATE),D(this,`formulaInput`,`data-validation.formula-input`),D(this,`optionsInput`,We.componentKey),D(this,`dropdownType`,a.DataValidatorDropdownType.DATE)}},Ye=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.DECIMAL),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}};function Xe(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 Ze(e,t,n,r){let i=n-26,a=r-12,o=e.map(e=>({layout:Xe(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 Qe=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 $e=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`),et=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($e),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:ee}=f||{},N=M==null?t.VerticalAlign.MIDDLE:M,P=(c=(0,i.getCellValueOrigin)(p))==null?``:c,F=T.parseCellValue(P),I=T.getListWithColorMap(w),L=Ze(F,j,D,O);this._drawDownIcon(e,E,D,O,N),e.save(),e.translateWithPrecision(E.startX,E.startY),e.beginPath(),e.rect(0,0,D-14,O),e.clip(),e.translateWithPrecision(6,6);let R=0;switch(N){case t.VerticalAlign.MIDDLE:R=(L.contentHeight-L.totalHeight)/2;break;case t.VerticalAlign.BOTTOM:R=L.contentHeight-L.totalHeight;break;default:break}e.translateWithPrecision(0,R),L.lines.forEach((n,r)=>{e.save();let{width:i,height:a,items:o}=n,s=0;switch(ee){case t.HorizontalAlign.RIGHT:s=L.contentWidth-i;break;case t.HorizontalAlign.CENTER:s=(L.contentWidth-i)/2;break;default:break}e.translate(s,r*(a+4)),o.forEach(t=>{e.save(),e.translateWithPrecision(t.left,0),Qe.drawWith(e,{...j,info:t,color:A,fill:I[t.text]}),e.restore()}),e.restore()}),e.restore(),b.set(x,{left:E.startX,top:E.startY,width:L.contentWidth+6+14,height:L.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 Ze(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 Ze(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(B.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)}};et=k([O(0,t.ICommandService),O(1,t.IUniverInstanceService),O(2,(0,t.Inject)(n.IRenderManagerService)),O(3,(0,t.Inject)(i.SheetDataValidationModel))],et);var tt=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.LIST_MULTIPLE),D(this,`canvasRender`,this.injector.createInstance(et)),D(this,`dropdownType`,a.DataValidatorDropdownType.MULTIPLE_LIST)}};let nt=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 rt(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 it=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(nt),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}`,ee=A[M],{tb:N,vt:P,ht:F,pd:I}=p||{};N=(o=N)==null?t.WrapStrategy.WRAP:o,P=(s=P)==null?t.VerticalAlign.BOTTOM:s,F=(c=F)==null?t.DEFAULT_STYLES.ht:c,I=(l=I)==null?t.DEFAULT_STYLES.pd:l;let L=(0,n.getFontStyleString)(p).fontCache;if(y.renderMode===t.DataValidationRenderMode.ARROW){var R,z,te;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}=I,c=E-r-o-14-4,l=new n.DocSimpleSkeleton(M,L,N===t.WrapStrategy.WRAP,c,1/0);l.calculate();let u=l.getTotalWidth(),d=l.getTotalHeight(),{paddingTop:f,paddingLeft:m}=rt(c,D-i-s,u,d,P,F,!0);this._drawDownIcon(e,T,E,D,d,P,I),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:L,width:c,height:d,color:p==null||(R=p.cl)==null?void 0:R.rgb,strokeLine:!!(!(p==null||(z=p.st)==null)&&z.s),underline:!!(!(p==null||(te=p.ul)==null)&&te.s),warp:N===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 B,V,H;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,L,N===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}=rt(l,D,o,c,P,F);e.translateWithPrecision(6,u),n.Rect.drawWith(e,{width:l,height:c,fill:ee||`#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:L,width:r,height:s,color:p==null||(B=p.cl)==null?void 0:B.rgb,strokeLine:!!(!(p==null||(V=p.st)==null)&&V.s),underline:!!(!(p==null||(H=p.ul)==null)&&H.s),warp:N===t.WrapStrategy.WRAP,hAlign:t.HorizontalAlign.LEFT},i),e.restore(),e.translateWithPrecision(r+4+4,(s-4)/2),e.fillStyle=`#565656`,e.fill(nt),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(B.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)}};it=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))],it);var at=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.LIST),D(this,`canvasRender`,this.injector.createInstance(it)),D(this,`dropdownType`,a.DataValidatorDropdownType.LIST),D(this,`optionsInput`,Ue.componentKey),D(this,`formulaInput`,i.LIST_FORMULA_INPUT_NAME)}},ot=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.TEXT_LENGTH),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}},st=class extends Z{constructor(...e){super(...e),D(this,`id`,t.DataValidationType.WHOLE),D(this,`formulaInput`,i.BASE_FORMULA_INPUT_NAME)}};let ct=class extends t.RxDisposable{constructor(e,t,n){super(),this._injector=e,this._componentManger=t,this._dataValidatorRegistryService=n,this._initComponents(),this._registerValidatorViews()}_initComponents(){[[`DataValidationIcon`,he],[L,Me],[Ue.componentKey,Ue],[We.componentKey,We],...He].forEach(([e,t])=>{this.disposeWithMe(this._componentManger.register(e,t))})}_registerValidatorViews(){[Ye,st,ot,Je,Ke,at,tt,qe].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)})}};ct=k([O(0,(0,t.Inject)(t.Injector)),O(1,(0,t.Inject)(o.ComponentManager)),O(2,(0,t.Inject)(a.DataValidatorRegistryService))],ct);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],[W],[G],[Y],[q],[K],[ct]].forEach(e=>{this._injector.add(e)}),[H,B,V,z,R,te].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(K),this._injector.get(q),this._injector.get(n.IRenderManagerService).registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[le])}onRendered(){this._injector.get(ct),this._injector.get(Y)}onSteady(){this._injector.get(G)}};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],[W],[G],[Y],[q],[K],[N],[ct]].forEach(e=>{this._injector.add(e)}),[H,B,V,z,R,te].forEach(e=>{this._commandService.registerCommand(e)})}onReady(){this._injector.get(K),this._injector.get(q),this._injector.get(N),this._injector.get(W),this._injector.get(n.IRenderManagerService).registerRenderModule(t.UniverInstanceType.UNIVER_SHEET,[le])}onRendered(){this._injector.get(ct),this._injector.get(Y)}onSteady(){this._injector.get(G)}};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 $}})});
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiArSA=t())})(this,function(){return{"sheets-data-validation-ui":{title:`التحقق من صحة البيانات`,validFail:{value:`يُرجى إدخال قيمة`,common:`يُرجى إدخال قيمة أو صيغة`,number:`يُرجى إدخال رقم أو صيغة`,formula:`يُرجى إدخال صيغة`,integer:`يُرجى إدخال عدد صحيح أو صيغة`,date:`يُرجى إدخال تاريخ أو صيغة`,list:`يُرجى إدخال خيارات`,listInvalid:`يجب أن يكون مصدر القائمة قائمة مفصولة بالفواصل أو مرجعًا لصف أو عمود واحد`,checkboxEqual:`أدخل قيمًا مختلفة لمحتويات الخلية المحددة وغير المحددة.`,formulaError:`يحتوي نطاق المرجع على بيانات غير مرئية، يُرجى إعادة ضبط النطاق`,listIntersects:`لا يمكن أن يتقاطع النطاق المحدد مع نطاق القواعد`,primitive:`الصيغ غير مسموح بها للقيم المخصصة المحددة وغير المحددة.`},panel:{title:`إدارة التحقق من صحة البيانات`,addTitle:`إنشاء تحقق جديد من صحة البيانات`,removeAll:`إزالة الكل`,add:`إضافة قاعدة`,range:`النطاقات`,type:`النوع`,options:`خيارات متقدمة`,operator:`المشغل`,removeRule:`إزالة`,done:`تم`,formulaPlaceholder:`يُرجى إدخال قيمة أو صيغة`,valuePlaceholder:`يُرجى إدخال قيمة`,formulaAnd:`و`,invalid:`غير صالح`,showWarning:`إظهار التحذير`,rejectInput:`رفض الإدخال`,messageInfo:`رسالة مساعدة`,showInfo:`إظهار نص المساعدة للخلية المحددة`,rangeError:`النطاقات غير قانونية`,allowBlank:`السماح بالقيم الفارغة`},any:{title:`أي قيمة`,error:`محتوى هذه الخلية ينتهك قاعدة التحقق`},date:{title:`تاريخ`},list:{title:`قائمة منسدلة`,name:`القيمة تحتوي على واحدة من النطاق`,error:`يجب أن يكون الإدخال ضمن النطاق المحدد`,emptyError:`يُرجى إدخال قيمة`,add:`إضافة`,dropdown:`تحديد`,options:`خيارات`,customOptions:`مخصص`,refOptions:`من نطاق`,formulaError:`يجب أن يكون مصدر القائمة قائمة بيانات مفصولة بالفواصل، أو مرجعًا لصف أو عمود واحد.`,edit:`تحرير`},listMultiple:{title:`قائمة منسدلة - متعددة`,dropdown:`تحديد متعدد`},textLength:{title:`طول النص`},decimal:{title:`رقم`},whole:{title:`عدد صحيح`},checkbox:{title:`خانة اختيار`,error:`محتوى هذه الخلية ينتهك قاعدة التحقق`,tips:`استخدم قيمًا مخصصة داخل الخلايا`,checked:`القيمة المحددة`,unchecked:`القيمة غير المحددة`},custom:{title:`صيغة مخصصة`,error:`محتوى هذه الخلية ينتهك قاعدة التحقق`,validFail:`يُرجى إدخال صيغة صالحة`},alert:{title:`خطأ`,ok:`موافق`},error:{title:`غير صالح:`},renderMode:{arrow:`سهم`,chip:`رقاقة`,text:`نص عادي`,label:`نمط العرض`},showTime:{label:`إظهار منتقي الوقت`},permission:{dialog:{setStyleErr:`النطاق محمي، وليس لديك الإذن بتعيين الأنماط. لتعيين الأنماط، يُرجى التواصل مع المنشئ.`}}}}});
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiCaES=t())})(this,function(){return{dataValidation:{title:`Validació de dades`,validFail:{value:`Si us plau, introdueix un valor`,common:`Si us plau, introdueix un valor o una fórmula`,number:`Si us plau, introdueix un número o una fórmula`,formula:`Si us plau, introdueix una fórmula`,integer:`Si us plau, introdueix un enter o una fórmula`,date:`Si us plau, introdueix una data o una fórmula`,list:`Si us plau, introdueix opcions`,listInvalid:`La font de la llista ha de ser una llista delimitada o una referència a una sola fila o columna`,checkboxEqual:`Introdueix valors diferents per als continguts de cel·la marcats i desmarcats.`,formulaError:`L’interval de referència conté dades invisibles, ajusta l’interval`,listIntersects:`L’interval seleccionat no pot creuar-se amb l’àmbit de les regles`,primitive:`No es permeten fórmules per a valors personalitzats marcats i desmarcats.`},panel:{title:`Gestió de la validació de dades`,addTitle:`Crea una nova validació de dades`,removeAll:`Elimina-ho tot`,add:`Afegeix regla`,range:`Intervals`,type:`Tipus`,options:`Opcions avançades`,operator:`Operador`,removeRule:`Elimina`,done:`Fet`,formulaPlaceholder:`Si us plau, introdueix valor o fórmula`,valuePlaceholder:`Si us plau, introdueix valor`,formulaAnd:`i`,invalid:`Invàlid`,showWarning:`Mostra advertència`,rejectInput:`Rebutja l’entrada`,messageInfo:`Missatge d’ajuda`,showInfo:`Mostra text d’ajuda per a la cel·la seleccionada`,rangeError:`Els intervals no són vàlids`,allowBlank:`Permet valors en blanc`},operators:{between:`entre`,greaterThan:`més gran que`,greaterThanOrEqual:`més gran o igual que`,lessThan:`menys que`,lessThanOrEqual:`menys o igual que`,equal:`igual`,notEqual:`no igual`,notBetween:`no entre`,legal:`és tipus legal`},ruleName:{between:`Està entre {FORMULA1} i {FORMULA2}`,greaterThan:`És més gran que {FORMULA1}`,greaterThanOrEqual:`És més gran o igual que {FORMULA1}`,lessThan:`És menys que {FORMULA1}`,lessThanOrEqual:`És menys o igual que {FORMULA1}`,equal:`És igual a {FORMULA1}`,notEqual:`No és igual a {FORMULA1}`,notBetween:`No està entre {FORMULA1} i {FORMULA2}`,legal:`És un {TYPE} legal`},errorMsg:{between:`El valor ha d’estar entre {FORMULA1} i {FORMULA2}`,greaterThan:`El valor ha de ser més gran que {FORMULA1}`,greaterThanOrEqual:`El valor ha de ser més gran o igual que {FORMULA1}`,lessThan:`El valor ha de ser menys que {FORMULA1}`,lessThanOrEqual:`El valor ha de ser menys o igual que {FORMULA1}`,equal:`El valor ha de ser igual a {FORMULA1}`,notEqual:`El valor no ha de ser igual a {FORMULA1}`,notBetween:`El valor no ha d’estar entre {FORMULA1} i {FORMULA2}`,legal:`El valor ha de ser un {TYPE} legal`},any:{title:`Qualsevol valor`,error:`El contingut d’aquesta cel·la incompleix la regla de validació`},date:{title:`Data`,operators:{between:`entre`,greaterThan:`després de`,greaterThanOrEqual:`en o després de`,lessThan:`abans de`,lessThanOrEqual:`en o abans de`,equal:`igual`,notEqual:`no igual`,notBetween:`no entre`,legal:`és una data legal`},ruleName:{between:`està entre {FORMULA1} i {FORMULA2}`,greaterThan:`és després de {FORMULA1}`,greaterThanOrEqual:`és en o després de {FORMULA1}`,lessThan:`és abans de {FORMULA1}`,lessThanOrEqual:`és en o abans de {FORMULA1}`,equal:`és {FORMULA1}`,notEqual:`no és {FORMULA1}`,notBetween:`no està entre {FORMULA1}`,legal:`és una data legal`},errorMsg:{between:`El valor ha de ser una data legal i estar entre {FORMULA1} i {FORMULA2}`,greaterThan:`El valor ha de ser una data legal i després de {FORMULA1}`,greaterThanOrEqual:`El valor ha de ser una data legal i en o després de {FORMULA1}`,lessThan:`El valor ha de ser una data legal i abans de {FORMULA1}`,lessThanOrEqual:`El valor ha de ser una data legal i en o abans de {FORMULA1}`,equal:`El valor ha de ser una data legal i {FORMULA1}`,notEqual:`El valor ha de ser una data legal i no {FORMULA1}`,notBetween:`El valor ha de ser una data legal i no estar entre {FORMULA1}`,legal:`El valor ha de ser una data legal`}},list:{title:`Desplegable`,name:`El valor conté un del rang`,error:`L’entrada ha d’estar dins del rang especificat`,emptyError:`Si us plau, introdueix un valor`,add:`Afegeix`,dropdown:`Selecciona`,options:`Opcions`,customOptions:`Personalitzat`,refOptions:`D’un interval`,formulaError:`La font de la llista ha de ser una llista delimitada de dades o una referència a una sola fila o columna.`,edit:`Edita`},listMultiple:{title:`Desplegable-múltiple`,dropdown:`Selecció múltiple`},textLength:{title:`Longitud del text`,errorMsg:{between:`La longitud del text ha d’estar entre {FORMULA1} i {FORMULA2}`,greaterThan:`La longitud del text ha de ser més gran que {FORMULA1}`,greaterThanOrEqual:`La longitud del text ha de ser més gran o igual que {FORMULA1}`,lessThan:`La longitud del text ha de ser menys que {FORMULA1}`,lessThanOrEqual:`La longitud del text ha de ser menys o igual que {FORMULA1}`,equal:`La longitud del text ha de ser {FORMULA1}`,notEqual:`La longitud del text no ha de ser {FORMULA1}`,notBetween:`La longitud del text no ha d’estar entre {FORMULA1}`}},decimal:{title:`Número`},whole:{title:`Enter`},checkbox:{title:`Casella de selecció`,error:`El contingut d’aquesta cel·la incompleix la seva regla de validació`,tips:`Utilitza valors personalitzats dins de les cel·les`,checked:`Valor seleccionat`,unchecked:`Valor no seleccionat`},custom:{title:`Fórmula personalitzada`,error:`El contingut d’aquesta cel·la incompleix la seva regla de validació`,validFail:`Si us plau, introdueix una fórmula vàlida`,ruleName:`La fórmula personalitzada és {FORMULA1}`},alert:{title:`Error`,ok:`OK`},error:{title:`Invàlid:`},renderMode:{arrow:`Fletxa`,chip:`Xip`,text:`Text pla`,label:`Estil de visualització`},showTime:{label:`Mostra el selector d’hora`}}}});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiCaES=t())})(this,function(){return{"sheets-data-validation-ui":{title:`Validació de dades`,validFail:{value:`Si us plau, introdueix un valor`,common:`Si us plau, introdueix un valor o una fórmula`,number:`Si us plau, introdueix un número o una fórmula`,formula:`Si us plau, introdueix una fórmula`,integer:`Si us plau, introdueix un enter o una fórmula`,date:`Si us plau, introdueix una data o una fórmula`,list:`Si us plau, introdueix opcions`,listInvalid:`La font de la llista ha de ser una llista delimitada o una referència a una sola fila o columna`,checkboxEqual:`Introdueix valors diferents per als continguts de cel·la marcats i desmarcats.`,formulaError:`L’interval de referència conté dades invisibles, ajusta l’interval`,listIntersects:`L’interval seleccionat no pot creuar-se amb l’àmbit de les regles`,primitive:`No es permeten fórmules per a valors personalitzats marcats i desmarcats.`},panel:{title:`Gestió de la validació de dades`,addTitle:`Crea una nova validació de dades`,removeAll:`Elimina-ho tot`,add:`Afegeix regla`,range:`Intervals`,type:`Tipus`,options:`Opcions avançades`,operator:`Operador`,removeRule:`Elimina`,done:`Fet`,formulaPlaceholder:`Si us plau, introdueix valor o fórmula`,valuePlaceholder:`Si us plau, introdueix valor`,formulaAnd:`i`,invalid:`Invàlid`,showWarning:`Mostra advertència`,rejectInput:`Rebutja l’entrada`,messageInfo:`Missatge d’ajuda`,showInfo:`Mostra text d’ajuda per a la cel·la seleccionada`,rangeError:`Els intervals no són vàlids`,allowBlank:`Permet valors en blanc`},any:{title:`Qualsevol valor`,error:`El contingut d’aquesta cel·la incompleix la regla de validació`},date:{title:`Data`},list:{title:`Desplegable`,name:`El valor conté un del rang`,error:`L’entrada ha d’estar dins del rang especificat`,emptyError:`Si us plau, introdueix un valor`,add:`Afegeix`,dropdown:`Selecciona`,options:`Opcions`,customOptions:`Personalitzat`,refOptions:`D’un interval`,formulaError:`La font de la llista ha de ser una llista delimitada de dades o una referència a una sola fila o columna.`,edit:`Edita`},listMultiple:{title:`Desplegable-múltiple`,dropdown:`Selecció múltiple`},textLength:{title:`Longitud del text`},decimal:{title:`Número`},whole:{title:`Enter`},checkbox:{title:`Casella de selecció`,error:`El contingut d’aquesta cel·la incompleix la seva regla de validació`,tips:`Utilitza valors personalitzats dins de les cel·les`,checked:`Valor seleccionat`,unchecked:`Valor no seleccionat`},custom:{title:`Fórmula personalitzada`,error:`El contingut d’aquesta cel·la incompleix la seva regla de validació`,validFail:`Si us plau, introdueix una fórmula vàlida`},alert:{title:`Error`,ok:`OK`},error:{title:`Invàlid:`},renderMode:{arrow:`Fletxa`,chip:`Xip`,text:`Text pla`,label:`Estil de visualització`},showTime:{label:`Mostra el selector d’hora`},permission:{dialog:{setStyleErr:`L'interval està protegit i no teniu permís per establir estils. Per establir estils, contacteu amb el creador.`}}}}});
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiDeDE=t())})(this,function(){return{"sheets-data-validation-ui":{title:`Datenüberprüfung`,validFail:{value:`Bitte einen Wert eingeben`,common:`Bitte Wert oder Formel eingeben`,number:`Bitte Zahl oder Formel eingeben`,formula:`Bitte Formel eingeben`,integer:`Bitte Ganzzahl oder Formel eingeben`,date:`Bitte Datum oder Formel eingeben`,list:`Bitte Optionen eingeben`,listInvalid:`Die Listenquelle muss eine durch Trennzeichen getrennte Liste oder ein Bezug auf eine einzelne Zeile oder Spalte sein`,checkboxEqual:`Geben Sie unterschiedliche Werte für angekreuzte und nicht angekreuzte Zelleninhalte ein.`,formulaError:`Der Referenzbereich enthält unsichtbare Daten, bitte passen Sie den Bereich an`,listIntersects:`Der ausgewählte Bereich darf sich nicht mit dem Gültigkeitsbereich der Regeln überschneiden`,primitive:`Formeln sind für benutzerdefinierte angekreuzte und nicht angekreuzte Werte nicht zulässig.`},panel:{title:`Datenüberprüfungsverwaltung`,addTitle:`Neue Datenüberprüfung erstellen`,removeAll:`Alle entfernen`,add:`Regel hinzufügen`,range:`Bereiche`,type:`Typ`,options:`Erweiterte Optionen`,operator:`Operator`,removeRule:`Entfernen`,done:`Fertig`,formulaPlaceholder:`Bitte Wert oder Formel eingeben`,valuePlaceholder:`Bitte Wert eingeben`,formulaAnd:`und`,invalid:`Ungültig`,showWarning:`Warnung anzeigen`,rejectInput:`Eingabe ablehnen`,messageInfo:`Hilfemeldung`,showInfo:`Hilfetext für ausgewählte Zelle anzeigen`,rangeError:`Bereiche sind ungültig`,allowBlank:`Leere Werte zulassen`},any:{title:`Beliebiger Wert`,error:`Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel`},date:{title:`Datum`},list:{title:`Dropdown`,name:`Wert enthält einen aus dem Bereich`,error:`Eingabe muss innerhalb des angegebenen Bereichs liegen`,emptyError:`Bitte einen Wert eingeben`,add:`Hinzufügen`,dropdown:`Auswählen`,options:`Optionen`,customOptions:`Benutzerdefiniert`,refOptions:`Aus einem Bereich`,formulaError:`Die Listenquelle muss eine durch Trennzeichen getrennte Liste von Daten oder ein Bezug auf eine einzelne Zeile oder Spalte sein.`,edit:`Bearbeiten`},listMultiple:{title:`Dropdown-Mehrfachauswahl`,dropdown:`Mehrfachauswahl`},textLength:{title:`Textlänge`},decimal:{title:`Zahl`},whole:{title:`Ganzzahl`},checkbox:{title:`Kontrollkästchen`,error:`Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel`,tips:`Benutzerdefinierte Werte in Zellen verwenden`,checked:`Ausgewählter Wert`,unchecked:`Nicht ausgewählter Wert`},custom:{title:`Benutzerdefinierte Formel`,error:`Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel`,validFail:`Bitte eine gültige Formel eingeben`},alert:{title:`Fehler`,ok:`OK`},error:{title:`Ungültig:`},renderMode:{arrow:`Pfeil`,chip:`Chip`,text:`Reiner Text`,label:`Anzeigestil`},showTime:{label:`Zeitauswahl anzeigen`},permission:{dialog:{setStyleErr:`Der Bereich ist geschützt und Sie haben keine Berechtigung, Stile festzulegen. Um Stile festzulegen, wenden Sie sich bitte an den Ersteller.`}}}}});
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiEnUS=t())})(this,function(){return{dataValidation:{title:`Data validation`,validFail:{value:`Please input a value`,common:`Please input value or formula`,number:`Please input number or formula`,formula:`Please input formula`,integer:`Please input integer or formula`,date:`Please input date or formula`,list:`Please input options`,listInvalid:`The list source must be a delimited list or a reference to a single row or column`,checkboxEqual:`Enter different values for ticked and unticked cell contents.`,formulaError:`The reference range contains invisible data, please readjust the range`,listIntersects:`The selected range cannot intersect with the scope of the rules`,primitive:`Formulas are not permitted for custom ticked and unticked values.`},panel:{title:`Data validation management`,addTitle:`Create new data validation`,removeAll:`Remove All`,add:`Add Rule`,range:`Ranges`,type:`Type`,options:`Advance options`,operator:`Operator`,removeRule:`Remove`,done:`Done`,formulaPlaceholder:`Please input value or formula`,valuePlaceholder:`Please input value`,formulaAnd:`and`,invalid:`Invalid`,showWarning:`Show warning`,rejectInput:`Reject input`,messageInfo:`Helper message`,showInfo:`Show help text for a selected cell`,rangeError:`Ranges are not legal`,allowBlank:`Allow blank values`},operators:{between:`between`,greaterThan:`greater than`,greaterThanOrEqual:`greater than or equal`,lessThan:`less than`,lessThanOrEqual:`less than or equal`,equal:`equal`,notEqual:`not equal`,notBetween:`not between`,legal:`is legal type`},ruleName:{between:`Is between {FORMULA1} and {FORMULA2}`,greaterThan:`Is greater than {FORMULA1}`,greaterThanOrEqual:`Is greater than or equal to {FORMULA1}`,lessThan:`Is less than {FORMULA1}`,lessThanOrEqual:`Is less than or equal to {FORMULA1}`,equal:`Is equal to {FORMULA1}`,notEqual:`Is not equal to {FORMULA1}`,notBetween:`Is not between {FORMULA1} and {FORMULA2}`,legal:`Is a legal {TYPE}`},errorMsg:{between:`Value must be between {FORMULA1} and {FORMULA2}`,greaterThan:`Value must be greater than {FORMULA1}`,greaterThanOrEqual:`Value must be greater than or equal to {FORMULA1}`,lessThan:`Value must be less than {FORMULA1}`,lessThanOrEqual:`Value must be less than or equal to {FORMULA1}`,equal:`Value must be equal to {FORMULA1}`,notEqual:`Value must be not equal to {FORMULA1}`,notBetween:`Value must be not between {FORMULA1} and {FORMULA2}`,legal:`Value must be a legal {TYPE}`},any:{title:`Any value`,error:`The content of this cell violates the validation rule`},date:{title:`Date`,operators:{between:`between`,greaterThan:`after`,greaterThanOrEqual:`on or after`,lessThan:`before`,lessThanOrEqual:`on or before`,equal:`equal`,notEqual:`not equal`,notBetween:`not between`,legal:`is a legal date`},ruleName:{between:`is between {FORMULA1} and {FORMULA2}`,greaterThan:`is after {FORMULA1}`,greaterThanOrEqual:`is on or after {FORMULA1}`,lessThan:`is before {FORMULA1}`,lessThanOrEqual:`is on or before {FORMULA1}`,equal:`is {FORMULA1}`,notEqual:`is not {FORMULA1}`,notBetween:`is not between {FORMULA1}`,legal:`is a legal date`},errorMsg:{between:`Value must be a legal date and between {FORMULA1} and {FORMULA2}`,greaterThan:`Value must be a legal date and after {FORMULA1}`,greaterThanOrEqual:`Value must be a legal date and on or after {FORMULA1}`,lessThan:`Value must be a legal date and before {FORMULA1}`,lessThanOrEqual:`Value must be a legal date and on or before {FORMULA1}`,equal:`Value must be a legal date and {FORMULA1}`,notEqual:`Value must be a legal date and not {FORMULA1}`,notBetween:`Value must be a legal date and not between {FORMULA1}`,legal:`Value must be a legal date`}},list:{title:`Dropdown`,name:`Value contains one from range`,error:`Input must fall within specified range`,emptyError:`Please enter a value`,add:`Add`,dropdown:`Select`,options:`Options`,customOptions:`Custom`,refOptions:`From a range`,formulaError:`The list source must be a delimited list of data, or a reference to a single row or column.`,edit:`Edit`},listMultiple:{title:`Dropdown-Multiple`,dropdown:`Multiple select`},textLength:{title:`Text length`,errorMsg:{between:`Text length must be between {FORMULA1} and {FORMULA2}`,greaterThan:`Text length must be after {FORMULA1}`,greaterThanOrEqual:`Text length must be on or after {FORMULA1}`,lessThan:`Text length must be before {FORMULA1}`,lessThanOrEqual:`Text length must be on or before {FORMULA1}`,equal:`Text length must be {FORMULA1}`,notEqual:`Text length must be not {FORMULA1}`,notBetween:`Text length must be not between {FORMULA1}`}},decimal:{title:`Number`},whole:{title:`Integer`},checkbox:{title:`Checkbox`,error:`This cell's contents violate its validation rule`,tips:`Use custom values within cells`,checked:`Selected value`,unchecked:`Unselected value`},custom:{title:`Custom formula`,error:`This cell's contents violate its validation rule`,validFail:`Please input a valid formula`,ruleName:`Custom formula is {FORMULA1}`},alert:{title:`Error`,ok:`OK`},error:{title:`Invalid:`},renderMode:{arrow:`Arrow`,chip:`Chip`,text:`Plain text`,label:`Display style`},showTime:{label:`Show TimePicker`}}}});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiEnUS=t())})(this,function(){return{"sheets-data-validation-ui":{title:`Data validation`,validFail:{value:`Please input a value`,common:`Please input value or formula`,number:`Please input number or formula`,formula:`Please input formula`,integer:`Please input integer or formula`,date:`Please input date or formula`,list:`Please input options`,listInvalid:`The list source must be a delimited list or a reference to a single row or column`,checkboxEqual:`Enter different values for ticked and unticked cell contents.`,formulaError:`The reference range contains invisible data, please readjust the range`,listIntersects:`The selected range cannot intersect with the scope of the rules`,primitive:`Formulas are not permitted for custom ticked and unticked values.`},panel:{title:`Data validation management`,addTitle:`Create new data validation`,removeAll:`Remove All`,add:`Add Rule`,range:`Ranges`,type:`Type`,options:`Advance options`,operator:`Operator`,removeRule:`Remove`,done:`Done`,formulaPlaceholder:`Please input value or formula`,valuePlaceholder:`Please input value`,formulaAnd:`and`,invalid:`Invalid`,showWarning:`Show warning`,rejectInput:`Reject input`,messageInfo:`Helper message`,showInfo:`Show help text for a selected cell`,rangeError:`Ranges are not legal`,allowBlank:`Allow blank values`},any:{title:`Any value`,error:`The content of this cell violates the validation rule`},date:{title:`Date`},list:{title:`Dropdown`,name:`Value contains one from range`,error:`Input must fall within specified range`,emptyError:`Please enter a value`,add:`Add`,dropdown:`Select`,options:`Options`,customOptions:`Custom`,refOptions:`From a range`,formulaError:`The list source must be a delimited list of data, or a reference to a single row or column.`,edit:`Edit`},listMultiple:{title:`Dropdown-Multiple`,dropdown:`Multiple select`},textLength:{title:`Text length`},decimal:{title:`Number`},whole:{title:`Integer`},checkbox:{title:`Checkbox`,error:`This cell's contents violate its validation rule`,tips:`Use custom values within cells`,checked:`Selected value`,unchecked:`Unselected value`},custom:{title:`Custom formula`,error:`This cell's contents violate its validation rule`,validFail:`Please input a valid formula`},alert:{title:`Error`,ok:`OK`},error:{title:`Invalid:`},renderMode:{arrow:`Arrow`,chip:`Chip`,text:`Plain text`,label:`Display style`},showTime:{label:`Show TimePicker`},permission:{dialog:{setStyleErr:`The range is protected, and you do not have permission to set styles. To set styles, please contact the creator.`}}}}});
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiEsES=t())})(this,function(){return{dataValidation:{title:`Validación de datos`,validFail:{value:`Por favor, introduce un valor`,common:`Por favor, introduce un valor o fórmula`,number:`Por favor, introduce un número o fórmula`,formula:`Por favor, introduce una fórmula`,integer:`Por favor, introduce un entero o fórmula`,date:`Por favor, introduce una fecha o fórmula`,list:`Por favor, introduce opciones`,listInvalid:`La fuente de la lista debe ser una lista delimitada o una referencia a una sola fila o columna`,checkboxEqual:`Introduce valores diferentes para los contenidos de celda marcados y desmarcados.`,formulaError:`El rango de referencia contiene datos invisibles, ajusta el rango`,listIntersects:`El rango seleccionado no puede cruzarse con el ámbito de las reglas`,primitive:`No se permiten fórmulas para valores personalizados marcados y desmarcados.`},panel:{title:`Gestión de validación de datos`,addTitle:`Crear nueva validación de datos`,removeAll:`Eliminar todo`,add:`Añadir regla`,range:`Rangos`,type:`Tipo`,options:`Opciones avanzadas`,operator:`Operador`,removeRule:`Eliminar`,done:`Hecho`,formulaPlaceholder:`Por favor, introduce valor o fórmula`,valuePlaceholder:`Por favor, introduce valor`,formulaAnd:`y`,invalid:`Inválido`,showWarning:`Mostrar advertencia`,rejectInput:`Rechazar entrada`,messageInfo:`Mensaje de ayuda`,showInfo:`Mostrar texto de ayuda para la celda seleccionada`,rangeError:`Los rangos no son válidos`,allowBlank:`Permitir valores en blanco`},operators:{between:`entre`,greaterThan:`mayor que`,greaterThanOrEqual:`mayor o igual que`,lessThan:`menor que`,lessThanOrEqual:`menor o igual que`,equal:`igual`,notEqual:`no igual`,notBetween:`no entre`,legal:`es tipo legal`},ruleName:{between:`Está entre {FORMULA1} y {FORMULA2}`,greaterThan:`Es mayor que {FORMULA1}`,greaterThanOrEqual:`Es mayor o igual que {FORMULA1}`,lessThan:`Es menor que {FORMULA1}`,lessThanOrEqual:`Es menor o igual que {FORMULA1}`,equal:`Es igual a {FORMULA1}`,notEqual:`No es igual a {FORMULA1}`,notBetween:`No está entre {FORMULA1} y {FORMULA2}`,legal:`Es un {TYPE} legal`},errorMsg:{between:`El valor debe estar entre {FORMULA1} y {FORMULA2}`,greaterThan:`El valor debe ser mayor que {FORMULA1}`,greaterThanOrEqual:`El valor debe ser mayor o igual que {FORMULA1}`,lessThan:`El valor debe ser menor que {FORMULA1}`,lessThanOrEqual:`El valor debe ser menor o igual que {FORMULA1}`,equal:`El valor debe ser igual a {FORMULA1}`,notEqual:`El valor no debe ser igual a {FORMULA1}`,notBetween:`El valor no debe estar entre {FORMULA1} y {FORMULA2}`,legal:`El valor debe ser un {TYPE} legal`},any:{title:`Cualquier valor`,error:`El contenido de esta celda viola la regla de validación`},date:{title:`Fecha`,operators:{between:`entre`,greaterThan:`después de`,greaterThanOrEqual:`en o después de`,lessThan:`antes de`,lessThanOrEqual:`en o antes de`,equal:`igual`,notEqual:`no igual`,notBetween:`no entre`,legal:`es una fecha legal`},ruleName:{between:`está entre {FORMULA1} y {FORMULA2}`,greaterThan:`es después de {FORMULA1}`,greaterThanOrEqual:`es en o después de {FORMULA1}`,lessThan:`es antes de {FORMULA1}`,lessThanOrEqual:`es en o antes de {FORMULA1}`,equal:`es {FORMULA1}`,notEqual:`no es {FORMULA1}`,notBetween:`no está entre {FORMULA1}`,legal:`es una fecha legal`},errorMsg:{between:`El valor debe ser una fecha legal y estar entre {FORMULA1} y {FORMULA2}`,greaterThan:`El valor debe ser una fecha legal y después de {FORMULA1}`,greaterThanOrEqual:`El valor debe ser una fecha legal y en o después de {FORMULA1}`,lessThan:`El valor debe ser una fecha legal y antes de {FORMULA1}`,lessThanOrEqual:`El valor debe ser una fecha legal y en o antes de {FORMULA1}`,equal:`El valor debe ser una fecha legal y {FORMULA1}`,notEqual:`El valor debe ser una fecha legal y no {FORMULA1}`,notBetween:`El valor debe ser una fecha legal y no estar entre {FORMULA1}`,legal:`El valor debe ser una fecha legal`}},list:{title:`Desplegable`,name:`El valor contiene uno del rango`,error:`La entrada debe estar dentro del rango especificado`,emptyError:`Por favor, introduce un valor`,add:`Añadir`,dropdown:`Seleccionar`,options:`Opciones`,customOptions:`Personalizado`,refOptions:`De un rango`,formulaError:`La fuente de la lista debe ser una lista delimitada de datos o una referencia a una sola fila o columna.`,edit:`Editar`},listMultiple:{title:`Desplegable-múltiple`,dropdown:`Selección múltiple`},textLength:{title:`Longitud del texto`,errorMsg:{between:`La longitud del texto debe estar entre {FORMULA1} y {FORMULA2}`,greaterThan:`La longitud del texto debe ser mayor que {FORMULA1}`,greaterThanOrEqual:`La longitud del texto debe ser mayor o igual que {FORMULA1}`,lessThan:`La longitud del texto debe ser menor que {FORMULA1}`,lessThanOrEqual:`La longitud del texto debe ser menor o igual que {FORMULA1}`,equal:`La longitud del texto debe ser {FORMULA1}`,notEqual:`La longitud del texto no debe ser {FORMULA1}`,notBetween:`La longitud del texto no debe estar entre {FORMULA1}`}},decimal:{title:`Número`},whole:{title:`Entero`},checkbox:{title:`Casilla de verificación`,error:`El contenido de esta celda viola su regla de validación`,tips:`Usa valores personalizados dentro de las celdas`,checked:`Valor seleccionado`,unchecked:`Valor no seleccionado`},custom:{title:`Fórmula personalizada`,error:`El contenido de esta celda viola su regla de validación`,validFail:`Por favor, introduce una fórmula válida`,ruleName:`La fórmula personalizada es {FORMULA1}`},alert:{title:`Error`,ok:`OK`},error:{title:`Inválido:`},renderMode:{arrow:`Flecha`,chip:`Chip`,text:`Texto plano`,label:`Estilo de visualización`},showTime:{label:`Mostrar selector de hora`}}}});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.UniverSheetsDataValidationUiEsES=t())})(this,function(){return{"sheets-data-validation-ui":{title:`Validación de datos`,validFail:{value:`Por favor, introduce un valor`,common:`Por favor, introduce un valor o fórmula`,number:`Por favor, introduce un número o fórmula`,formula:`Por favor, introduce una fórmula`,integer:`Por favor, introduce un entero o fórmula`,date:`Por favor, introduce una fecha o fórmula`,list:`Por favor, introduce opciones`,listInvalid:`La fuente de la lista debe ser una lista delimitada o una referencia a una sola fila o columna`,checkboxEqual:`Introduce valores diferentes para los contenidos de celda marcados y desmarcados.`,formulaError:`El rango de referencia contiene datos invisibles, ajusta el rango`,listIntersects:`El rango seleccionado no puede cruzarse con el ámbito de las reglas`,primitive:`No se permiten fórmulas para valores personalizados marcados y desmarcados.`},panel:{title:`Gestión de validación de datos`,addTitle:`Crear nueva validación de datos`,removeAll:`Eliminar todo`,add:`Añadir regla`,range:`Rangos`,type:`Tipo`,options:`Opciones avanzadas`,operator:`Operador`,removeRule:`Eliminar`,done:`Hecho`,formulaPlaceholder:`Por favor, introduce valor o fórmula`,valuePlaceholder:`Por favor, introduce valor`,formulaAnd:`y`,invalid:`Inválido`,showWarning:`Mostrar advertencia`,rejectInput:`Rechazar entrada`,messageInfo:`Mensaje de ayuda`,showInfo:`Mostrar texto de ayuda para la celda seleccionada`,rangeError:`Los rangos no son válidos`,allowBlank:`Permitir valores en blanco`},any:{title:`Cualquier valor`,error:`El contenido de esta celda viola la regla de validación`},date:{title:`Fecha`},list:{title:`Desplegable`,name:`El valor contiene uno del rango`,error:`La entrada debe estar dentro del rango especificado`,emptyError:`Por favor, introduce un valor`,add:`Añadir`,dropdown:`Seleccionar`,options:`Opciones`,customOptions:`Personalizado`,refOptions:`De un rango`,formulaError:`La fuente de la lista debe ser una lista delimitada de datos o una referencia a una sola fila o columna.`,edit:`Editar`},listMultiple:{title:`Desplegable-múltiple`,dropdown:`Selección múltiple`},textLength:{title:`Longitud del texto`},decimal:{title:`Número`},whole:{title:`Entero`},checkbox:{title:`Casilla de verificación`,error:`El contenido de esta celda viola su regla de validación`,tips:`Usa valores personalizados dentro de las celdas`,checked:`Valor seleccionado`,unchecked:`Valor no seleccionado`},custom:{title:`Fórmula personalizada`,error:`El contenido de esta celda viola su regla de validación`,validFail:`Por favor, introduce una fórmula válida`},alert:{title:`Error`,ok:`OK`},error:{title:`Inválido:`},renderMode:{arrow:`Flecha`,chip:`Chip`,text:`Texto plano`,label:`Estilo de visualización`},showTime:{label:`Mostrar selector de hora`},permission:{dialog:{setStyleErr:`El rango está protegido y no tienes permiso para establecer estilos. Para establecer estilos, contacta al creador.`}}}}});