@univerjs/sheets-sort-ui 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),sheetsSort=require("@univerjs/sheets-sort"),sheets=require("@univerjs/sheets"),React=require("react"),ui=require("@univerjs/ui"),rxjs=require("rxjs"),design=require("@univerjs/design"),engineFormula=require("@univerjs/engine-formula"),sheetsUi=require("@univerjs/sheets-ui"),extendConfirmContent="univer-extend-confirm-content",extendConfirmRadioGroup="univer-extend-confirm-radio-group",customSortPanelContainer="univer-custom-sort-panel-container",customSortPanelExt="univer-custom-sort-panel-ext",addCondition="univer-add-condition",addConditionText="univer-add-condition-text",addConditionDisable="univer-add-condition-disable",customSortPanelFooter="univer-custom-sort-panel-footer",customSortPanelFooterBtn="univer-custom-sort-panel-footer-btn",customSortPanelItem="univer-custom-sort-panel-item",customSortPanelItemHead="univer-custom-sort-panel-item-head",customSortPanelItemHandler="univer-custom-sort-panel-item-handler",customSortPanelItemRemove="univer-custom-sort-panel-item-remove",customSortPanelItemColumnInput="univer-custom-sort-panel-item-column-input",customSortPanelItemColumnInputDropdown="univer-custom-sort-panel-item-column-input-dropdown",customSortPanelItemColumnInputText="univer-custom-sort-panel-item-column-input-text",customSortPanelItemOrderRadio="univer-custom-sort-panel-item-order-radio",customSortPanelItemOrderRadioCn="univer-custom-sort-panel-item-order-radio-cn",conditionList="univer-condition-list",embedSortBtnContainer="univer-embed-sort-btn-container",embedSortBtn="univer-embed-sort-btn",embedSortBtnAsc="univer-embed-sort-btn-asc",embedSortBtnDesc="univer-embed-sort-btn-desc",embedSortBtnIcon="univer-embed-sort-btn-icon",customSortColMenu="univer-custom-sort-col-menu",customSortColMenuItem="univer-custom-sort-col-menu-item",customSortColMenuItemDesc="univer-custom-sort-col-menu-item-desc",styles={extendConfirmContent,extendConfirmRadioGroup,customSortPanelContainer,customSortPanelExt,addCondition,addConditionText,addConditionDisable,customSortPanelFooter,customSortPanelFooterBtn,customSortPanelItem,customSortPanelItemHead,customSortPanelItemHandler,customSortPanelItemRemove,customSortPanelItemColumnInput,customSortPanelItemColumnInputDropdown,customSortPanelItemColumnInputText,customSortPanelItemOrderRadio,customSortPanelItemOrderRadioCn,conditionList,embedSortBtnContainer,embedSortBtn,embedSortBtnAsc,embedSortBtnDesc,embedSortBtnIcon,customSortColMenu,customSortColMenuItem,customSortColMenuItemDesc},ExtendConfirm=__name(props=>{const[extend,setExtend]=React.useState("0"),localeService=core.useDependency(core.LocaleService);return React.createElement("div",{className:styles.extendConfirmContent},React.createElement("div",{className:"extend-confirm-desc"},localeService.t("sheets-sort.dialog.sort-reminder-desc")),React.createElement(design.RadioGroup,{className:styles.extendConfirmRadioGroup,value:extend,direction:"vertical",onChange:__name(value=>{setExtend(value),props.onChange(value)},"onChange")},React.createElement(design.Radio,{value:"0"},localeService.t("sheets-sort.dialog.sort-reminder-no")),React.createElement(design.Radio,{value:"1"},localeService.t("sheets-sort.dialog.sort-reminder-ext"))))},"ExtendConfirm");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");const SORT_ERROR_MESSAGE={MERGE_ERROR:"sheets-sort.error.merge-size",EMPTY_ERROR:"sheets-sort.error.empty",SINGLE_ERROR:"sheets-sort.error.single",FORMULA_ARRAY:"sheets-sort.error.formula-array"};var _a;let SheetsSortUIService=(_a=class extends core.Disposable{constructor(_univerInstanceService,_confirmService,_logService,_selectionManagerService,_sheetsSortService,_localeService,_commandService){super();__publicField(this,"_customSortState$",new rxjs.BehaviorSubject(null));__publicField(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=_univerInstanceService,this._confirmService=_confirmService,this._logService=_logService,this._selectionManagerService=_selectionManagerService,this._sheetsSortService=_sheetsSortService,this._localeService=_localeService,this._commandService=_commandService}async triggerSortDirectly(asc,extend,sheetRangeLocation){const location=sheetRangeLocation||await this._detectSortLocation(extend);if(!location||!this._check(location))return!1;const sortOption={orderRules:[{type:asc?sheetsSort.SortType.ASC:sheetsSort.SortType.DESC,colIndex:location.colIndex}],range:location.range};return this._sheetsSortService.applySort(sortOption,location.unitId,location.subUnitId),!0}async triggerSortCustomize(){const location=await this._detectSortLocation();return!location||!this._check(location)?!1:(this.showCustomSortPanel(location),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(hasTitle){var _a4,_b;const location=(_a4=this.customSortState())==null?void 0:_a4.location;if(!location)return[];const{unitId,subUnitId,range}=location,worksheet=(_b=this._univerInstanceService.getUnit(unitId))==null?void 0:_b.getSheetBySheetId(subUnitId);if(!worksheet)return[];const colTranslator=colIndexTranslator(this._localeService);return Array.from({length:range.endColumn-range.startColumn+1},(_,i)=>{var _a5;const cellValue=(_a5=worksheet.getCell(range.startRow,i+range.startColumn))==null?void 0:_a5.v;return{index:i+range.startColumn,label:hasTitle?`${cellValue!=null?cellValue:colTranslator(i+range.startColumn)}`:colTranslator(i+range.startColumn)}})}setSelection(unitId,subUnitId,range){var _a4;const worksheet=(_a4=this._univerInstanceService.getUnit(unitId))==null?void 0:_a4.getSheetBySheetId(subUnitId);if(!worksheet)return;const setSelectionsOperationParams={unitId,subUnitId,selections:[{range,primary:sheets.getPrimaryForRange(range,worksheet),style:null}]};this._commandService.executeCommand(sheets.SetSelectionsOperation.id,setSelectionsOperationParams)}async showCheckError(content){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:React.createElement("div",null,this._localeService.t(content))}})}async showExtendConfirm(){let shouldExtend=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:React.createElement(ExtendConfirm,{onChange:__name(value=>{shouldExtend=value==="1"},"onChange")})},width:400})?shouldExtend?"extend":"keep":"cancel"}showCustomSortPanel(location){this._customSortState$.next({location,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(location){return this._sheetsSortService.singleCheck(location)?this._sheetsSortService.mergeCheck(location)?this._sheetsSortService.formulaCheck(location)?this._sheetsSortService.emptyCheck(location)?!0:(this.showCheckError(SORT_ERROR_MESSAGE.EMPTY_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.FORMULA_ARRAY),!1):(this.showCheckError(SORT_ERROR_MESSAGE.MERGE_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.SINGLE_ERROR),!1)}async _detectSortLocation(extend){const workbook=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook.getActiveSheet(),unitId=workbook.getUnitId(),subUnitId=worksheet.getSheetId(),selection=this._selectionManagerService.getCurrentLastSelection();if(!selection)return null;let range;if(extend===!0)range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range);else if(extend===!1)range=selection.range;else{const confirmRes=await this.showExtendConfirm();if(confirmRes==="cancel")return null;confirmRes==="keep"?range=selection.range:(range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range))}return{range,unitId,subUnitId,colIndex:selection.primary.actualColumn}}},__name(_a,"SheetsSortUIService"),_a);SheetsSortUIService=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,sheetsSort.SheetsSortService),__decorateParam$2(0,core.IUniverInstanceService),__decorateParam$2(1,ui.IConfirmService),__decorateParam$2(2,core.ILogService),__decorateParam$2(3,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$2(4,core.Inject(sheetsSort.SheetsSortService)),__decorateParam$2(5,core.Inject(core.LocaleService)),__decorateParam$2(6,core.ICommandService)],SheetsSortUIService);function colIndexTranslator(localeService){return colIndex=>{const colName=core.Tools.chatAtABC(colIndex);switch(localeService.getCurrentLocale()){case core.LocaleType.ZH_CN:return`"${colName}"列`;case core.LocaleType.EN_US:return`Column "${colName}"`;default:return`Column "${colName}"`}}}__name(colIndexTranslator,"colIndexTranslator");var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=React.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=React.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return React.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a4){var key=_a4[0],value=_a4[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a4,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a4=node.children)===null||_a4===void 0)&&_a4.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element$9={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},AscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"ascending- single",ref,icon:element$9}))});AscendingSingle.displayName="AscendingSingle";var element$8={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CheckMarkSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$8}))});CheckMarkSingle.displayName="CheckMarkSingle";var element$7={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574 8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507 9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661 11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306zM6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512 7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574 6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588 4.88808 9.55156 5.26798 9.55156 5.50229 9.78588L6.22584 10.5094z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.14014 3.73989C1.14014 2.30396 2.3042 1.13989 3.74014 1.13989H12.2601C13.6961 1.13989 14.8601 2.30395 14.8601 3.73989V12.2599C14.8601 13.6958 13.6961 14.8599 12.2601 14.8599H3.74014C2.3042 14.8599 1.14014 13.6958 1.14014 12.2599V3.73989ZM2.34014 5.86724V12.2599C2.34014 13.0331 2.96694 13.6599 3.74014 13.6599H12.2601C13.0333 13.6599 13.6601 13.0331 13.6601 12.2599V5.86724H2.34014ZM13.6601 4.66724H2.34014V3.73989C2.34014 2.9667 2.96694 2.33989 3.74014 2.33989H12.2601C13.0333 2.33989 13.6601 2.96669 13.6601 3.73989V4.66724Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CustomSortSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"custom-sort-single",ref,icon:element$7}))});CustomSortSingle.displayName="CustomSortSingle";var element$6={tag:"svg",attrs:{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.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.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.64443 14.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:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V13.1332C3.15332 14.2377 4.04875 15.1332 5.15332 15.1332H10.8465C11.9511 15.1332 12.8465 14.2377 12.8465 13.1331V6.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.82217V13.1331C11.6465 13.575 11.2884 13.9331 10.8465 13.9331H5.15332C4.71149 13.9331 4.35332 13.575 4.35332 13.1332V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},DeleteEmptySingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"delete-empty-single",ref,icon:element$6}))});DeleteEmptySingle.displayName="DeleteEmptySingle";var element$5={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},DescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"descending-single",ref,icon:element$5}))});DescendingSingle.displayName="DescendingSingle";var element$4={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 3.20024C1.57503 3.20024 1.3064 2.93161 1.3064 2.60024C1.3064 2.26887 1.57503 2.00024 1.9064 2.00024H4.57306C4.90443 2.00024 5.17306 2.26887 5.17306 2.60024C5.17306 2.93161 4.90443 3.20024 4.57306 3.20024H1.9064ZM1.3064 6.19985C1.3064 6.53122 1.57503 6.79985 1.9064 6.79985H5.9064C6.23777 6.79985 6.5064 6.53122 6.5064 6.19985C6.5064 5.86848 6.23777 5.59985 5.9064 5.59985H1.9064C1.57503 5.59985 1.3064 5.86848 1.3064 6.19985ZM1.9064 10.3997C1.57503 10.3997 1.3064 10.1311 1.3064 9.79971C1.3064 9.46834 1.57503 9.19971 1.9064 9.19971H7.23973C7.5711 9.19971 7.83973 9.46834 7.83973 9.79971C7.83973 10.1311 7.5711 10.3997 7.23973 10.3997H1.9064ZM1.9064 13.9996C1.57503 13.9996 1.3064 13.7309 1.3064 13.3996C1.3064 13.0682 1.57503 12.7996 1.9064 12.7996H8.57306C8.90443 12.7996 9.17306 13.0682 9.17306 13.3996C9.17306 13.7309 8.90443 13.9996 8.57306 13.9996H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 14.2667C12.4267 14.5981 12.1581 14.8667 11.8267 14.8667C11.4953 14.8667 11.2267 14.5981 11.2267 14.2667V3.18198L9.98447 4.42422C9.75015 4.65853 9.37026 4.65853 9.13594 4.42422C8.90163 4.1899 8.90163 3.81 9.13594 3.57569L11.4026 1.30902C11.6369 1.07471 12.0168 1.07471 12.2511 1.30902L14.5178 3.57569C14.7521 3.81 14.7521 4.1899 14.5178 4.42422C14.2835 4.65853 13.9036 4.65853 13.6693 4.42422L12.4267 3.18165V14.2667Z"}}]},ExpandAscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-ascending-single",ref,icon:element$4}))});ExpandAscendingSingle.displayName="ExpandAscendingSingle";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 12.7998C1.57503 12.7998 1.3064 13.0684 1.3064 13.3998C1.3064 13.7311 1.57503 13.9998 1.9064 13.9998H4.57306C4.90443 13.9998 5.17306 13.7311 5.17306 13.3998C5.17306 13.0684 4.90443 12.7998 4.57306 12.7998H1.9064ZM1.3064 9.80015C1.3064 9.46878 1.57503 9.20015 1.9064 9.20015H5.9064C6.23777 9.20015 6.5064 9.46878 6.5064 9.80015C6.5064 10.1315 6.23777 10.4001 5.9064 10.4001H1.9064C1.57503 10.4001 1.3064 10.1315 1.3064 9.80015ZM1.9064 5.60029C1.57503 5.60029 1.3064 5.86892 1.3064 6.20029C1.3064 6.53166 1.57503 6.80029 1.9064 6.80029H7.23973C7.5711 6.80029 7.83973 6.53166 7.83973 6.20029C7.83973 5.86892 7.5711 5.60029 7.23973 5.60029H1.9064ZM1.9064 2.00044C1.57503 2.00044 1.3064 2.26907 1.3064 2.60044C1.3064 2.93181 1.57503 3.20044 1.9064 3.20044H8.57306C8.90443 3.20044 9.17306 2.93181 9.17306 2.60044C9.17306 2.26907 8.90443 2.00044 8.57306 2.00044H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 1.7333C12.4267 1.40193 12.1581 1.1333 11.8267 1.1333C11.4953 1.1333 11.2267 1.40193 11.2267 1.7333V12.818L9.98447 11.5758C9.75015 11.3415 9.37026 11.3415 9.13594 11.5758C8.90163 11.8101 8.90163 12.19 9.13594 12.4243L11.4026 14.691C11.6369 14.9253 12.0168 14.9253 12.2511 14.691L14.5178 12.4243C14.7521 12.19 14.7521 11.8101 14.5178 11.5758C14.2835 11.3415 13.9036 11.3415 13.6693 11.5758L12.4267 12.8183V1.7333Z"}}]},ExpandDescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-descending-single",ref,icon:element$3}))});ExpandDescendingSingle.displayName="ExpandDescendingSingle";var element$2={tag:"svg",attrs:{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"}}]},IncreaseSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"increase-single",ref,icon:element$2}))});IncreaseSingle.displayName="IncreaseSingle";var element$1={tag:"svg",attrs:{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"}}]},MoreDownSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"more-down-single",ref,icon:element$1}))});MoreDownSingle.displayName="MoreDownSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},SequenceSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"sequence-single",ref,icon:element}))});SequenceSingle.displayName="SequenceSingle";const SortRangeAscCommand={id:"sheet.command.sort-range-asc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtCommand={id:"sheet.command.sort-range-asc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescCommand={id:"sheet.command.sort-range-desc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtCommand={id:"sheet.command.sort-range-desc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomCommand={id:"sheet.command.sort-range-custom",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")},SortRangeAscInCtxMenuCommand={id:"sheet.command.sort-range-asc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtInCtxMenuCommand={id:"sheet.command.sort-range-asc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescInCtxMenuCommand={id:"sheet.command.sort-range-desc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtInCtxMenuCommand={id:"sheet.command.sort-range-desc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomInCtxMenuCommand={id:"sheet.command.sort-range-custom-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")};function CustomSortPanel(){const sheetsSortUIService=core.useDependency(SheetsSortUIService),sheetsSortService=core.useDependency(sheetsSort.SheetsSortService),localeService=core.useDependency(core.LocaleService),[hasTitle,setHasTitle]=React.useState(!1),[scrollPosition,setScrollPosition]=React.useState(0),listEndRef=React.useRef(null),state=sheetsSortUIService.customSortState();if(!state||!state.location)return null;const{range,unitId,subUnitId}=state.location,titles=sheetsSortUIService.getTitles(hasTitle),[list,setList]=React.useState([{type:sheetsSort.SortType.ASC,colIndex:range.startColumn}]),onItemChange=React.useCallback((index,value)=>{const newList=[...list];value===null?newList.splice(index,1):newList[index]=value,setList(newList)},[list]),newItem=React.useCallback(core.throttle(()=>{const newList=[...list],nextColIndex=findNextColIndex(range,list);nextColIndex!==null&&(newList.push({type:sheetsSort.SortType.ASC,colIndex:nextColIndex}),setList(newList))},200),[list,range]),apply=React.useCallback((orderRules,hasTitle2)=>{sheetsSortService.applySort({range,orderRules,hasTitle:hasTitle2}),sheetsSortUIService.closeCustomSortPanel()},[sheetsSortService,sheetsSortUIService,range]),cancel=React.useCallback(()=>{sheetsSortUIService.closeCustomSortPanel()},[sheetsSortUIService]),setTitle=React.useCallback(value=>{setHasTitle(value),value?sheetsSortUIService.setSelection(unitId,subUnitId,{...range,startRow:range.startRow+1}):sheetsSortUIService.setSelection(unitId,subUnitId,range)},[sheetsSortUIService,range,subUnitId,unitId]);React.useEffect(()=>{listEndRef.current&&list.length>5&&(listEndRef.current.scrollTop=listEndRef.current.scrollHeight)},[list]);const canNew=list.length<titles.length,dragList=list.map(item=>({...item,id:`${item.colIndex}`}));return React.createElement("div",{className:styles.customSortPanelContainer},React.createElement("div",{className:styles.customSortPanelContent,onMouseDown:__name(e=>{e.stopPropagation()},"onMouseDown")},React.createElement("div",{className:styles.customSortPanelExt},React.createElement("div",{className:styles.firstRowCheck},React.createElement(design.Checkbox,{checked:hasTitle,onChange:__name(value=>setTitle(!!value),"onChange")},localeService.t("sheets-sort.dialog.first-row-check"))),canNew?React.createElement("div",{className:styles.addCondition,onClick:newItem},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition"))):React.createElement("div",{className:`${styles.addCondition} ${styles.addConditionDisable}`},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition")))),React.createElement("div",{className:styles.conditionList,onScroll:__name(e=>{const position=e.currentTarget.scrollTop;setScrollPosition(position)},"onScroll"),ref:listEndRef},React.createElement(design.DraggableList,{list:dragList,onListChange:setList,idKey:"id",draggableHandle:`.${styles.customSortPanelItemHandler}`,itemRender:__name(item=>React.createElement(SortOptionItem,{titles,list:dragList,item,onChange:__name((value,index)=>onItemChange(index,value),"onChange"),scrollPosition}),"itemRender"),rowHeight:32,margin:[0,12]}))),React.createElement("div",{className:styles.customSortPanelFooter},React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"default",onClick:__name(()=>cancel(),"onClick")},localeService.t("sheets-sort.dialog.cancel")),React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"primary",onClick:__name(()=>apply(list,hasTitle),"onClick")},localeService.t("sheets-sort.dialog.confirm"))))}__name(CustomSortPanel,"CustomSortPanel");function SortOptionItem(props){var _a4;const{list,item,titles,onChange,scrollPosition}=props,localeService=core.useDependency(core.LocaleService),availableMenu=titles.filter(title=>!list.some(item2=>item2.colIndex===title.index)||title.index===item.colIndex),currentIndex=list.findIndex(listItem=>listItem.colIndex===item.colIndex),handleChangeColIndex=React.useCallback(menuItem=>{onChange({...item,colIndex:menuItem.index},currentIndex),setVisible(!1)},[currentIndex,item,onChange]),[visible,setVisible]=React.useState(!1),onVisibleChange=__name(visible2=>{setVisible(visible2)},"onVisibleChange");React.useEffect(()=>{setVisible(!1)},[scrollPosition]);const showDelete=list.length>1,itemLabel=(_a4=titles.find(title=>title.index===item.colIndex))==null?void 0:_a4.label,radioClass=localeService.getCurrentLocale()===core.LocaleType.ZH_CN?styles.customSortPanelItemOrderRadioCn:styles.customSortPanelItemOrderRadio;return React.createElement("div",{className:styles.customSortPanelItem},React.createElement("div",{className:styles.customSortPanelItemHead},React.createElement("div",{className:styles.customSortPanelItemHandler},React.createElement(SequenceSingle,null)),React.createElement("div",{className:styles.customSortPanelItemColumn},React.createElement(design.Dropdown,{placement:"bottomLeft",trigger:["click"],visible,onVisibleChange,overlay:React.createElement("ul",{className:styles.customSortColMenu},availableMenu.map(menuItem=>React.createElement("li",{key:menuItem.index,onClick:__name(()=>handleChangeColIndex(menuItem),"onClick"),className:styles.customSortColMenuItem},React.createElement("span",{className:styles.customSortColMenuItemDesc},menuItem.label),React.createElement("span",{className:styles.customSortColMenuItemCheck},menuItem.index===item.colIndex&&React.createElement(CheckMarkSingle,null)))))},React.createElement("div",{className:styles.customSortPanelItemColumnInput},React.createElement("span",{className:styles.customSortPanelItemColumnInputText},itemLabel),React.createElement(MoreDownSingle,{className:styles.customSortPanelItemColumnInputDropdown}))))),React.createElement("div",{className:styles.customSortPanelItemOrder},React.createElement(design.RadioGroup,{className:radioClass,value:item.type,onChange:__name(value=>{onChange({...item,type:value},currentIndex)},"onChange")},React.createElement(design.Radio,{value:sheetsSort.SortType.ASC},localeService.t("sheets-sort.general.sort-asc")),React.createElement(design.Radio,{value:sheetsSort.SortType.DESC},localeService.t("sheets-sort.general.sort-desc")))),React.createElement("div",{className:styles.customSortPanelItemRemove},showDelete&&React.createElement(DeleteEmptySingle,{onClick:__name(()=>onChange(null,currentIndex),"onClick")})))}__name(SortOptionItem,"SortOptionItem");function findNextColIndex(range,list){const{startColumn,endColumn}=range,used=new Set(list.map(item=>item==null?void 0:item.colIndex));for(let i=startColumn;i<=endColumn;i++)if(!used.has(i))return i;return null}__name(findNextColIndex,"findNextColIndex");function EmbedSortBtn(props){const{range,colIndex,onClose}=props,sheetsSortUIService=core.useDependency(SheetsSortUIService),univerInstanceService=core.useDependency(core.IUniverInstanceService),localeService=core.useDependency(core.LocaleService),apply=React.useCallback(asc=>{const{unitId,subUnitId}=sheets.getSheetCommandTarget(univerInstanceService)||{};if(range&&unitId&&subUnitId){const noTitleRange={...range,startRow:range.startRow+1};sheetsSortUIService.triggerSortDirectly(asc,!1,{unitId,subUnitId,range:noTitleRange,colIndex})}else console.warn(`Cannot find the target to sort. unitId: ${unitId}, subUnitId: ${subUnitId}, range: ${range}, colIndex: ${colIndex}`);onClose()},[range,colIndex,sheetsSortUIService,univerInstanceService,onClose]);return React.createElement("div",{className:styles.embedSortBtnContainer},React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnAsc}`,onClick:__name(()=>apply(!0),"onClick")},React.createElement(AscendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-asc")),React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnDesc}`,onClick:__name(()=>apply(!1),"onClick")},React.createElement(DescendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-desc")))}__name(EmbedSortBtn,"EmbedSortBtn");const SHEETS_SORT_MENU_ID="sheet.menu.sheets-sort",SHEETS_SORT_CTX_MENU_ID="sheet.menu.sheets-sort-ctx",SHEETS_SORT_ASC_ICON="AscendingSingle",SHEETS_SORT_ASC_EXT_ICON="ExpandAscendingSingle",SHEETS_SORT_DESC_ICON="DescendingSingle",SHEETS_SORT_DESC_EXT_ICON="ExpandDescendingSingle",SHEETS_SORT_CUSTOM_ICON="CustomSortSingle";function sortRangeMenuFactory(accessor){return{id:SHEETS_SORT_MENU_ID,type:ui.MenuItemType.SUBITEMS,positions:[ui.MenuPosition.TOOLBAR_START],group:ui.MenuGroup.TOOLBAR_FORMULAS_INSERT,icon:SHEETS_SORT_ASC_ICON,tooltip:"sheets-sort.general.sort",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeMenuFactory,"sortRangeMenuFactory");function sortRangeAscMenuFactory(_accessor){return{id:SortRangeAscCommand.id,icon:SHEETS_SORT_ASC_ICON,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeAscMenuFactory,"sortRangeAscMenuFactory");function sortRangeAscExtMenuFactory(_accessor){return{id:SortRangeAscExtCommand.id,title:"sheets-sort.general.sort-asc-ext",icon:SHEETS_SORT_ASC_EXT_ICON,type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeAscExtMenuFactory,"sortRangeAscExtMenuFactory");function sortRangeDescMenuFactory(_accessor){return{id:SortRangeDescCommand.id,title:"sheets-sort.general.sort-desc-cur",icon:SHEETS_SORT_DESC_ICON,type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeDescMenuFactory,"sortRangeDescMenuFactory");function sortRangeDescExtMenuFactory(_accessor){return{id:SortRangeDescExtCommand.id,title:"sheets-sort.general.sort-desc-ext",icon:SHEETS_SORT_DESC_EXT_ICON,type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeDescExtMenuFactory,"sortRangeDescExtMenuFactory");function sortRangeCustomMenuFactory(_accessor){return{id:SortRangeCustomCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID],icon:SHEETS_SORT_CUSTOM_ICON}}__name(sortRangeCustomMenuFactory,"sortRangeCustomMenuFactory");function sortRangeCtxMenuFactory(accessor){return{id:SHEETS_SORT_CTX_MENU_ID,title:"sheets-sort.general.sort",type:ui.MenuItemType.SUBITEMS,positions:[ui.MenuPosition.CONTEXT_MENU,sheetsUi.SheetMenuPosition.COL_HEADER_CONTEXT_MENU,sheetsUi.SheetMenuPosition.ROW_HEADER_CONTEXT_MENU],group:ui.MenuGroup.CONTEXT_MENU_DATA,icon:SHEETS_SORT_ASC_ICON,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCtxMenuFactory,"sortRangeCtxMenuFactory");function sortRangeAscCtxMenuFactory(_accessor){return{id:SortRangeAscInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_ICON,positions:[SHEETS_SORT_CTX_MENU_ID],disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscCtxMenuFactory,"sortRangeAscCtxMenuFactory");function sortRangeAscExtCtxMenuFactory(_accessor){return{id:SortRangeAscExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-ext",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_EXT_ICON,positions:[SHEETS_SORT_CTX_MENU_ID],disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscExtCtxMenuFactory,"sortRangeAscExtCtxMenuFactory");function sortRangeDescCtxMenuFactory(_accessor){return{id:SortRangeDescInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-cur",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_CTX_MENU_ID],icon:SHEETS_SORT_DESC_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescCtxMenuFactory,"sortRangeDescCtxMenuFactory");function sortRangeDescExtCtxMenuFactory(_accessor){return{id:SortRangeDescExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-ext",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_CTX_MENU_ID],icon:SHEETS_SORT_DESC_EXT_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescExtCtxMenuFactory,"sortRangeDescExtCtxMenuFactory");function sortRangeCustomCtxMenuFactory(_accessor){return{id:SortRangeCustomInCtxMenuCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_CTX_MENU_ID],icon:SHEETS_SORT_CUSTOM_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCustomCtxMenuFactory,"sortRangeCustomCtxMenuFactory");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const DefaultSheetsSortUIConfig={menu:{}},CUSTOM_SORT_DIALOG_ID="custom-sort-dialog",CUSTOM_SORT_PANEL_WIDTH=560;var _a2;let SheetsSortUIController=(_a2=class extends core.RxDisposable{constructor(_config,_commandService,_menuService,_dialogService,_layoutService,_uiPartsService,_sheetRenderService,_localeService,_sheetsSortUIService,_injector,_componentManager){super(),this._config=_config,this._commandService=_commandService,this._menuService=_menuService,this._dialogService=_dialogService,this._layoutService=_layoutService,this._uiPartsService=_uiPartsService,this._sheetRenderService=_sheetRenderService,this._localeService=_localeService,this._sheetsSortUIService=_sheetsSortUIService,this._injector=_injector,this._componentManager=_componentManager,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){const{menu={}}=this._config;[sortRangeMenuFactory,sortRangeAscMenuFactory,sortRangeDescMenuFactory,sortRangeAscExtMenuFactory,sortRangeDescExtMenuFactory,sortRangeCustomMenuFactory,sortRangeCtxMenuFactory,sortRangeAscCtxMenuFactory,sortRangeDescCtxMenuFactory,sortRangeAscExtCtxMenuFactory,sortRangeDescExtCtxMenuFactory,sortRangeCustomCtxMenuFactory].forEach(factory=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory),menu))})}_initCommands(){[SortRangeAscCommand,SortRangeAscExtCommand,SortRangeDescCommand,SortRangeDescExtCommand,SortRangeCustomCommand,SortRangeAscInCtxMenuCommand,SortRangeAscExtInCtxMenuCommand,SortRangeDescInCtxMenuCommand,SortRangeDescExtInCtxMenuCommand,SortRangeCustomInCtxMenuCommand].forEach(command=>this.disposeWithMe(this._commandService.registerCommand(command))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(sheetsSort.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",CustomSortPanel)),this.disposeWithMe(this._uiPartsService.registerComponent(sheetsUi.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>core.connectInjector(EmbedSortBtn,this._injector))),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_ICON,AscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_EXT_ICON,ExpandAscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_ICON,DescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_EXT_ICON,ExpandDescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_CUSTOM_ICON,CustomSortSingle)),this._sheetsSortUIService.customSortState$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(newState=>{newState&&newState.show&&newState.location?this._openCustomSortPanel(newState.location):newState&&!(newState!=null&&newState.show)&&this._closePanel()})}_openCustomSortPanel(location){this._dialogService.open({id:CUSTOM_SORT_DIALOG_ID,draggable:!0,width:CUSTOM_SORT_PANEL_WIDTH,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${engineFormula.serializeRange(location.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:getCustomSortDialogDefaultPosition(),preservePositionOnDestroy:!1,onClose:__name(()=>this._closePanel(),"onClose"),mask:!0})}_closePanel(){this._dialogService.close(CUSTOM_SORT_DIALOG_ID),queueMicrotask(()=>this._layoutService.focus())}},__name(_a2,"SheetsSortUIController"),_a2);SheetsSortUIController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Ready,SheetsSortUIController),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuService),__decorateParam$1(3,ui.IDialogService),__decorateParam$1(4,ui.ILayoutService),__decorateParam$1(5,ui.IUIPartsService),__decorateParam$1(6,core.Inject(sheetsUi.SheetsRenderService)),__decorateParam$1(7,core.Inject(core.LocaleService)),__decorateParam$1(8,core.Inject(SheetsSortUIService)),__decorateParam$1(9,core.Inject(core.Injector)),__decorateParam$1(10,core.Inject(ui.ComponentManager))],SheetsSortUIController);function getCustomSortDialogDefaultPosition(){return{x:0,y:0}}__name(getCustomSortDialogDefaultPosition,"getCustomSortDialogDefaultPosition");var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");const NAME="UNIVER_SHEETS_SORT_UI_PLUGIN";var _a3;exports.UniverSheetsSortUIPlugin=(_a3=class extends core.Plugin{constructor(_config={},_injector,_localeService){super(),this._config=_config,this._injector=_injector,this._localeService=_localeService,this._config=core.Tools.deepMerge({},DefaultSheetsSortUIConfig,this._config)}onStarting(){[[SheetsSortUIService],[SheetsSortUIController,{useFactory:__name(()=>this._injector.createInstance(SheetsSortUIController,this._config),"useFactory")}]].forEach(d=>this._injector.add(d))}},__name(_a3,"UniverSheetsSortUIPlugin"),_a3);__publicField2(exports.UniverSheetsSortUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET);__publicField2(exports.UniverSheetsSortUIPlugin,"pluginName",NAME);exports.UniverSheetsSortUIPlugin=__decorateClass([core.DependentOn(sheetsSort.UniverSheetsSortPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.Inject(core.LocaleService))],exports.UniverSheetsSortUIPlugin);exports.SortRangeAscCommand=SortRangeAscCommand;exports.SortRangeAscExtCommand=SortRangeAscExtCommand;exports.SortRangeAscExtInCtxMenuCommand=SortRangeAscExtInCtxMenuCommand;exports.SortRangeAscInCtxMenuCommand=SortRangeAscInCtxMenuCommand;exports.SortRangeCustomCommand=SortRangeCustomCommand;exports.SortRangeCustomInCtxMenuCommand=SortRangeCustomInCtxMenuCommand;exports.SortRangeDescCommand=SortRangeDescCommand;exports.SortRangeDescExtCommand=SortRangeDescExtCommand;exports.SortRangeDescExtInCtxMenuCommand=SortRangeDescExtInCtxMenuCommand;exports.SortRangeDescInCtxMenuCommand=SortRangeDescInCtxMenuCommand;
1
+ "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@univerjs/core"),sheetsSort=require("@univerjs/sheets-sort"),sheets=require("@univerjs/sheets"),React=require("react"),ui=require("@univerjs/ui"),rxjs=require("rxjs"),design=require("@univerjs/design"),engineFormula=require("@univerjs/engine-formula"),sheetsUi=require("@univerjs/sheets-ui"),extendConfirmContent="univer-extend-confirm-content",extendConfirmRadioGroup="univer-extend-confirm-radio-group",customSortPanelContainer="univer-custom-sort-panel-container",customSortPanelExt="univer-custom-sort-panel-ext",addCondition="univer-add-condition",addConditionText="univer-add-condition-text",addConditionDisable="univer-add-condition-disable",customSortPanelFooter="univer-custom-sort-panel-footer",customSortPanelFooterBtn="univer-custom-sort-panel-footer-btn",customSortPanelItem="univer-custom-sort-panel-item",customSortPanelItemHead="univer-custom-sort-panel-item-head",customSortPanelItemHandler="univer-custom-sort-panel-item-handler",customSortPanelItemRemove="univer-custom-sort-panel-item-remove",customSortPanelItemColumnInput="univer-custom-sort-panel-item-column-input",customSortPanelItemColumnInputDropdown="univer-custom-sort-panel-item-column-input-dropdown",customSortPanelItemColumnInputText="univer-custom-sort-panel-item-column-input-text",customSortPanelItemOrderRadio="univer-custom-sort-panel-item-order-radio",customSortPanelItemOrderRadioCn="univer-custom-sort-panel-item-order-radio-cn",conditionList="univer-condition-list",embedSortBtnContainer="univer-embed-sort-btn-container",embedSortBtn="univer-embed-sort-btn",embedSortBtnAsc="univer-embed-sort-btn-asc",embedSortBtnDesc="univer-embed-sort-btn-desc",embedSortBtnIcon="univer-embed-sort-btn-icon",customSortColMenu="univer-custom-sort-col-menu",customSortColMenuItem="univer-custom-sort-col-menu-item",customSortColMenuItemDesc="univer-custom-sort-col-menu-item-desc",styles={extendConfirmContent,extendConfirmRadioGroup,customSortPanelContainer,customSortPanelExt,addCondition,addConditionText,addConditionDisable,customSortPanelFooter,customSortPanelFooterBtn,customSortPanelItem,customSortPanelItemHead,customSortPanelItemHandler,customSortPanelItemRemove,customSortPanelItemColumnInput,customSortPanelItemColumnInputDropdown,customSortPanelItemColumnInputText,customSortPanelItemOrderRadio,customSortPanelItemOrderRadioCn,conditionList,embedSortBtnContainer,embedSortBtn,embedSortBtnAsc,embedSortBtnDesc,embedSortBtnIcon,customSortColMenu,customSortColMenuItem,customSortColMenuItemDesc},ExtendConfirm=__name(props=>{const[extend,setExtend]=React.useState("0"),localeService=core.useDependency(core.LocaleService);return React.createElement("div",{className:styles.extendConfirmContent},React.createElement("div",{className:"extend-confirm-desc"},localeService.t("sheets-sort.dialog.sort-reminder-desc")),React.createElement(design.RadioGroup,{className:styles.extendConfirmRadioGroup,value:extend,direction:"vertical",onChange:__name(value=>{setExtend(value),props.onChange(value)},"onChange")},React.createElement(design.Radio,{value:"0"},localeService.t("sheets-sort.dialog.sort-reminder-no")),React.createElement(design.Radio,{value:"1"},localeService.t("sheets-sort.dialog.sort-reminder-ext"))))},"ExtendConfirm");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");const SORT_ERROR_MESSAGE={MERGE_ERROR:"sheets-sort.error.merge-size",EMPTY_ERROR:"sheets-sort.error.empty",SINGLE_ERROR:"sheets-sort.error.single",FORMULA_ARRAY:"sheets-sort.error.formula-array"};var _a;let SheetsSortUIService=(_a=class extends core.Disposable{constructor(_univerInstanceService,_confirmService,_logService,_selectionManagerService,_sheetsSortService,_localeService,_commandService){super();__publicField(this,"_customSortState$",new rxjs.BehaviorSubject(null));__publicField(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=_univerInstanceService,this._confirmService=_confirmService,this._logService=_logService,this._selectionManagerService=_selectionManagerService,this._sheetsSortService=_sheetsSortService,this._localeService=_localeService,this._commandService=_commandService}async triggerSortDirectly(asc,extend,sheetRangeLocation){const location=sheetRangeLocation||await this._detectSortLocation(extend);if(!location||!this._check(location))return!1;const sortOption={orderRules:[{type:asc?sheetsSort.SortType.ASC:sheetsSort.SortType.DESC,colIndex:location.colIndex}],range:location.range};return this._sheetsSortService.applySort(sortOption,location.unitId,location.subUnitId),!0}async triggerSortCustomize(){const location=await this._detectSortLocation();return!location||!this._check(location)?!1:(this.showCustomSortPanel(location),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(hasTitle){var _a4,_b;const location=(_a4=this.customSortState())==null?void 0:_a4.location;if(!location)return[];const{unitId,subUnitId,range}=location,worksheet=(_b=this._univerInstanceService.getUnit(unitId))==null?void 0:_b.getSheetBySheetId(subUnitId);if(!worksheet)return[];const colTranslator=colIndexTranslator(this._localeService);return Array.from({length:range.endColumn-range.startColumn+1},(_,i)=>{var _a5;const cellValue=(_a5=worksheet.getCell(range.startRow,i+range.startColumn))==null?void 0:_a5.v;return{index:i+range.startColumn,label:hasTitle?`${cellValue!=null?cellValue:colTranslator(i+range.startColumn)}`:colTranslator(i+range.startColumn)}})}setSelection(unitId,subUnitId,range){var _a4;const worksheet=(_a4=this._univerInstanceService.getUnit(unitId))==null?void 0:_a4.getSheetBySheetId(subUnitId);if(!worksheet)return;const setSelectionsOperationParams={unitId,subUnitId,selections:[{range,primary:sheets.getPrimaryForRange(range,worksheet),style:null}]};this._commandService.executeCommand(sheets.SetSelectionsOperation.id,setSelectionsOperationParams)}async showCheckError(content){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:React.createElement("div",null,this._localeService.t(content))}})}async showExtendConfirm(){let shouldExtend=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:React.createElement(ExtendConfirm,{onChange:__name(value=>{shouldExtend=value==="1"},"onChange")})},width:400})?shouldExtend?"extend":"keep":"cancel"}showCustomSortPanel(location){this._customSortState$.next({location,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(location){return this._sheetsSortService.singleCheck(location)?this._sheetsSortService.mergeCheck(location)?this._sheetsSortService.formulaCheck(location)?this._sheetsSortService.emptyCheck(location)?!0:(this.showCheckError(SORT_ERROR_MESSAGE.EMPTY_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.FORMULA_ARRAY),!1):(this.showCheckError(SORT_ERROR_MESSAGE.MERGE_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.SINGLE_ERROR),!1)}async _detectSortLocation(extend){const workbook=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook.getActiveSheet(),unitId=workbook.getUnitId(),subUnitId=worksheet.getSheetId(),selection=this._selectionManagerService.getCurrentLastSelection();if(!selection)return null;let range;if(extend===!0)range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range);else if(extend===!1)range=selection.range;else{const confirmRes=await this.showExtendConfirm();if(confirmRes==="cancel")return null;confirmRes==="keep"?range=selection.range:(range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range))}return{range,unitId,subUnitId,colIndex:selection.primary.actualColumn}}},__name(_a,"SheetsSortUIService"),_a);SheetsSortUIService=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,sheetsSort.SheetsSortService),__decorateParam$2(0,core.IUniverInstanceService),__decorateParam$2(1,ui.IConfirmService),__decorateParam$2(2,core.ILogService),__decorateParam$2(3,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$2(4,core.Inject(sheetsSort.SheetsSortService)),__decorateParam$2(5,core.Inject(core.LocaleService)),__decorateParam$2(6,core.ICommandService)],SheetsSortUIService);function colIndexTranslator(localeService){return colIndex=>{const colName=core.Tools.chatAtABC(colIndex);switch(localeService.getCurrentLocale()){case core.LocaleType.ZH_CN:return`"${colName}"列`;case core.LocaleType.EN_US:return`Column "${colName}"`;default:return`Column "${colName}"`}}}__name(colIndexTranslator,"colIndexTranslator");var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=React.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=React.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return React.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a4){var key=_a4[0],value=_a4[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a4,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a4=node.children)===null||_a4===void 0)&&_a4.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid");IconBase.displayName="UniverIcon";var element$9={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},AscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"ascending- single",ref,icon:element$9}))});AscendingSingle.displayName="AscendingSingle";var element$8={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CheckMarkSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$8}))});CheckMarkSingle.displayName="CheckMarkSingle";var element$7={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574 8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507 9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661 11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306zM6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512 7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574 6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588 4.88808 9.55156 5.26798 9.55156 5.50229 9.78588L6.22584 10.5094z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.14014 3.73989C1.14014 2.30396 2.3042 1.13989 3.74014 1.13989H12.2601C13.6961 1.13989 14.8601 2.30395 14.8601 3.73989V12.2599C14.8601 13.6958 13.6961 14.8599 12.2601 14.8599H3.74014C2.3042 14.8599 1.14014 13.6958 1.14014 12.2599V3.73989ZM2.34014 5.86724V12.2599C2.34014 13.0331 2.96694 13.6599 3.74014 13.6599H12.2601C13.0333 13.6599 13.6601 13.0331 13.6601 12.2599V5.86724H2.34014ZM13.6601 4.66724H2.34014V3.73989C2.34014 2.9667 2.96694 2.33989 3.74014 2.33989H12.2601C13.0333 2.33989 13.6601 2.96669 13.6601 3.73989V4.66724Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CustomSortSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"custom-sort-single",ref,icon:element$7}))});CustomSortSingle.displayName="CustomSortSingle";var element$6={tag:"svg",attrs:{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.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.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.64443 14.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:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V13.1332C3.15332 14.2377 4.04875 15.1332 5.15332 15.1332H10.8465C11.9511 15.1332 12.8465 14.2377 12.8465 13.1331V6.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.82217V13.1331C11.6465 13.575 11.2884 13.9331 10.8465 13.9331H5.15332C4.71149 13.9331 4.35332 13.575 4.35332 13.1332V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},DeleteEmptySingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"delete-empty-single",ref,icon:element$6}))});DeleteEmptySingle.displayName="DeleteEmptySingle";var element$5={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},DescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"descending-single",ref,icon:element$5}))});DescendingSingle.displayName="DescendingSingle";var element$4={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 3.20024C1.57503 3.20024 1.3064 2.93161 1.3064 2.60024C1.3064 2.26887 1.57503 2.00024 1.9064 2.00024H4.57306C4.90443 2.00024 5.17306 2.26887 5.17306 2.60024C5.17306 2.93161 4.90443 3.20024 4.57306 3.20024H1.9064ZM1.3064 6.19985C1.3064 6.53122 1.57503 6.79985 1.9064 6.79985H5.9064C6.23777 6.79985 6.5064 6.53122 6.5064 6.19985C6.5064 5.86848 6.23777 5.59985 5.9064 5.59985H1.9064C1.57503 5.59985 1.3064 5.86848 1.3064 6.19985ZM1.9064 10.3997C1.57503 10.3997 1.3064 10.1311 1.3064 9.79971C1.3064 9.46834 1.57503 9.19971 1.9064 9.19971H7.23973C7.5711 9.19971 7.83973 9.46834 7.83973 9.79971C7.83973 10.1311 7.5711 10.3997 7.23973 10.3997H1.9064ZM1.9064 13.9996C1.57503 13.9996 1.3064 13.7309 1.3064 13.3996C1.3064 13.0682 1.57503 12.7996 1.9064 12.7996H8.57306C8.90443 12.7996 9.17306 13.0682 9.17306 13.3996C9.17306 13.7309 8.90443 13.9996 8.57306 13.9996H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 14.2667C12.4267 14.5981 12.1581 14.8667 11.8267 14.8667C11.4953 14.8667 11.2267 14.5981 11.2267 14.2667V3.18198L9.98447 4.42422C9.75015 4.65853 9.37026 4.65853 9.13594 4.42422C8.90163 4.1899 8.90163 3.81 9.13594 3.57569L11.4026 1.30902C11.6369 1.07471 12.0168 1.07471 12.2511 1.30902L14.5178 3.57569C14.7521 3.81 14.7521 4.1899 14.5178 4.42422C14.2835 4.65853 13.9036 4.65853 13.6693 4.42422L12.4267 3.18165V14.2667Z"}}]},ExpandAscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-ascending-single",ref,icon:element$4}))});ExpandAscendingSingle.displayName="ExpandAscendingSingle";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 12.7998C1.57503 12.7998 1.3064 13.0684 1.3064 13.3998C1.3064 13.7311 1.57503 13.9998 1.9064 13.9998H4.57306C4.90443 13.9998 5.17306 13.7311 5.17306 13.3998C5.17306 13.0684 4.90443 12.7998 4.57306 12.7998H1.9064ZM1.3064 9.80015C1.3064 9.46878 1.57503 9.20015 1.9064 9.20015H5.9064C6.23777 9.20015 6.5064 9.46878 6.5064 9.80015C6.5064 10.1315 6.23777 10.4001 5.9064 10.4001H1.9064C1.57503 10.4001 1.3064 10.1315 1.3064 9.80015ZM1.9064 5.60029C1.57503 5.60029 1.3064 5.86892 1.3064 6.20029C1.3064 6.53166 1.57503 6.80029 1.9064 6.80029H7.23973C7.5711 6.80029 7.83973 6.53166 7.83973 6.20029C7.83973 5.86892 7.5711 5.60029 7.23973 5.60029H1.9064ZM1.9064 2.00044C1.57503 2.00044 1.3064 2.26907 1.3064 2.60044C1.3064 2.93181 1.57503 3.20044 1.9064 3.20044H8.57306C8.90443 3.20044 9.17306 2.93181 9.17306 2.60044C9.17306 2.26907 8.90443 2.00044 8.57306 2.00044H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 1.7333C12.4267 1.40193 12.1581 1.1333 11.8267 1.1333C11.4953 1.1333 11.2267 1.40193 11.2267 1.7333V12.818L9.98447 11.5758C9.75015 11.3415 9.37026 11.3415 9.13594 11.5758C8.90163 11.8101 8.90163 12.19 9.13594 12.4243L11.4026 14.691C11.6369 14.9253 12.0168 14.9253 12.2511 14.691L14.5178 12.4243C14.7521 12.19 14.7521 11.8101 14.5178 11.5758C14.2835 11.3415 13.9036 11.3415 13.6693 11.5758L12.4267 12.8183V1.7333Z"}}]},ExpandDescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-descending-single",ref,icon:element$3}))});ExpandDescendingSingle.displayName="ExpandDescendingSingle";var element$2={tag:"svg",attrs:{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"}}]},IncreaseSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"increase-single",ref,icon:element$2}))});IncreaseSingle.displayName="IncreaseSingle";var element$1={tag:"svg",attrs:{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"}}]},MoreDownSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"more-down-single",ref,icon:element$1}))});MoreDownSingle.displayName="MoreDownSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},SequenceSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"sequence-single",ref,icon:element}))});SequenceSingle.displayName="SequenceSingle";const SortRangeAscCommand={id:"sheet.command.sort-range-asc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtCommand={id:"sheet.command.sort-range-asc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescCommand={id:"sheet.command.sort-range-desc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtCommand={id:"sheet.command.sort-range-desc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomCommand={id:"sheet.command.sort-range-custom",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")},SortRangeAscInCtxMenuCommand={id:"sheet.command.sort-range-asc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtInCtxMenuCommand={id:"sheet.command.sort-range-asc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescInCtxMenuCommand={id:"sheet.command.sort-range-desc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtInCtxMenuCommand={id:"sheet.command.sort-range-desc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomInCtxMenuCommand={id:"sheet.command.sort-range-custom-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")};function CustomSortPanel(){const sheetsSortUIService=core.useDependency(SheetsSortUIService),sheetsSortService=core.useDependency(sheetsSort.SheetsSortService),localeService=core.useDependency(core.LocaleService),[hasTitle,setHasTitle]=React.useState(!1),[scrollPosition,setScrollPosition]=React.useState(0),listEndRef=React.useRef(null),state=sheetsSortUIService.customSortState();if(!state||!state.location)return null;const{range,unitId,subUnitId}=state.location,titles=sheetsSortUIService.getTitles(hasTitle),[list,setList]=React.useState([{type:sheetsSort.SortType.ASC,colIndex:range.startColumn}]),onItemChange=React.useCallback((index,value)=>{const newList=[...list];value===null?newList.splice(index,1):newList[index]=value,setList(newList)},[list]),newItem=React.useCallback(core.throttle(()=>{const newList=[...list],nextColIndex=findNextColIndex(range,list);nextColIndex!==null&&(newList.push({type:sheetsSort.SortType.ASC,colIndex:nextColIndex}),setList(newList))},200),[list,range]),apply=React.useCallback((orderRules,hasTitle2)=>{sheetsSortService.applySort({range,orderRules,hasTitle:hasTitle2}),sheetsSortUIService.closeCustomSortPanel()},[sheetsSortService,sheetsSortUIService,range]),cancel=React.useCallback(()=>{sheetsSortUIService.closeCustomSortPanel()},[sheetsSortUIService]),setTitle=React.useCallback(value=>{setHasTitle(value),value?sheetsSortUIService.setSelection(unitId,subUnitId,{...range,startRow:range.startRow+1}):sheetsSortUIService.setSelection(unitId,subUnitId,range)},[sheetsSortUIService,range,subUnitId,unitId]);React.useEffect(()=>{listEndRef.current&&list.length>5&&(listEndRef.current.scrollTop=listEndRef.current.scrollHeight)},[list]);const canNew=list.length<titles.length,dragList=list.map(item=>({...item,id:`${item.colIndex}`}));return React.createElement("div",{className:styles.customSortPanelContainer},React.createElement("div",{className:styles.customSortPanelContent,onMouseDown:__name(e=>{e.stopPropagation()},"onMouseDown")},React.createElement("div",{className:styles.customSortPanelExt},React.createElement("div",{className:styles.firstRowCheck},React.createElement(design.Checkbox,{checked:hasTitle,onChange:__name(value=>setTitle(!!value),"onChange")},localeService.t("sheets-sort.dialog.first-row-check"))),canNew?React.createElement("div",{className:styles.addCondition,onClick:newItem},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition"))):React.createElement("div",{className:`${styles.addCondition} ${styles.addConditionDisable}`},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition")))),React.createElement("div",{className:styles.conditionList,onScroll:__name(e=>{const position=e.currentTarget.scrollTop;setScrollPosition(position)},"onScroll"),ref:listEndRef},React.createElement(design.DraggableList,{list:dragList,onListChange:setList,idKey:"id",draggableHandle:`.${styles.customSortPanelItemHandler}`,itemRender:__name(item=>React.createElement(SortOptionItem,{titles,list:dragList,item,onChange:__name((value,index)=>onItemChange(index,value),"onChange"),scrollPosition}),"itemRender"),rowHeight:32,margin:[0,12]}))),React.createElement("div",{className:styles.customSortPanelFooter},React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"default",onClick:__name(()=>cancel(),"onClick")},localeService.t("sheets-sort.dialog.cancel")),React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"primary",onClick:__name(()=>apply(list,hasTitle),"onClick")},localeService.t("sheets-sort.dialog.confirm"))))}__name(CustomSortPanel,"CustomSortPanel");function SortOptionItem(props){var _a4;const{list,item,titles,onChange,scrollPosition}=props,localeService=core.useDependency(core.LocaleService),availableMenu=titles.filter(title=>!list.some(item2=>item2.colIndex===title.index)||title.index===item.colIndex),currentIndex=list.findIndex(listItem=>listItem.colIndex===item.colIndex),handleChangeColIndex=React.useCallback(menuItem=>{onChange({...item,colIndex:menuItem.index},currentIndex),setVisible(!1)},[currentIndex,item,onChange]),[visible,setVisible]=React.useState(!1),onVisibleChange=__name(visible2=>{setVisible(visible2)},"onVisibleChange");React.useEffect(()=>{setVisible(!1)},[scrollPosition]);const showDelete=list.length>1,itemLabel=(_a4=titles.find(title=>title.index===item.colIndex))==null?void 0:_a4.label,radioClass=localeService.getCurrentLocale()===core.LocaleType.ZH_CN?styles.customSortPanelItemOrderRadioCn:styles.customSortPanelItemOrderRadio;return React.createElement("div",{className:styles.customSortPanelItem},React.createElement("div",{className:styles.customSortPanelItemHead},React.createElement("div",{className:styles.customSortPanelItemHandler},React.createElement(SequenceSingle,null)),React.createElement("div",{className:styles.customSortPanelItemColumn},React.createElement(design.Dropdown,{placement:"bottomLeft",trigger:["click"],visible,onVisibleChange,overlay:React.createElement("ul",{className:styles.customSortColMenu},availableMenu.map(menuItem=>React.createElement("li",{key:menuItem.index,onClick:__name(()=>handleChangeColIndex(menuItem),"onClick"),className:styles.customSortColMenuItem},React.createElement("span",{className:styles.customSortColMenuItemDesc},menuItem.label),React.createElement("span",{className:styles.customSortColMenuItemCheck},menuItem.index===item.colIndex&&React.createElement(CheckMarkSingle,null)))))},React.createElement("div",{className:styles.customSortPanelItemColumnInput},React.createElement("span",{className:styles.customSortPanelItemColumnInputText},itemLabel),React.createElement(MoreDownSingle,{className:styles.customSortPanelItemColumnInputDropdown}))))),React.createElement("div",{className:styles.customSortPanelItemOrder},React.createElement(design.RadioGroup,{className:radioClass,value:item.type,onChange:__name(value=>{onChange({...item,type:value},currentIndex)},"onChange")},React.createElement(design.Radio,{value:sheetsSort.SortType.ASC},localeService.t("sheets-sort.general.sort-asc")),React.createElement(design.Radio,{value:sheetsSort.SortType.DESC},localeService.t("sheets-sort.general.sort-desc")))),React.createElement("div",{className:styles.customSortPanelItemRemove},showDelete&&React.createElement(DeleteEmptySingle,{onClick:__name(()=>onChange(null,currentIndex),"onClick")})))}__name(SortOptionItem,"SortOptionItem");function findNextColIndex(range,list){const{startColumn,endColumn}=range,used=new Set(list.map(item=>item==null?void 0:item.colIndex));for(let i=startColumn;i<=endColumn;i++)if(!used.has(i))return i;return null}__name(findNextColIndex,"findNextColIndex");function EmbedSortBtn(props){const{range,colIndex,onClose}=props,sheetsSortUIService=core.useDependency(SheetsSortUIService),univerInstanceService=core.useDependency(core.IUniverInstanceService),localeService=core.useDependency(core.LocaleService),apply=React.useCallback(asc=>{const{unitId,subUnitId}=sheets.getSheetCommandTarget(univerInstanceService)||{};if(range&&unitId&&subUnitId){const noTitleRange={...range,startRow:range.startRow+1};sheetsSortUIService.triggerSortDirectly(asc,!1,{unitId,subUnitId,range:noTitleRange,colIndex})}else console.warn(`Cannot find the target to sort. unitId: ${unitId}, subUnitId: ${subUnitId}, range: ${range}, colIndex: ${colIndex}`);onClose()},[range,colIndex,sheetsSortUIService,univerInstanceService,onClose]);return React.createElement("div",{className:styles.embedSortBtnContainer},React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnAsc}`,onClick:__name(()=>apply(!0),"onClick")},React.createElement(AscendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-asc")),React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnDesc}`,onClick:__name(()=>apply(!1),"onClick")},React.createElement(DescendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-desc")))}__name(EmbedSortBtn,"EmbedSortBtn");const SHEETS_SORT_MENU_ID="sheet.menu.sheets-sort",SHEETS_SORT_CTX_MENU_ID="sheet.menu.sheets-sort-ctx",SHEETS_SORT_ASC_ICON="AscendingSingle",SHEETS_SORT_ASC_EXT_ICON="ExpandAscendingSingle",SHEETS_SORT_DESC_ICON="DescendingSingle",SHEETS_SORT_DESC_EXT_ICON="ExpandDescendingSingle",SHEETS_SORT_CUSTOM_ICON="CustomSortSingle";function sortRangeMenuFactory(accessor){return{id:SHEETS_SORT_MENU_ID,type:ui.MenuItemType.SUBITEMS,icon:SHEETS_SORT_ASC_ICON,tooltip:"sheets-sort.general.sort",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeMenuFactory,"sortRangeMenuFactory");function sortRangeAscMenuFactory(_accessor){return{id:SortRangeAscCommand.id,icon:SHEETS_SORT_ASC_ICON,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON}}__name(sortRangeAscMenuFactory,"sortRangeAscMenuFactory");function sortRangeAscExtMenuFactory(_accessor){return{id:SortRangeAscExtCommand.id,title:"sheets-sort.general.sort-asc-ext",icon:SHEETS_SORT_ASC_EXT_ICON,type:ui.MenuItemType.BUTTON}}__name(sortRangeAscExtMenuFactory,"sortRangeAscExtMenuFactory");function sortRangeDescMenuFactory(_accessor){return{id:SortRangeDescCommand.id,title:"sheets-sort.general.sort-desc-cur",icon:SHEETS_SORT_DESC_ICON,type:ui.MenuItemType.BUTTON}}__name(sortRangeDescMenuFactory,"sortRangeDescMenuFactory");function sortRangeDescExtMenuFactory(_accessor){return{id:SortRangeDescExtCommand.id,title:"sheets-sort.general.sort-desc-ext",icon:SHEETS_SORT_DESC_EXT_ICON,type:ui.MenuItemType.BUTTON}}__name(sortRangeDescExtMenuFactory,"sortRangeDescExtMenuFactory");function sortRangeCustomMenuFactory(_accessor){return{id:SortRangeCustomCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_CUSTOM_ICON}}__name(sortRangeCustomMenuFactory,"sortRangeCustomMenuFactory");function sortRangeCtxMenuFactory(accessor){return{id:SHEETS_SORT_CTX_MENU_ID,title:"sheets-sort.general.sort",type:ui.MenuItemType.SUBITEMS,icon:SHEETS_SORT_ASC_ICON,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCtxMenuFactory,"sortRangeCtxMenuFactory");function sortRangeAscCtxMenuFactory(_accessor){return{id:SortRangeAscInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscCtxMenuFactory,"sortRangeAscCtxMenuFactory");function sortRangeAscExtCtxMenuFactory(_accessor){return{id:SortRangeAscExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-ext",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_EXT_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscExtCtxMenuFactory,"sortRangeAscExtCtxMenuFactory");function sortRangeDescCtxMenuFactory(_accessor){return{id:SortRangeDescInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-cur",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_DESC_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescCtxMenuFactory,"sortRangeDescCtxMenuFactory");function sortRangeDescExtCtxMenuFactory(_accessor){return{id:SortRangeDescExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-ext",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_DESC_EXT_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescExtCtxMenuFactory,"sortRangeDescExtCtxMenuFactory");function sortRangeCustomCtxMenuFactory(_accessor){return{id:SortRangeCustomInCtxMenuCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_CUSTOM_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCustomCtxMenuFactory,"sortRangeCustomCtxMenuFactory");const menuSchema={[ui.RibbonStartGroup.FORMULAS_INSERT]:{[SHEETS_SORT_MENU_ID]:{order:2,menuItemFactory:sortRangeMenuFactory,[SortRangeAscCommand.id]:{order:0,menuItemFactory:sortRangeAscMenuFactory},[SortRangeAscExtCommand.id]:{order:1,menuItemFactory:sortRangeAscExtMenuFactory},[SortRangeDescCommand.id]:{order:2,menuItemFactory:sortRangeDescMenuFactory},[SortRangeDescExtCommand.id]:{order:3,menuItemFactory:sortRangeDescExtMenuFactory},[SortRangeCustomCommand.id]:{order:4,menuItemFactory:sortRangeCustomMenuFactory}}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.DATA]:{[SHEETS_SORT_CTX_MENU_ID]:{order:0,menuItemFactory:sortRangeCtxMenuFactory,[SortRangeAscInCtxMenuCommand.id]:{order:0,menuItemFactory:sortRangeAscCtxMenuFactory},[SortRangeAscExtInCtxMenuCommand.id]:{order:1,menuItemFactory:sortRangeAscExtCtxMenuFactory},[SortRangeDescInCtxMenuCommand.id]:{order:2,menuItemFactory:sortRangeDescCtxMenuFactory},[SortRangeDescExtInCtxMenuCommand.id]:{order:3,menuItemFactory:sortRangeDescExtCtxMenuFactory},[SortRangeCustomInCtxMenuCommand.id]:{order:4,menuItemFactory:sortRangeCustomCtxMenuFactory}}}}};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const CUSTOM_SORT_DIALOG_ID="custom-sort-dialog",CUSTOM_SORT_PANEL_WIDTH=560;var _a2;let SheetsSortUIController=(_a2=class extends core.RxDisposable{constructor(_commandService,_menuManagerService,_dialogService,_layoutService,_uiPartsService,_sheetRenderService,_localeService,_sheetsSortUIService,_injector,_componentManager){super(),this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._dialogService=_dialogService,this._layoutService=_layoutService,this._uiPartsService=_uiPartsService,this._sheetRenderService=_sheetRenderService,this._localeService=_localeService,this._sheetsSortUIService=_sheetsSortUIService,this._injector=_injector,this._componentManager=_componentManager,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(menuSchema)}_initCommands(){[SortRangeAscCommand,SortRangeAscExtCommand,SortRangeDescCommand,SortRangeDescExtCommand,SortRangeCustomCommand,SortRangeAscInCtxMenuCommand,SortRangeAscExtInCtxMenuCommand,SortRangeDescInCtxMenuCommand,SortRangeDescExtInCtxMenuCommand,SortRangeCustomInCtxMenuCommand].forEach(command=>this.disposeWithMe(this._commandService.registerCommand(command))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(sheetsSort.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",CustomSortPanel)),this.disposeWithMe(this._uiPartsService.registerComponent(sheetsUi.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>core.connectInjector(EmbedSortBtn,this._injector))),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_ICON,AscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_EXT_ICON,ExpandAscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_ICON,DescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_EXT_ICON,ExpandDescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_CUSTOM_ICON,CustomSortSingle)),this._sheetsSortUIService.customSortState$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(newState=>{newState&&newState.show&&newState.location?this._openCustomSortPanel(newState.location):newState&&!(newState!=null&&newState.show)&&this._closePanel()})}_openCustomSortPanel(location){this._dialogService.open({id:CUSTOM_SORT_DIALOG_ID,draggable:!0,width:CUSTOM_SORT_PANEL_WIDTH,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${engineFormula.serializeRange(location.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:getCustomSortDialogDefaultPosition(),preservePositionOnDestroy:!1,onClose:__name(()=>this._closePanel(),"onClose"),mask:!0})}_closePanel(){this._dialogService.close(CUSTOM_SORT_DIALOG_ID),queueMicrotask(()=>this._layoutService.focus())}},__name(_a2,"SheetsSortUIController"),_a2);SheetsSortUIController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Ready,SheetsSortUIController),__decorateParam$1(0,core.ICommandService),__decorateParam$1(1,ui.IMenuManagerService),__decorateParam$1(2,ui.IDialogService),__decorateParam$1(3,ui.ILayoutService),__decorateParam$1(4,ui.IUIPartsService),__decorateParam$1(5,core.Inject(sheetsUi.SheetsRenderService)),__decorateParam$1(6,core.Inject(core.LocaleService)),__decorateParam$1(7,core.Inject(SheetsSortUIService)),__decorateParam$1(8,core.Inject(core.Injector)),__decorateParam$1(9,core.Inject(ui.ComponentManager))],SheetsSortUIController);function getCustomSortDialogDefaultPosition(){return{x:0,y:0}}__name(getCustomSortDialogDefaultPosition,"getCustomSortDialogDefaultPosition");const PLUGIN_CONFIG_KEY="sheets-sort-ui.config",defaultPluginConfig={};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");const NAME="UNIVER_SHEETS_SORT_UI_PLUGIN";var _a3;exports.UniverSheetsSortUIPlugin=(_a3=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsSortUIService],[SheetsSortUIController]].forEach(d=>this._injector.add(d))}},__name(_a3,"UniverSheetsSortUIPlugin"),_a3);__publicField2(exports.UniverSheetsSortUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET);__publicField2(exports.UniverSheetsSortUIPlugin,"pluginName",NAME);exports.UniverSheetsSortUIPlugin=__decorateClass([core.DependentOn(sheetsSort.UniverSheetsSortPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports.UniverSheetsSortUIPlugin);exports.SortRangeAscCommand=SortRangeAscCommand;exports.SortRangeAscExtCommand=SortRangeAscExtCommand;exports.SortRangeAscExtInCtxMenuCommand=SortRangeAscExtInCtxMenuCommand;exports.SortRangeAscInCtxMenuCommand=SortRangeAscInCtxMenuCommand;exports.SortRangeCustomCommand=SortRangeCustomCommand;exports.SortRangeCustomInCtxMenuCommand=SortRangeCustomInCtxMenuCommand;exports.SortRangeDescCommand=SortRangeDescCommand;exports.SortRangeDescExtCommand=SortRangeDescExtCommand;exports.SortRangeDescExtInCtxMenuCommand=SortRangeDescExtInCtxMenuCommand;exports.SortRangeDescInCtxMenuCommand=SortRangeDescInCtxMenuCommand;
package/lib/es/index.js CHANGED
@@ -2,15 +2,15 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { useDependency, LocaleService, Disposable, UniverInstanceType, OnLifecycle, LifecycleStages, Inject, Tools, LocaleType, IUniverInstanceService, ILogService, ICommandService, CommandType, throttle, RxDisposable, connectInjector, Injector, Plugin, DependentOn } from "@univerjs/core";
5
+ import { useDependency, LocaleService, Disposable, UniverInstanceType, OnLifecycle, LifecycleStages, Inject, Tools, LocaleType, IUniverInstanceService, ILogService, ICommandService, CommandType, throttle, RxDisposable, connectInjector, Injector, Plugin, DependentOn, IConfigService } from "@univerjs/core";
6
6
  import { SortType, SheetsSortService, SortRangeCommand, UniverSheetsSortPlugin } from "@univerjs/sheets-sort";
7
7
  import { getPrimaryForRange, SetSelectionsOperation, expandToContinuousRange, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, WorksheetSortPermission, WorksheetEditPermission, RangeProtectionPermissionEditPoint } from "@univerjs/sheets";
8
8
  import React, { useState, forwardRef, useRef, createElement, useCallback, useEffect } from "react";
9
- import { IConfirmService, MenuItemType, MenuPosition, MenuGroup, getMenuHiddenObservable, ComponentManager, IMenuService, IDialogService, ILayoutService, IUIPartsService } from "@univerjs/ui";
9
+ import { IConfirmService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ContextMenuPosition, ContextMenuGroup, ComponentManager, IMenuManagerService, IDialogService, ILayoutService, IUIPartsService } from "@univerjs/ui";
10
10
  import { BehaviorSubject, takeUntil } from "rxjs";
11
11
  import { RadioGroup, Radio, Checkbox, DraggableList, Button, Dropdown } from "@univerjs/design";
12
12
  import { serializeRange } from "@univerjs/engine-formula";
13
- import { getCurrentRangeDisable$, SheetMenuPosition, SheetsUIPart, SheetsRenderService } from "@univerjs/sheets-ui";
13
+ import { getCurrentRangeDisable$, SheetsUIPart, SheetsRenderService } from "@univerjs/sheets-ui";
14
14
  const extendConfirmContent = "univer-extend-confirm-content", extendConfirmRadioGroup = "univer-extend-confirm-radio-group", customSortPanelContainer = "univer-custom-sort-panel-container", customSortPanelExt = "univer-custom-sort-panel-ext", addCondition = "univer-add-condition", addConditionText = "univer-add-condition-text", addConditionDisable = "univer-add-condition-disable", customSortPanelFooter = "univer-custom-sort-panel-footer", customSortPanelFooterBtn = "univer-custom-sort-panel-footer-btn", customSortPanelItem = "univer-custom-sort-panel-item", customSortPanelItemHead = "univer-custom-sort-panel-item-head", customSortPanelItemHandler = "univer-custom-sort-panel-item-handler", customSortPanelItemRemove = "univer-custom-sort-panel-item-remove", customSortPanelItemColumnInput = "univer-custom-sort-panel-item-column-input", customSortPanelItemColumnInputDropdown = "univer-custom-sort-panel-item-column-input-dropdown", customSortPanelItemColumnInputText = "univer-custom-sort-panel-item-column-input-text", customSortPanelItemOrderRadio = "univer-custom-sort-panel-item-order-radio", customSortPanelItemOrderRadioCn = "univer-custom-sort-panel-item-order-radio-cn", conditionList = "univer-condition-list", embedSortBtnContainer = "univer-embed-sort-btn-container", embedSortBtn = "univer-embed-sort-btn", embedSortBtnAsc = "univer-embed-sort-btn-asc", embedSortBtnDesc = "univer-embed-sort-btn-desc", embedSortBtnIcon = "univer-embed-sort-btn-icon", customSortColMenu = "univer-custom-sort-col-menu", customSortColMenuItem = "univer-custom-sort-col-menu-item", customSortColMenuItemDesc = "univer-custom-sort-col-menu-item-desc", styles = {
15
15
  extendConfirmContent,
16
16
  extendConfirmRadioGroup,
@@ -520,8 +520,6 @@ function sortRangeMenuFactory(accessor) {
520
520
  return {
521
521
  id: SHEETS_SORT_MENU_ID,
522
522
  type: MenuItemType.SUBITEMS,
523
- positions: [MenuPosition.TOOLBAR_START],
524
- group: MenuGroup.TOOLBAR_FORMULAS_INSERT,
525
523
  icon: SHEETS_SORT_ASC_ICON,
526
524
  tooltip: "sheets-sort.general.sort",
527
525
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
@@ -534,8 +532,7 @@ function sortRangeAscMenuFactory(_accessor) {
534
532
  id: SortRangeAscCommand.id,
535
533
  icon: SHEETS_SORT_ASC_ICON,
536
534
  title: "sheets-sort.general.sort-asc-cur",
537
- type: MenuItemType.BUTTON,
538
- positions: [SHEETS_SORT_MENU_ID]
535
+ type: MenuItemType.BUTTON
539
536
  };
540
537
  }
541
538
  __name(sortRangeAscMenuFactory, "sortRangeAscMenuFactory");
@@ -544,8 +541,7 @@ function sortRangeAscExtMenuFactory(_accessor) {
544
541
  id: SortRangeAscExtCommand.id,
545
542
  title: "sheets-sort.general.sort-asc-ext",
546
543
  icon: SHEETS_SORT_ASC_EXT_ICON,
547
- type: MenuItemType.BUTTON,
548
- positions: [SHEETS_SORT_MENU_ID]
544
+ type: MenuItemType.BUTTON
549
545
  };
550
546
  }
551
547
  __name(sortRangeAscExtMenuFactory, "sortRangeAscExtMenuFactory");
@@ -554,8 +550,7 @@ function sortRangeDescMenuFactory(_accessor) {
554
550
  id: SortRangeDescCommand.id,
555
551
  title: "sheets-sort.general.sort-desc-cur",
556
552
  icon: SHEETS_SORT_DESC_ICON,
557
- type: MenuItemType.BUTTON,
558
- positions: [SHEETS_SORT_MENU_ID]
553
+ type: MenuItemType.BUTTON
559
554
  };
560
555
  }
561
556
  __name(sortRangeDescMenuFactory, "sortRangeDescMenuFactory");
@@ -564,8 +559,7 @@ function sortRangeDescExtMenuFactory(_accessor) {
564
559
  id: SortRangeDescExtCommand.id,
565
560
  title: "sheets-sort.general.sort-desc-ext",
566
561
  icon: SHEETS_SORT_DESC_EXT_ICON,
567
- type: MenuItemType.BUTTON,
568
- positions: [SHEETS_SORT_MENU_ID]
562
+ type: MenuItemType.BUTTON
569
563
  };
570
564
  }
571
565
  __name(sortRangeDescExtMenuFactory, "sortRangeDescExtMenuFactory");
@@ -574,7 +568,6 @@ function sortRangeCustomMenuFactory(_accessor) {
574
568
  id: SortRangeCustomCommand.id,
575
569
  title: "sheets-sort.general.sort-custom",
576
570
  type: MenuItemType.BUTTON,
577
- positions: [SHEETS_SORT_MENU_ID],
578
571
  icon: SHEETS_SORT_CUSTOM_ICON
579
572
  };
580
573
  }
@@ -584,12 +577,6 @@ function sortRangeCtxMenuFactory(accessor) {
584
577
  id: SHEETS_SORT_CTX_MENU_ID,
585
578
  title: "sheets-sort.general.sort",
586
579
  type: MenuItemType.SUBITEMS,
587
- positions: [
588
- MenuPosition.CONTEXT_MENU,
589
- SheetMenuPosition.COL_HEADER_CONTEXT_MENU,
590
- SheetMenuPosition.ROW_HEADER_CONTEXT_MENU
591
- ],
592
- group: MenuGroup.CONTEXT_MENU_DATA,
593
580
  icon: SHEETS_SORT_ASC_ICON,
594
581
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
595
582
  disabled$: getCurrentRangeDisable$(accessor, {
@@ -606,7 +593,6 @@ function sortRangeAscCtxMenuFactory(_accessor) {
606
593
  title: "sheets-sort.general.sort-asc-cur",
607
594
  type: MenuItemType.BUTTON,
608
595
  icon: SHEETS_SORT_ASC_ICON,
609
- positions: [SHEETS_SORT_CTX_MENU_ID],
610
596
  disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
611
597
  };
612
598
  }
@@ -617,7 +603,6 @@ function sortRangeAscExtCtxMenuFactory(_accessor) {
617
603
  title: "sheets-sort.general.sort-asc-ext",
618
604
  type: MenuItemType.BUTTON,
619
605
  icon: SHEETS_SORT_ASC_EXT_ICON,
620
- positions: [SHEETS_SORT_CTX_MENU_ID],
621
606
  disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
622
607
  };
623
608
  }
@@ -627,7 +612,6 @@ function sortRangeDescCtxMenuFactory(_accessor) {
627
612
  id: SortRangeDescInCtxMenuCommand.id,
628
613
  title: "sheets-sort.general.sort-desc-cur",
629
614
  type: MenuItemType.BUTTON,
630
- positions: [SHEETS_SORT_CTX_MENU_ID],
631
615
  icon: SHEETS_SORT_DESC_ICON,
632
616
  disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
633
617
  };
@@ -638,7 +622,6 @@ function sortRangeDescExtCtxMenuFactory(_accessor) {
638
622
  id: SortRangeDescExtInCtxMenuCommand.id,
639
623
  title: "sheets-sort.general.sort-desc-ext",
640
624
  type: MenuItemType.BUTTON,
641
- positions: [SHEETS_SORT_CTX_MENU_ID],
642
625
  icon: SHEETS_SORT_DESC_EXT_ICON,
643
626
  disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
644
627
  };
@@ -649,48 +632,80 @@ function sortRangeCustomCtxMenuFactory(_accessor) {
649
632
  id: SortRangeCustomInCtxMenuCommand.id,
650
633
  title: "sheets-sort.general.sort-custom",
651
634
  type: MenuItemType.BUTTON,
652
- positions: [SHEETS_SORT_CTX_MENU_ID],
653
635
  icon: SHEETS_SORT_CUSTOM_ICON,
654
636
  disabled$: getCurrentRangeDisable$(_accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetSortPermission, WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
655
637
  };
656
638
  }
657
639
  __name(sortRangeCustomCtxMenuFactory, "sortRangeCustomCtxMenuFactory");
640
+ const menuSchema = {
641
+ [RibbonStartGroup.FORMULAS_INSERT]: {
642
+ [SHEETS_SORT_MENU_ID]: {
643
+ order: 2,
644
+ menuItemFactory: sortRangeMenuFactory,
645
+ [SortRangeAscCommand.id]: {
646
+ order: 0,
647
+ menuItemFactory: sortRangeAscMenuFactory
648
+ },
649
+ [SortRangeAscExtCommand.id]: {
650
+ order: 1,
651
+ menuItemFactory: sortRangeAscExtMenuFactory
652
+ },
653
+ [SortRangeDescCommand.id]: {
654
+ order: 2,
655
+ menuItemFactory: sortRangeDescMenuFactory
656
+ },
657
+ [SortRangeDescExtCommand.id]: {
658
+ order: 3,
659
+ menuItemFactory: sortRangeDescExtMenuFactory
660
+ },
661
+ [SortRangeCustomCommand.id]: {
662
+ order: 4,
663
+ menuItemFactory: sortRangeCustomMenuFactory
664
+ }
665
+ }
666
+ },
667
+ [ContextMenuPosition.MAIN_AREA]: {
668
+ [ContextMenuGroup.DATA]: {
669
+ [SHEETS_SORT_CTX_MENU_ID]: {
670
+ order: 0,
671
+ menuItemFactory: sortRangeCtxMenuFactory,
672
+ [SortRangeAscInCtxMenuCommand.id]: {
673
+ order: 0,
674
+ menuItemFactory: sortRangeAscCtxMenuFactory
675
+ },
676
+ [SortRangeAscExtInCtxMenuCommand.id]: {
677
+ order: 1,
678
+ menuItemFactory: sortRangeAscExtCtxMenuFactory
679
+ },
680
+ [SortRangeDescInCtxMenuCommand.id]: {
681
+ order: 2,
682
+ menuItemFactory: sortRangeDescCtxMenuFactory
683
+ },
684
+ [SortRangeDescExtInCtxMenuCommand.id]: {
685
+ order: 3,
686
+ menuItemFactory: sortRangeDescExtCtxMenuFactory
687
+ },
688
+ [SortRangeCustomInCtxMenuCommand.id]: {
689
+ order: 4,
690
+ menuItemFactory: sortRangeCustomCtxMenuFactory
691
+ }
692
+ }
693
+ }
694
+ }
695
+ };
658
696
  var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
659
697
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
660
698
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
661
699
  return kind && result && __defProp$1(target, key, result), result;
662
700
  }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
663
- const DefaultSheetsSortUIConfig = {
664
- menu: {}
665
- }, CUSTOM_SORT_DIALOG_ID = "custom-sort-dialog", CUSTOM_SORT_PANEL_WIDTH = 560;
701
+ const CUSTOM_SORT_DIALOG_ID = "custom-sort-dialog", CUSTOM_SORT_PANEL_WIDTH = 560;
666
702
  var _a2;
667
703
  let SheetsSortUIController = (_a2 = class extends RxDisposable {
668
- constructor(_config, _commandService, _menuService, _dialogService, _layoutService, _uiPartsService, _sheetRenderService, _localeService, _sheetsSortUIService, _injector, _componentManager) {
669
- super(), this._config = _config, this._commandService = _commandService, this._menuService = _menuService, this._dialogService = _dialogService, this._layoutService = _layoutService, this._uiPartsService = _uiPartsService, this._sheetRenderService = _sheetRenderService, this._localeService = _localeService, this._sheetsSortUIService = _sheetsSortUIService, this._injector = _injector, this._componentManager = _componentManager, this._initCommands(), this._initMenu(), this._initUI();
704
+ constructor(_commandService, _menuManagerService, _dialogService, _layoutService, _uiPartsService, _sheetRenderService, _localeService, _sheetsSortUIService, _injector, _componentManager) {
705
+ super(), this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._dialogService = _dialogService, this._layoutService = _layoutService, this._uiPartsService = _uiPartsService, this._sheetRenderService = _sheetRenderService, this._localeService = _localeService, this._sheetsSortUIService = _sheetsSortUIService, this._injector = _injector, this._componentManager = _componentManager, this._initCommands(), this._initMenu(), this._initUI();
670
706
  }
671
707
  _initMenu() {
672
- const { menu = {} } = this._config;
673
- [
674
- sortRangeMenuFactory,
675
- sortRangeAscMenuFactory,
676
- sortRangeDescMenuFactory,
677
- sortRangeAscExtMenuFactory,
678
- sortRangeDescExtMenuFactory,
679
- sortRangeCustomMenuFactory,
680
- sortRangeCtxMenuFactory,
681
- sortRangeAscCtxMenuFactory,
682
- sortRangeDescCtxMenuFactory,
683
- sortRangeAscExtCtxMenuFactory,
684
- sortRangeDescExtCtxMenuFactory,
685
- sortRangeCustomCtxMenuFactory
686
- ].forEach((factory) => {
687
- this.disposeWithMe(
688
- this._menuService.addMenuItem(
689
- this._injector.invoke(factory),
690
- menu
691
- )
692
- );
693
- });
708
+ this._menuManagerService.mergeMenu(menuSchema);
694
709
  }
695
710
  _initCommands() {
696
711
  [
@@ -731,21 +746,22 @@ let SheetsSortUIController = (_a2 = class extends RxDisposable {
731
746
  }, __name(_a2, "SheetsSortUIController"), _a2);
732
747
  SheetsSortUIController = __decorateClass$1([
733
748
  OnLifecycle(LifecycleStages.Ready, SheetsSortUIController),
734
- __decorateParam$1(1, ICommandService),
735
- __decorateParam$1(2, IMenuService),
736
- __decorateParam$1(3, IDialogService),
737
- __decorateParam$1(4, ILayoutService),
738
- __decorateParam$1(5, IUIPartsService),
739
- __decorateParam$1(6, Inject(SheetsRenderService)),
740
- __decorateParam$1(7, Inject(LocaleService)),
741
- __decorateParam$1(8, Inject(SheetsSortUIService)),
742
- __decorateParam$1(9, Inject(Injector)),
743
- __decorateParam$1(10, Inject(ComponentManager))
749
+ __decorateParam$1(0, ICommandService),
750
+ __decorateParam$1(1, IMenuManagerService),
751
+ __decorateParam$1(2, IDialogService),
752
+ __decorateParam$1(3, ILayoutService),
753
+ __decorateParam$1(4, IUIPartsService),
754
+ __decorateParam$1(5, Inject(SheetsRenderService)),
755
+ __decorateParam$1(6, Inject(LocaleService)),
756
+ __decorateParam$1(7, Inject(SheetsSortUIService)),
757
+ __decorateParam$1(8, Inject(Injector)),
758
+ __decorateParam$1(9, Inject(ComponentManager))
744
759
  ], SheetsSortUIController);
745
760
  function getCustomSortDialogDefaultPosition() {
746
761
  return { x: 0, y: 0 };
747
762
  }
748
763
  __name(getCustomSortDialogDefaultPosition, "getCustomSortDialogDefaultPosition");
764
+ const PLUGIN_CONFIG_KEY = "sheets-sort-ui.config", defaultPluginConfig = {};
749
765
  var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
750
766
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
751
767
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
@@ -754,15 +770,15 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
754
770
  const NAME = "UNIVER_SHEETS_SORT_UI_PLUGIN";
755
771
  var _a3;
756
772
  let UniverSheetsSortUIPlugin = (_a3 = class extends Plugin {
757
- constructor(_config = {}, _injector, _localeService) {
758
- super(), this._config = _config, this._injector = _injector, this._localeService = _localeService, this._config = Tools.deepMerge({}, DefaultSheetsSortUIConfig, this._config);
773
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
774
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService;
775
+ const { ...rest } = this._config;
776
+ this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
759
777
  }
760
778
  onStarting() {
761
779
  [
762
780
  [SheetsSortUIService],
763
- [SheetsSortUIController, {
764
- useFactory: /* @__PURE__ */ __name(() => this._injector.createInstance(SheetsSortUIController, this._config), "useFactory")
765
- }]
781
+ [SheetsSortUIController]
766
782
  ].forEach((d) => this._injector.add(d));
767
783
  }
768
784
  }, __name(_a3, "UniverSheetsSortUIPlugin"), _a3);
@@ -771,7 +787,7 @@ __publicField2(UniverSheetsSortUIPlugin, "pluginName", NAME);
771
787
  UniverSheetsSortUIPlugin = __decorateClass([
772
788
  DependentOn(UniverSheetsSortPlugin),
773
789
  __decorateParam(1, Inject(Injector)),
774
- __decorateParam(2, Inject(LocaleService))
790
+ __decorateParam(2, IConfigService)
775
791
  ], UniverSheetsSortUIPlugin);
776
792
  export {
777
793
  SortRangeAscCommand,
@@ -0,0 +1,7 @@
1
+ import { MenuConfig } from '@univerjs/ui';
2
+ export declare const PLUGIN_CONFIG_KEY = "sheets-sort-ui.config";
3
+ export declare const configSymbol: unique symbol;
4
+ export interface IUniverSheetsSortUIConfig {
5
+ menu?: MenuConfig;
6
+ }
7
+ export declare const defaultPluginConfig: IUniverSheetsSortUIConfig;
@@ -0,0 +1,2 @@
1
+ import { MenuSchemaType } from '@univerjs/ui';
2
+ export declare const menuSchema: MenuSchemaType;
@@ -1,17 +1,10 @@
1
1
  import { ICommandService, Injector, LocaleService, RxDisposable } from '@univerjs/core';
2
- import { MenuConfig, UIPartsService, ComponentManager, IDialogService, ILayoutService, IMenuService } from '@univerjs/ui';
2
+ import { UIPartsService, ComponentManager, IDialogService, ILayoutService, IMenuManagerService } from '@univerjs/ui';
3
3
  import { SheetsRenderService } from '@univerjs/sheets-ui';
4
4
  import { SheetsSortUIService } from '../services/sheets-sort-ui.service';
5
- export interface IUniverSheetsSortUIConfig {
6
- menu: MenuConfig;
7
- }
8
- export declare const DefaultSheetsSortUIConfig: {
9
- menu: {};
10
- };
11
5
  export declare class SheetsSortUIController extends RxDisposable {
12
- private readonly _config;
13
6
  private readonly _commandService;
14
- private readonly _menuService;
7
+ private readonly _menuManagerService;
15
8
  private readonly _dialogService;
16
9
  private readonly _layoutService;
17
10
  private readonly _uiPartsService;
@@ -20,7 +13,7 @@ export declare class SheetsSortUIController extends RxDisposable {
20
13
  private readonly _sheetsSortUIService;
21
14
  private _injector;
22
15
  private readonly _componentManager;
23
- constructor(_config: Partial<IUniverSheetsSortUIConfig>, _commandService: ICommandService, _menuService: IMenuService, _dialogService: IDialogService, _layoutService: ILayoutService, _uiPartsService: UIPartsService, _sheetRenderService: SheetsRenderService, _localeService: LocaleService, _sheetsSortUIService: SheetsSortUIService, _injector: Injector, _componentManager: ComponentManager);
16
+ constructor(_commandService: ICommandService, _menuManagerService: IMenuManagerService, _dialogService: IDialogService, _layoutService: ILayoutService, _uiPartsService: UIPartsService, _sheetRenderService: SheetsRenderService, _localeService: LocaleService, _sheetsSortUIService: SheetsSortUIService, _injector: Injector, _componentManager: ComponentManager);
24
17
  private _initMenu;
25
18
  private _initCommands;
26
19
  private _initUI;
@@ -1,5 +1,7 @@
1
1
  import { IMenuItem } from '@univerjs/ui';
2
2
  import { IAccessor } from '@univerjs/core';
3
+ export declare const SHEETS_SORT_MENU_ID = "sheet.menu.sheets-sort";
4
+ export declare const SHEETS_SORT_CTX_MENU_ID = "sheet.menu.sheets-sort-ctx";
3
5
  export declare const SHEETS_SORT_ASC_ICON = "AscendingSingle";
4
6
  export declare const SHEETS_SORT_ASC_EXT_ICON = "ExpandAscendingSingle";
5
7
  export declare const SHEETS_SORT_DESC_ICON = "DescendingSingle";
@@ -1,11 +1,11 @@
1
- import { Injector, LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
2
- import { IUniverSheetsSortUIConfig } from './controllers/sheets-sort-ui.controller';
1
+ import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
+ import { IUniverSheetsSortUIConfig } from './controllers/config.schema';
3
3
  export declare class UniverSheetsSortUIPlugin extends Plugin {
4
4
  private readonly _config;
5
5
  protected readonly _injector: Injector;
6
- private readonly _localeService;
6
+ private readonly _configService;
7
7
  static type: UniverInstanceType;
8
8
  static pluginName: string;
9
- constructor(_config: Partial<IUniverSheetsSortUIConfig>, _injector: Injector, _localeService: LocaleService);
9
+ constructor(_config: Partial<IUniverSheetsSortUIConfig>, _injector: Injector, _configService: IConfigService);
10
10
  onStarting(): void;
11
11
  }
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/sheets-sort"),require("@univerjs/sheets"),require("react"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/sheets","react","@univerjs/ui","rxjs","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-ui"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsSortUi={},global.UniverCore,global.UniverSheetsSort,global.UniverSheets,global.React,global.UniverUi,global.rxjs,global.UniverDesign,global.UniverEngineFormula,global.UniverSheetsUi))})(this,function(exports2,core,sheetsSort,sheets,React,ui,rxjs,design,engineFormula,sheetsUi){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c;const styles={extendConfirmContent:"univer-extend-confirm-content",extendConfirmRadioGroup:"univer-extend-confirm-radio-group",customSortPanelContainer:"univer-custom-sort-panel-container",customSortPanelExt:"univer-custom-sort-panel-ext",addCondition:"univer-add-condition",addConditionText:"univer-add-condition-text",addConditionDisable:"univer-add-condition-disable",customSortPanelFooter:"univer-custom-sort-panel-footer",customSortPanelFooterBtn:"univer-custom-sort-panel-footer-btn",customSortPanelItem:"univer-custom-sort-panel-item",customSortPanelItemHead:"univer-custom-sort-panel-item-head",customSortPanelItemHandler:"univer-custom-sort-panel-item-handler",customSortPanelItemRemove:"univer-custom-sort-panel-item-remove",customSortPanelItemColumnInput:"univer-custom-sort-panel-item-column-input",customSortPanelItemColumnInputDropdown:"univer-custom-sort-panel-item-column-input-dropdown",customSortPanelItemColumnInputText:"univer-custom-sort-panel-item-column-input-text",customSortPanelItemOrderRadio:"univer-custom-sort-panel-item-order-radio",customSortPanelItemOrderRadioCn:"univer-custom-sort-panel-item-order-radio-cn",conditionList:"univer-condition-list",embedSortBtnContainer:"univer-embed-sort-btn-container",embedSortBtn:"univer-embed-sort-btn",embedSortBtnAsc:"univer-embed-sort-btn-asc",embedSortBtnDesc:"univer-embed-sort-btn-desc",embedSortBtnIcon:"univer-embed-sort-btn-icon",customSortColMenu:"univer-custom-sort-col-menu",customSortColMenuItem:"univer-custom-sort-col-menu-item",customSortColMenuItemDesc:"univer-custom-sort-col-menu-item-desc"},ExtendConfirm=__name(props=>{const[extend,setExtend]=React.useState("0"),localeService=core.useDependency(core.LocaleService);return React.createElement("div",{className:styles.extendConfirmContent},React.createElement("div",{className:"extend-confirm-desc"},localeService.t("sheets-sort.dialog.sort-reminder-desc")),React.createElement(design.RadioGroup,{className:styles.extendConfirmRadioGroup,value:extend,direction:"vertical",onChange:__name(value=>{setExtend(value),props.onChange(value)},"onChange")},React.createElement(design.Radio,{value:"0"},localeService.t("sheets-sort.dialog.sort-reminder-no")),React.createElement(design.Radio,{value:"1"},localeService.t("sheets-sort.dialog.sort-reminder-ext"))))},"ExtendConfirm");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");const SORT_ERROR_MESSAGE={MERGE_ERROR:"sheets-sort.error.merge-size",EMPTY_ERROR:"sheets-sort.error.empty",SINGLE_ERROR:"sheets-sort.error.single",FORMULA_ARRAY:"sheets-sort.error.formula-array"};let SheetsSortUIService=(_a=class extends core.Disposable{constructor(_univerInstanceService,_confirmService,_logService,_selectionManagerService,_sheetsSortService,_localeService,_commandService){super();__publicField(this,"_customSortState$",new rxjs.BehaviorSubject(null));__publicField(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=_univerInstanceService,this._confirmService=_confirmService,this._logService=_logService,this._selectionManagerService=_selectionManagerService,this._sheetsSortService=_sheetsSortService,this._localeService=_localeService,this._commandService=_commandService}async triggerSortDirectly(asc,extend,sheetRangeLocation){const location=sheetRangeLocation||await this._detectSortLocation(extend);if(!location||!this._check(location))return!1;const sortOption={orderRules:[{type:asc?sheetsSort.SortType.ASC:sheetsSort.SortType.DESC,colIndex:location.colIndex}],range:location.range};return this._sheetsSortService.applySort(sortOption,location.unitId,location.subUnitId),!0}async triggerSortCustomize(){const location=await this._detectSortLocation();return!location||!this._check(location)?!1:(this.showCustomSortPanel(location),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(hasTitle){var _a2,_b2;const location=(_a2=this.customSortState())==null?void 0:_a2.location;if(!location)return[];const{unitId,subUnitId,range}=location,worksheet=(_b2=this._univerInstanceService.getUnit(unitId))==null?void 0:_b2.getSheetBySheetId(subUnitId);if(!worksheet)return[];const colTranslator=colIndexTranslator(this._localeService);return Array.from({length:range.endColumn-range.startColumn+1},(_,i)=>{var _a3;const cellValue=(_a3=worksheet.getCell(range.startRow,i+range.startColumn))==null?void 0:_a3.v;return{index:i+range.startColumn,label:hasTitle?`${cellValue!=null?cellValue:colTranslator(i+range.startColumn)}`:colTranslator(i+range.startColumn)}})}setSelection(unitId,subUnitId,range){var _a2;const worksheet=(_a2=this._univerInstanceService.getUnit(unitId))==null?void 0:_a2.getSheetBySheetId(subUnitId);if(!worksheet)return;const setSelectionsOperationParams={unitId,subUnitId,selections:[{range,primary:sheets.getPrimaryForRange(range,worksheet),style:null}]};this._commandService.executeCommand(sheets.SetSelectionsOperation.id,setSelectionsOperationParams)}async showCheckError(content){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:React.createElement("div",null,this._localeService.t(content))}})}async showExtendConfirm(){let shouldExtend=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:React.createElement(ExtendConfirm,{onChange:__name(value=>{shouldExtend=value==="1"},"onChange")})},width:400})?shouldExtend?"extend":"keep":"cancel"}showCustomSortPanel(location){this._customSortState$.next({location,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(location){return this._sheetsSortService.singleCheck(location)?this._sheetsSortService.mergeCheck(location)?this._sheetsSortService.formulaCheck(location)?this._sheetsSortService.emptyCheck(location)?!0:(this.showCheckError(SORT_ERROR_MESSAGE.EMPTY_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.FORMULA_ARRAY),!1):(this.showCheckError(SORT_ERROR_MESSAGE.MERGE_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.SINGLE_ERROR),!1)}async _detectSortLocation(extend){const workbook=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook.getActiveSheet(),unitId=workbook.getUnitId(),subUnitId=worksheet.getSheetId(),selection=this._selectionManagerService.getCurrentLastSelection();if(!selection)return null;let range;if(extend===!0)range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range);else if(extend===!1)range=selection.range;else{const confirmRes=await this.showExtendConfirm();if(confirmRes==="cancel")return null;confirmRes==="keep"?range=selection.range:(range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range))}return{range,unitId,subUnitId,colIndex:selection.primary.actualColumn}}},__name(_a,"SheetsSortUIService"),_a);SheetsSortUIService=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,sheetsSort.SheetsSortService),__decorateParam$2(0,core.IUniverInstanceService),__decorateParam$2(1,ui.IConfirmService),__decorateParam$2(2,core.ILogService),__decorateParam$2(3,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$2(4,core.Inject(sheetsSort.SheetsSortService)),__decorateParam$2(5,core.Inject(core.LocaleService)),__decorateParam$2(6,core.ICommandService)],SheetsSortUIService);function colIndexTranslator(localeService){return colIndex=>{const colName=core.Tools.chatAtABC(colIndex);switch(localeService.getCurrentLocale()){case core.LocaleType.ZH_CN:return`"${colName}"列`;case core.LocaleType.EN_US:return`Column "${colName}"`;default:return`Column "${colName}"`}}}__name(colIndexTranslator,"colIndexTranslator");var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=React.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=React.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return React.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element$9={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},AscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"ascending- single",ref,icon:element$9}))});AscendingSingle.displayName="AscendingSingle";var element$8={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CheckMarkSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$8}))});CheckMarkSingle.displayName="CheckMarkSingle";var element$7={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574 8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507 9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661 11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306zM6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512 7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574 6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588 4.88808 9.55156 5.26798 9.55156 5.50229 9.78588L6.22584 10.5094z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.14014 3.73989C1.14014 2.30396 2.3042 1.13989 3.74014 1.13989H12.2601C13.6961 1.13989 14.8601 2.30395 14.8601 3.73989V12.2599C14.8601 13.6958 13.6961 14.8599 12.2601 14.8599H3.74014C2.3042 14.8599 1.14014 13.6958 1.14014 12.2599V3.73989ZM2.34014 5.86724V12.2599C2.34014 13.0331 2.96694 13.6599 3.74014 13.6599H12.2601C13.0333 13.6599 13.6601 13.0331 13.6601 12.2599V5.86724H2.34014ZM13.6601 4.66724H2.34014V3.73989C2.34014 2.9667 2.96694 2.33989 3.74014 2.33989H12.2601C13.0333 2.33989 13.6601 2.96669 13.6601 3.73989V4.66724Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CustomSortSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"custom-sort-single",ref,icon:element$7}))});CustomSortSingle.displayName="CustomSortSingle";var element$6={tag:"svg",attrs:{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.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.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.64443 14.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:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V13.1332C3.15332 14.2377 4.04875 15.1332 5.15332 15.1332H10.8465C11.9511 15.1332 12.8465 14.2377 12.8465 13.1331V6.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.82217V13.1331C11.6465 13.575 11.2884 13.9331 10.8465 13.9331H5.15332C4.71149 13.9331 4.35332 13.575 4.35332 13.1332V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},DeleteEmptySingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"delete-empty-single",ref,icon:element$6}))});DeleteEmptySingle.displayName="DeleteEmptySingle";var element$5={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},DescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"descending-single",ref,icon:element$5}))});DescendingSingle.displayName="DescendingSingle";var element$4={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 3.20024C1.57503 3.20024 1.3064 2.93161 1.3064 2.60024C1.3064 2.26887 1.57503 2.00024 1.9064 2.00024H4.57306C4.90443 2.00024 5.17306 2.26887 5.17306 2.60024C5.17306 2.93161 4.90443 3.20024 4.57306 3.20024H1.9064ZM1.3064 6.19985C1.3064 6.53122 1.57503 6.79985 1.9064 6.79985H5.9064C6.23777 6.79985 6.5064 6.53122 6.5064 6.19985C6.5064 5.86848 6.23777 5.59985 5.9064 5.59985H1.9064C1.57503 5.59985 1.3064 5.86848 1.3064 6.19985ZM1.9064 10.3997C1.57503 10.3997 1.3064 10.1311 1.3064 9.79971C1.3064 9.46834 1.57503 9.19971 1.9064 9.19971H7.23973C7.5711 9.19971 7.83973 9.46834 7.83973 9.79971C7.83973 10.1311 7.5711 10.3997 7.23973 10.3997H1.9064ZM1.9064 13.9996C1.57503 13.9996 1.3064 13.7309 1.3064 13.3996C1.3064 13.0682 1.57503 12.7996 1.9064 12.7996H8.57306C8.90443 12.7996 9.17306 13.0682 9.17306 13.3996C9.17306 13.7309 8.90443 13.9996 8.57306 13.9996H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 14.2667C12.4267 14.5981 12.1581 14.8667 11.8267 14.8667C11.4953 14.8667 11.2267 14.5981 11.2267 14.2667V3.18198L9.98447 4.42422C9.75015 4.65853 9.37026 4.65853 9.13594 4.42422C8.90163 4.1899 8.90163 3.81 9.13594 3.57569L11.4026 1.30902C11.6369 1.07471 12.0168 1.07471 12.2511 1.30902L14.5178 3.57569C14.7521 3.81 14.7521 4.1899 14.5178 4.42422C14.2835 4.65853 13.9036 4.65853 13.6693 4.42422L12.4267 3.18165V14.2667Z"}}]},ExpandAscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-ascending-single",ref,icon:element$4}))});ExpandAscendingSingle.displayName="ExpandAscendingSingle";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 12.7998C1.57503 12.7998 1.3064 13.0684 1.3064 13.3998C1.3064 13.7311 1.57503 13.9998 1.9064 13.9998H4.57306C4.90443 13.9998 5.17306 13.7311 5.17306 13.3998C5.17306 13.0684 4.90443 12.7998 4.57306 12.7998H1.9064ZM1.3064 9.80015C1.3064 9.46878 1.57503 9.20015 1.9064 9.20015H5.9064C6.23777 9.20015 6.5064 9.46878 6.5064 9.80015C6.5064 10.1315 6.23777 10.4001 5.9064 10.4001H1.9064C1.57503 10.4001 1.3064 10.1315 1.3064 9.80015ZM1.9064 5.60029C1.57503 5.60029 1.3064 5.86892 1.3064 6.20029C1.3064 6.53166 1.57503 6.80029 1.9064 6.80029H7.23973C7.5711 6.80029 7.83973 6.53166 7.83973 6.20029C7.83973 5.86892 7.5711 5.60029 7.23973 5.60029H1.9064ZM1.9064 2.00044C1.57503 2.00044 1.3064 2.26907 1.3064 2.60044C1.3064 2.93181 1.57503 3.20044 1.9064 3.20044H8.57306C8.90443 3.20044 9.17306 2.93181 9.17306 2.60044C9.17306 2.26907 8.90443 2.00044 8.57306 2.00044H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 1.7333C12.4267 1.40193 12.1581 1.1333 11.8267 1.1333C11.4953 1.1333 11.2267 1.40193 11.2267 1.7333V12.818L9.98447 11.5758C9.75015 11.3415 9.37026 11.3415 9.13594 11.5758C8.90163 11.8101 8.90163 12.19 9.13594 12.4243L11.4026 14.691C11.6369 14.9253 12.0168 14.9253 12.2511 14.691L14.5178 12.4243C14.7521 12.19 14.7521 11.8101 14.5178 11.5758C14.2835 11.3415 13.9036 11.3415 13.6693 11.5758L12.4267 12.8183V1.7333Z"}}]},ExpandDescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-descending-single",ref,icon:element$3}))});ExpandDescendingSingle.displayName="ExpandDescendingSingle";var element$2={tag:"svg",attrs:{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"}}]},IncreaseSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"increase-single",ref,icon:element$2}))});IncreaseSingle.displayName="IncreaseSingle";var element$1={tag:"svg",attrs:{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"}}]},MoreDownSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"more-down-single",ref,icon:element$1}))});MoreDownSingle.displayName="MoreDownSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},SequenceSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"sequence-single",ref,icon:element}))});SequenceSingle.displayName="SequenceSingle";const SortRangeAscCommand={id:"sheet.command.sort-range-asc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtCommand={id:"sheet.command.sort-range-asc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescCommand={id:"sheet.command.sort-range-desc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtCommand={id:"sheet.command.sort-range-desc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomCommand={id:"sheet.command.sort-range-custom",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")},SortRangeAscInCtxMenuCommand={id:"sheet.command.sort-range-asc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtInCtxMenuCommand={id:"sheet.command.sort-range-asc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescInCtxMenuCommand={id:"sheet.command.sort-range-desc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtInCtxMenuCommand={id:"sheet.command.sort-range-desc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomInCtxMenuCommand={id:"sheet.command.sort-range-custom-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")};function CustomSortPanel(){const sheetsSortUIService=core.useDependency(SheetsSortUIService),sheetsSortService=core.useDependency(sheetsSort.SheetsSortService),localeService=core.useDependency(core.LocaleService),[hasTitle,setHasTitle]=React.useState(!1),[scrollPosition,setScrollPosition]=React.useState(0),listEndRef=React.useRef(null),state=sheetsSortUIService.customSortState();if(!state||!state.location)return null;const{range,unitId,subUnitId}=state.location,titles=sheetsSortUIService.getTitles(hasTitle),[list,setList]=React.useState([{type:sheetsSort.SortType.ASC,colIndex:range.startColumn}]),onItemChange=React.useCallback((index,value)=>{const newList=[...list];value===null?newList.splice(index,1):newList[index]=value,setList(newList)},[list]),newItem=React.useCallback(core.throttle(()=>{const newList=[...list],nextColIndex=findNextColIndex(range,list);nextColIndex!==null&&(newList.push({type:sheetsSort.SortType.ASC,colIndex:nextColIndex}),setList(newList))},200),[list,range]),apply=React.useCallback((orderRules,hasTitle2)=>{sheetsSortService.applySort({range,orderRules,hasTitle:hasTitle2}),sheetsSortUIService.closeCustomSortPanel()},[sheetsSortService,sheetsSortUIService,range]),cancel=React.useCallback(()=>{sheetsSortUIService.closeCustomSortPanel()},[sheetsSortUIService]),setTitle=React.useCallback(value=>{setHasTitle(value),value?sheetsSortUIService.setSelection(unitId,subUnitId,{...range,startRow:range.startRow+1}):sheetsSortUIService.setSelection(unitId,subUnitId,range)},[sheetsSortUIService,range,subUnitId,unitId]);React.useEffect(()=>{listEndRef.current&&list.length>5&&(listEndRef.current.scrollTop=listEndRef.current.scrollHeight)},[list]);const canNew=list.length<titles.length,dragList=list.map(item=>({...item,id:`${item.colIndex}`}));return React.createElement("div",{className:styles.customSortPanelContainer},React.createElement("div",{className:styles.customSortPanelContent,onMouseDown:__name(e=>{e.stopPropagation()},"onMouseDown")},React.createElement("div",{className:styles.customSortPanelExt},React.createElement("div",{className:styles.firstRowCheck},React.createElement(design.Checkbox,{checked:hasTitle,onChange:__name(value=>setTitle(!!value),"onChange")},localeService.t("sheets-sort.dialog.first-row-check"))),canNew?React.createElement("div",{className:styles.addCondition,onClick:newItem},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition"))):React.createElement("div",{className:`${styles.addCondition} ${styles.addConditionDisable}`},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition")))),React.createElement("div",{className:styles.conditionList,onScroll:__name(e=>{const position=e.currentTarget.scrollTop;setScrollPosition(position)},"onScroll"),ref:listEndRef},React.createElement(design.DraggableList,{list:dragList,onListChange:setList,idKey:"id",draggableHandle:`.${styles.customSortPanelItemHandler}`,itemRender:__name(item=>React.createElement(SortOptionItem,{titles,list:dragList,item,onChange:__name((value,index)=>onItemChange(index,value),"onChange"),scrollPosition}),"itemRender"),rowHeight:32,margin:[0,12]}))),React.createElement("div",{className:styles.customSortPanelFooter},React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"default",onClick:__name(()=>cancel(),"onClick")},localeService.t("sheets-sort.dialog.cancel")),React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"primary",onClick:__name(()=>apply(list,hasTitle),"onClick")},localeService.t("sheets-sort.dialog.confirm"))))}__name(CustomSortPanel,"CustomSortPanel");function SortOptionItem(props){var _a2;const{list,item,titles,onChange,scrollPosition}=props,localeService=core.useDependency(core.LocaleService),availableMenu=titles.filter(title=>!list.some(item2=>item2.colIndex===title.index)||title.index===item.colIndex),currentIndex=list.findIndex(listItem=>listItem.colIndex===item.colIndex),handleChangeColIndex=React.useCallback(menuItem=>{onChange({...item,colIndex:menuItem.index},currentIndex),setVisible(!1)},[currentIndex,item,onChange]),[visible,setVisible]=React.useState(!1),onVisibleChange=__name(visible2=>{setVisible(visible2)},"onVisibleChange");React.useEffect(()=>{setVisible(!1)},[scrollPosition]);const showDelete=list.length>1,itemLabel=(_a2=titles.find(title=>title.index===item.colIndex))==null?void 0:_a2.label,radioClass=localeService.getCurrentLocale()===core.LocaleType.ZH_CN?styles.customSortPanelItemOrderRadioCn:styles.customSortPanelItemOrderRadio;return React.createElement("div",{className:styles.customSortPanelItem},React.createElement("div",{className:styles.customSortPanelItemHead},React.createElement("div",{className:styles.customSortPanelItemHandler},React.createElement(SequenceSingle,null)),React.createElement("div",{className:styles.customSortPanelItemColumn},React.createElement(design.Dropdown,{placement:"bottomLeft",trigger:["click"],visible,onVisibleChange,overlay:React.createElement("ul",{className:styles.customSortColMenu},availableMenu.map(menuItem=>React.createElement("li",{key:menuItem.index,onClick:__name(()=>handleChangeColIndex(menuItem),"onClick"),className:styles.customSortColMenuItem},React.createElement("span",{className:styles.customSortColMenuItemDesc},menuItem.label),React.createElement("span",{className:styles.customSortColMenuItemCheck},menuItem.index===item.colIndex&&React.createElement(CheckMarkSingle,null)))))},React.createElement("div",{className:styles.customSortPanelItemColumnInput},React.createElement("span",{className:styles.customSortPanelItemColumnInputText},itemLabel),React.createElement(MoreDownSingle,{className:styles.customSortPanelItemColumnInputDropdown}))))),React.createElement("div",{className:styles.customSortPanelItemOrder},React.createElement(design.RadioGroup,{className:radioClass,value:item.type,onChange:__name(value=>{onChange({...item,type:value},currentIndex)},"onChange")},React.createElement(design.Radio,{value:sheetsSort.SortType.ASC},localeService.t("sheets-sort.general.sort-asc")),React.createElement(design.Radio,{value:sheetsSort.SortType.DESC},localeService.t("sheets-sort.general.sort-desc")))),React.createElement("div",{className:styles.customSortPanelItemRemove},showDelete&&React.createElement(DeleteEmptySingle,{onClick:__name(()=>onChange(null,currentIndex),"onClick")})))}__name(SortOptionItem,"SortOptionItem");function findNextColIndex(range,list){const{startColumn,endColumn}=range,used=new Set(list.map(item=>item==null?void 0:item.colIndex));for(let i=startColumn;i<=endColumn;i++)if(!used.has(i))return i;return null}__name(findNextColIndex,"findNextColIndex");function EmbedSortBtn(props){const{range,colIndex,onClose}=props,sheetsSortUIService=core.useDependency(SheetsSortUIService),univerInstanceService=core.useDependency(core.IUniverInstanceService),localeService=core.useDependency(core.LocaleService),apply=React.useCallback(asc=>{const{unitId,subUnitId}=sheets.getSheetCommandTarget(univerInstanceService)||{};if(range&&unitId&&subUnitId){const noTitleRange={...range,startRow:range.startRow+1};sheetsSortUIService.triggerSortDirectly(asc,!1,{unitId,subUnitId,range:noTitleRange,colIndex})}else console.warn(`Cannot find the target to sort. unitId: ${unitId}, subUnitId: ${subUnitId}, range: ${range}, colIndex: ${colIndex}`);onClose()},[range,colIndex,sheetsSortUIService,univerInstanceService,onClose]);return React.createElement("div",{className:styles.embedSortBtnContainer},React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnAsc}`,onClick:__name(()=>apply(!0),"onClick")},React.createElement(AscendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-asc")),React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnDesc}`,onClick:__name(()=>apply(!1),"onClick")},React.createElement(DescendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-desc")))}__name(EmbedSortBtn,"EmbedSortBtn");const SHEETS_SORT_MENU_ID="sheet.menu.sheets-sort",SHEETS_SORT_CTX_MENU_ID="sheet.menu.sheets-sort-ctx",SHEETS_SORT_ASC_ICON="AscendingSingle",SHEETS_SORT_ASC_EXT_ICON="ExpandAscendingSingle",SHEETS_SORT_DESC_ICON="DescendingSingle",SHEETS_SORT_DESC_EXT_ICON="ExpandDescendingSingle",SHEETS_SORT_CUSTOM_ICON="CustomSortSingle";function sortRangeMenuFactory(accessor){return{id:SHEETS_SORT_MENU_ID,type:ui.MenuItemType.SUBITEMS,positions:[ui.MenuPosition.TOOLBAR_START],group:ui.MenuGroup.TOOLBAR_FORMULAS_INSERT,icon:SHEETS_SORT_ASC_ICON,tooltip:"sheets-sort.general.sort",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeMenuFactory,"sortRangeMenuFactory");function sortRangeAscMenuFactory(_accessor){return{id:SortRangeAscCommand.id,icon:SHEETS_SORT_ASC_ICON,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeAscMenuFactory,"sortRangeAscMenuFactory");function sortRangeAscExtMenuFactory(_accessor){return{id:SortRangeAscExtCommand.id,title:"sheets-sort.general.sort-asc-ext",icon:SHEETS_SORT_ASC_EXT_ICON,type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeAscExtMenuFactory,"sortRangeAscExtMenuFactory");function sortRangeDescMenuFactory(_accessor){return{id:SortRangeDescCommand.id,title:"sheets-sort.general.sort-desc-cur",icon:SHEETS_SORT_DESC_ICON,type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeDescMenuFactory,"sortRangeDescMenuFactory");function sortRangeDescExtMenuFactory(_accessor){return{id:SortRangeDescExtCommand.id,title:"sheets-sort.general.sort-desc-ext",icon:SHEETS_SORT_DESC_EXT_ICON,type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID]}}__name(sortRangeDescExtMenuFactory,"sortRangeDescExtMenuFactory");function sortRangeCustomMenuFactory(_accessor){return{id:SortRangeCustomCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_MENU_ID],icon:SHEETS_SORT_CUSTOM_ICON}}__name(sortRangeCustomMenuFactory,"sortRangeCustomMenuFactory");function sortRangeCtxMenuFactory(accessor){return{id:SHEETS_SORT_CTX_MENU_ID,title:"sheets-sort.general.sort",type:ui.MenuItemType.SUBITEMS,positions:[ui.MenuPosition.CONTEXT_MENU,sheetsUi.SheetMenuPosition.COL_HEADER_CONTEXT_MENU,sheetsUi.SheetMenuPosition.ROW_HEADER_CONTEXT_MENU],group:ui.MenuGroup.CONTEXT_MENU_DATA,icon:SHEETS_SORT_ASC_ICON,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCtxMenuFactory,"sortRangeCtxMenuFactory");function sortRangeAscCtxMenuFactory(_accessor){return{id:SortRangeAscInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_ICON,positions:[SHEETS_SORT_CTX_MENU_ID],disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscCtxMenuFactory,"sortRangeAscCtxMenuFactory");function sortRangeAscExtCtxMenuFactory(_accessor){return{id:SortRangeAscExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-ext",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_EXT_ICON,positions:[SHEETS_SORT_CTX_MENU_ID],disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscExtCtxMenuFactory,"sortRangeAscExtCtxMenuFactory");function sortRangeDescCtxMenuFactory(_accessor){return{id:SortRangeDescInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-cur",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_CTX_MENU_ID],icon:SHEETS_SORT_DESC_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescCtxMenuFactory,"sortRangeDescCtxMenuFactory");function sortRangeDescExtCtxMenuFactory(_accessor){return{id:SortRangeDescExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-ext",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_CTX_MENU_ID],icon:SHEETS_SORT_DESC_EXT_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescExtCtxMenuFactory,"sortRangeDescExtCtxMenuFactory");function sortRangeCustomCtxMenuFactory(_accessor){return{id:SortRangeCustomInCtxMenuCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,positions:[SHEETS_SORT_CTX_MENU_ID],icon:SHEETS_SORT_CUSTOM_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCustomCtxMenuFactory,"sortRangeCustomCtxMenuFactory");var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const DefaultSheetsSortUIConfig={menu:{}},CUSTOM_SORT_DIALOG_ID="custom-sort-dialog",CUSTOM_SORT_PANEL_WIDTH=560;let SheetsSortUIController=(_b=class extends core.RxDisposable{constructor(_config,_commandService,_menuService,_dialogService,_layoutService,_uiPartsService,_sheetRenderService,_localeService,_sheetsSortUIService,_injector,_componentManager){super(),this._config=_config,this._commandService=_commandService,this._menuService=_menuService,this._dialogService=_dialogService,this._layoutService=_layoutService,this._uiPartsService=_uiPartsService,this._sheetRenderService=_sheetRenderService,this._localeService=_localeService,this._sheetsSortUIService=_sheetsSortUIService,this._injector=_injector,this._componentManager=_componentManager,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){const{menu={}}=this._config;[sortRangeMenuFactory,sortRangeAscMenuFactory,sortRangeDescMenuFactory,sortRangeAscExtMenuFactory,sortRangeDescExtMenuFactory,sortRangeCustomMenuFactory,sortRangeCtxMenuFactory,sortRangeAscCtxMenuFactory,sortRangeDescCtxMenuFactory,sortRangeAscExtCtxMenuFactory,sortRangeDescExtCtxMenuFactory,sortRangeCustomCtxMenuFactory].forEach(factory=>{this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory),menu))})}_initCommands(){[SortRangeAscCommand,SortRangeAscExtCommand,SortRangeDescCommand,SortRangeDescExtCommand,SortRangeCustomCommand,SortRangeAscInCtxMenuCommand,SortRangeAscExtInCtxMenuCommand,SortRangeDescInCtxMenuCommand,SortRangeDescExtInCtxMenuCommand,SortRangeCustomInCtxMenuCommand].forEach(command=>this.disposeWithMe(this._commandService.registerCommand(command))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(sheetsSort.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",CustomSortPanel)),this.disposeWithMe(this._uiPartsService.registerComponent(sheetsUi.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>core.connectInjector(EmbedSortBtn,this._injector))),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_ICON,AscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_EXT_ICON,ExpandAscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_ICON,DescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_EXT_ICON,ExpandDescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_CUSTOM_ICON,CustomSortSingle)),this._sheetsSortUIService.customSortState$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(newState=>{newState&&newState.show&&newState.location?this._openCustomSortPanel(newState.location):newState&&!(newState!=null&&newState.show)&&this._closePanel()})}_openCustomSortPanel(location){this._dialogService.open({id:CUSTOM_SORT_DIALOG_ID,draggable:!0,width:CUSTOM_SORT_PANEL_WIDTH,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${engineFormula.serializeRange(location.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:getCustomSortDialogDefaultPosition(),preservePositionOnDestroy:!1,onClose:__name(()=>this._closePanel(),"onClose"),mask:!0})}_closePanel(){this._dialogService.close(CUSTOM_SORT_DIALOG_ID),queueMicrotask(()=>this._layoutService.focus())}},__name(_b,"SheetsSortUIController"),_b);SheetsSortUIController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Ready,SheetsSortUIController),__decorateParam$1(1,core.ICommandService),__decorateParam$1(2,ui.IMenuService),__decorateParam$1(3,ui.IDialogService),__decorateParam$1(4,ui.ILayoutService),__decorateParam$1(5,ui.IUIPartsService),__decorateParam$1(6,core.Inject(sheetsUi.SheetsRenderService)),__decorateParam$1(7,core.Inject(core.LocaleService)),__decorateParam$1(8,core.Inject(SheetsSortUIService)),__decorateParam$1(9,core.Inject(core.Injector)),__decorateParam$1(10,core.Inject(ui.ComponentManager))],SheetsSortUIController);function getCustomSortDialogDefaultPosition(){return{x:0,y:0}}__name(getCustomSortDialogDefaultPosition,"getCustomSortDialogDefaultPosition");var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");const NAME="UNIVER_SHEETS_SORT_UI_PLUGIN";exports2.UniverSheetsSortUIPlugin=(_c=class extends core.Plugin{constructor(_config={},_injector,_localeService){super(),this._config=_config,this._injector=_injector,this._localeService=_localeService,this._config=core.Tools.deepMerge({},DefaultSheetsSortUIConfig,this._config)}onStarting(){[[SheetsSortUIService],[SheetsSortUIController,{useFactory:__name(()=>this._injector.createInstance(SheetsSortUIController,this._config),"useFactory")}]].forEach(d=>this._injector.add(d))}},__name(_c,"UniverSheetsSortUIPlugin"),_c),__publicField2(exports2.UniverSheetsSortUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET),__publicField2(exports2.UniverSheetsSortUIPlugin,"pluginName",NAME),exports2.UniverSheetsSortUIPlugin=__decorateClass([core.DependentOn(sheetsSort.UniverSheetsSortPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.Inject(core.LocaleService))],exports2.UniverSheetsSortUIPlugin),exports2.SortRangeAscCommand=SortRangeAscCommand,exports2.SortRangeAscExtCommand=SortRangeAscExtCommand,exports2.SortRangeAscExtInCtxMenuCommand=SortRangeAscExtInCtxMenuCommand,exports2.SortRangeAscInCtxMenuCommand=SortRangeAscInCtxMenuCommand,exports2.SortRangeCustomCommand=SortRangeCustomCommand,exports2.SortRangeCustomInCtxMenuCommand=SortRangeCustomInCtxMenuCommand,exports2.SortRangeDescCommand=SortRangeDescCommand,exports2.SortRangeDescExtCommand=SortRangeDescExtCommand,exports2.SortRangeDescExtInCtxMenuCommand=SortRangeDescExtInCtxMenuCommand,exports2.SortRangeDescInCtxMenuCommand=SortRangeDescInCtxMenuCommand,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
1
+ (function(global,factory){typeof exports=="object"&&typeof module<"u"?factory(exports,require("@univerjs/core"),require("@univerjs/sheets-sort"),require("@univerjs/sheets"),require("react"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/design"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/sheets","react","@univerjs/ui","rxjs","@univerjs/design","@univerjs/engine-formula","@univerjs/sheets-ui"],factory):(global=typeof globalThis<"u"?globalThis:global||self,factory(global.UniverSheetsSortUi={},global.UniverCore,global.UniverSheetsSort,global.UniverSheets,global.React,global.UniverUi,global.rxjs,global.UniverDesign,global.UniverEngineFormula,global.UniverSheetsUi))})(this,function(exports2,core,sheetsSort,sheets,React,ui,rxjs,design,engineFormula,sheetsUi){"use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);var _a,_b,_c;const styles={extendConfirmContent:"univer-extend-confirm-content",extendConfirmRadioGroup:"univer-extend-confirm-radio-group",customSortPanelContainer:"univer-custom-sort-panel-container",customSortPanelExt:"univer-custom-sort-panel-ext",addCondition:"univer-add-condition",addConditionText:"univer-add-condition-text",addConditionDisable:"univer-add-condition-disable",customSortPanelFooter:"univer-custom-sort-panel-footer",customSortPanelFooterBtn:"univer-custom-sort-panel-footer-btn",customSortPanelItem:"univer-custom-sort-panel-item",customSortPanelItemHead:"univer-custom-sort-panel-item-head",customSortPanelItemHandler:"univer-custom-sort-panel-item-handler",customSortPanelItemRemove:"univer-custom-sort-panel-item-remove",customSortPanelItemColumnInput:"univer-custom-sort-panel-item-column-input",customSortPanelItemColumnInputDropdown:"univer-custom-sort-panel-item-column-input-dropdown",customSortPanelItemColumnInputText:"univer-custom-sort-panel-item-column-input-text",customSortPanelItemOrderRadio:"univer-custom-sort-panel-item-order-radio",customSortPanelItemOrderRadioCn:"univer-custom-sort-panel-item-order-radio-cn",conditionList:"univer-condition-list",embedSortBtnContainer:"univer-embed-sort-btn-container",embedSortBtn:"univer-embed-sort-btn",embedSortBtnAsc:"univer-embed-sort-btn-asc",embedSortBtnDesc:"univer-embed-sort-btn-desc",embedSortBtnIcon:"univer-embed-sort-btn-icon",customSortColMenu:"univer-custom-sort-col-menu",customSortColMenuItem:"univer-custom-sort-col-menu-item",customSortColMenuItemDesc:"univer-custom-sort-col-menu-item-desc"},ExtendConfirm=__name(props=>{const[extend,setExtend]=React.useState("0"),localeService=core.useDependency(core.LocaleService);return React.createElement("div",{className:styles.extendConfirmContent},React.createElement("div",{className:"extend-confirm-desc"},localeService.t("sheets-sort.dialog.sort-reminder-desc")),React.createElement(design.RadioGroup,{className:styles.extendConfirmRadioGroup,value:extend,direction:"vertical",onChange:__name(value=>{setExtend(value),props.onChange(value)},"onChange")},React.createElement(design.Radio,{value:"0"},localeService.t("sheets-sort.dialog.sort-reminder-no")),React.createElement(design.Radio,{value:"1"},localeService.t("sheets-sort.dialog.sort-reminder-ext"))))},"ExtendConfirm");var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$2");const SORT_ERROR_MESSAGE={MERGE_ERROR:"sheets-sort.error.merge-size",EMPTY_ERROR:"sheets-sort.error.empty",SINGLE_ERROR:"sheets-sort.error.single",FORMULA_ARRAY:"sheets-sort.error.formula-array"};let SheetsSortUIService=(_a=class extends core.Disposable{constructor(_univerInstanceService,_confirmService,_logService,_selectionManagerService,_sheetsSortService,_localeService,_commandService){super();__publicField(this,"_customSortState$",new rxjs.BehaviorSubject(null));__publicField(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=_univerInstanceService,this._confirmService=_confirmService,this._logService=_logService,this._selectionManagerService=_selectionManagerService,this._sheetsSortService=_sheetsSortService,this._localeService=_localeService,this._commandService=_commandService}async triggerSortDirectly(asc,extend,sheetRangeLocation){const location=sheetRangeLocation||await this._detectSortLocation(extend);if(!location||!this._check(location))return!1;const sortOption={orderRules:[{type:asc?sheetsSort.SortType.ASC:sheetsSort.SortType.DESC,colIndex:location.colIndex}],range:location.range};return this._sheetsSortService.applySort(sortOption,location.unitId,location.subUnitId),!0}async triggerSortCustomize(){const location=await this._detectSortLocation();return!location||!this._check(location)?!1:(this.showCustomSortPanel(location),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(hasTitle){var _a2,_b2;const location=(_a2=this.customSortState())==null?void 0:_a2.location;if(!location)return[];const{unitId,subUnitId,range}=location,worksheet=(_b2=this._univerInstanceService.getUnit(unitId))==null?void 0:_b2.getSheetBySheetId(subUnitId);if(!worksheet)return[];const colTranslator=colIndexTranslator(this._localeService);return Array.from({length:range.endColumn-range.startColumn+1},(_,i)=>{var _a3;const cellValue=(_a3=worksheet.getCell(range.startRow,i+range.startColumn))==null?void 0:_a3.v;return{index:i+range.startColumn,label:hasTitle?`${cellValue!=null?cellValue:colTranslator(i+range.startColumn)}`:colTranslator(i+range.startColumn)}})}setSelection(unitId,subUnitId,range){var _a2;const worksheet=(_a2=this._univerInstanceService.getUnit(unitId))==null?void 0:_a2.getSheetBySheetId(subUnitId);if(!worksheet)return;const setSelectionsOperationParams={unitId,subUnitId,selections:[{range,primary:sheets.getPrimaryForRange(range,worksheet),style:null}]};this._commandService.executeCommand(sheets.SetSelectionsOperation.id,setSelectionsOperationParams)}async showCheckError(content){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:React.createElement("div",null,this._localeService.t(content))}})}async showExtendConfirm(){let shouldExtend=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:React.createElement(ExtendConfirm,{onChange:__name(value=>{shouldExtend=value==="1"},"onChange")})},width:400})?shouldExtend?"extend":"keep":"cancel"}showCustomSortPanel(location){this._customSortState$.next({location,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(location){return this._sheetsSortService.singleCheck(location)?this._sheetsSortService.mergeCheck(location)?this._sheetsSortService.formulaCheck(location)?this._sheetsSortService.emptyCheck(location)?!0:(this.showCheckError(SORT_ERROR_MESSAGE.EMPTY_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.FORMULA_ARRAY),!1):(this.showCheckError(SORT_ERROR_MESSAGE.MERGE_ERROR),!1):(this.showCheckError(SORT_ERROR_MESSAGE.SINGLE_ERROR),!1)}async _detectSortLocation(extend){const workbook=this._univerInstanceService.getCurrentUnitForType(core.UniverInstanceType.UNIVER_SHEET),worksheet=workbook.getActiveSheet(),unitId=workbook.getUnitId(),subUnitId=worksheet.getSheetId(),selection=this._selectionManagerService.getCurrentLastSelection();if(!selection)return null;let range;if(extend===!0)range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range);else if(extend===!1)range=selection.range;else{const confirmRes=await this.showExtendConfirm();if(confirmRes==="cancel")return null;confirmRes==="keep"?range=selection.range:(range=sheets.expandToContinuousRange(selection.range,{up:!0,down:!0,left:!0,right:!0},worksheet),this.setSelection(unitId,subUnitId,range))}return{range,unitId,subUnitId,colIndex:selection.primary.actualColumn}}},__name(_a,"SheetsSortUIService"),_a);SheetsSortUIService=__decorateClass$2([core.OnLifecycle(core.LifecycleStages.Ready,sheetsSort.SheetsSortService),__decorateParam$2(0,core.IUniverInstanceService),__decorateParam$2(1,ui.IConfirmService),__decorateParam$2(2,core.ILogService),__decorateParam$2(3,core.Inject(sheets.SheetsSelectionsService)),__decorateParam$2(4,core.Inject(sheetsSort.SheetsSortService)),__decorateParam$2(5,core.Inject(core.LocaleService)),__decorateParam$2(6,core.ICommandService)],SheetsSortUIService);function colIndexTranslator(localeService){return colIndex=>{const colName=core.Tools.chatAtABC(colIndex);switch(localeService.getCurrentLocale()){case core.LocaleType.ZH_CN:return`"${colName}"列`;case core.LocaleType.EN_US:return`Column "${colName}"`;default:return`Column "${colName}"`}}}__name(colIndexTranslator,"colIndexTranslator");var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},__rest=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t},IconBase=React.forwardRef(function(props,ref){var icon=props.icon,id=props.id,className=props.className,extend=props.extend,restProps=__rest(props,["icon","id","className","extend"]),cls="univerjs-icon univerjs-icon-".concat(id," ").concat(className||"").trim(),idSuffix=React.useRef("_".concat(generateShortUuid()));return render(icon,"".concat(id),{defIds:icon.defIds,idSuffix:idSuffix.current},__assign({ref,className:cls},restProps),extend)});function render(node,id,runtimeProps,rootProps,extend){return React.createElement(node.tag,__assign(__assign({key:id},replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend)),rootProps),(replaceRuntimeIdsInDefs(node,runtimeProps).children||[]).map(function(child,index){return render(child,"".concat(id,"-").concat(node.tag,"-").concat(index),runtimeProps,void 0,extend)}))}__name(render,"render");function replaceRuntimeIdsAndExtInAttrs(node,runtimeProps,extend){var attrs=__assign({},node.attrs);extend!=null&&extend.colorChannel1&&attrs.fill==="colorChannel1"&&(attrs.fill=extend.colorChannel1);var defIds=runtimeProps.defIds;return!defIds||defIds.length===0||(node.tag==="use"&&attrs["xlink:href"]&&(attrs["xlink:href"]=attrs["xlink:href"]+runtimeProps.idSuffix),Object.entries(attrs).forEach(function(_a2){var key=_a2[0],value=_a2[1];typeof value=="string"&&(attrs[key]=value.replace(/url\(#(.*)\)/,"url(#$1".concat(runtimeProps.idSuffix,")")))})),attrs}__name(replaceRuntimeIdsAndExtInAttrs,"replaceRuntimeIdsAndExtInAttrs");function replaceRuntimeIdsInDefs(node,runtimeProps){var _a2,defIds=runtimeProps.defIds;return!defIds||defIds.length===0?node:node.tag==="defs"&&(!((_a2=node.children)===null||_a2===void 0)&&_a2.length)?__assign(__assign({},node),{children:node.children.map(function(child){return typeof child.attrs.id=="string"&&defIds&&defIds.indexOf(child.attrs.id)>-1?__assign(__assign({},child),{attrs:__assign(__assign({},child.attrs),{id:child.attrs.id+runtimeProps.idSuffix})}):child})}):node}__name(replaceRuntimeIdsInDefs,"replaceRuntimeIdsInDefs");function generateShortUuid(){return Math.random().toString(36).substring(2,8)}__name(generateShortUuid,"generateShortUuid"),IconBase.displayName="UniverIcon";var element$9={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},AscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"ascending- single",ref,icon:element$9}))});AscendingSingle.displayName="AscendingSingle";var element$8={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CheckMarkSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"check-mark-single",ref,icon:element$8}))});CheckMarkSingle.displayName="CheckMarkSingle";var element$7={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574 8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507 9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661 11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306zM6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512 7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574 6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588 4.88808 9.55156 5.26798 9.55156 5.50229 9.78588L6.22584 10.5094z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.14014 3.73989C1.14014 2.30396 2.3042 1.13989 3.74014 1.13989H12.2601C13.6961 1.13989 14.8601 2.30395 14.8601 3.73989V12.2599C14.8601 13.6958 13.6961 14.8599 12.2601 14.8599H3.74014C2.3042 14.8599 1.14014 13.6958 1.14014 12.2599V3.73989ZM2.34014 5.86724V12.2599C2.34014 13.0331 2.96694 13.6599 3.74014 13.6599H12.2601C13.0333 13.6599 13.6601 13.0331 13.6601 12.2599V5.86724H2.34014ZM13.6601 4.66724H2.34014V3.73989C2.34014 2.9667 2.96694 2.33989 3.74014 2.33989H12.2601C13.0333 2.33989 13.6601 2.96669 13.6601 3.73989V4.66724Z",fillRule:"evenodd",clipRule:"evenodd"}}]},CustomSortSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"custom-sort-single",ref,icon:element$7}))});CustomSortSingle.displayName="CustomSortSingle";var element$6={tag:"svg",attrs:{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.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.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.64443 14.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:"M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V13.1332C3.15332 14.2377 4.04875 15.1332 5.15332 15.1332H10.8465C11.9511 15.1332 12.8465 14.2377 12.8465 13.1331V6.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.82217V13.1331C11.6465 13.575 11.2884 13.9331 10.8465 13.9331H5.15332C4.71149 13.9331 4.35332 13.575 4.35332 13.1332V6.82217Z",fillRule:"evenodd",clipRule:"evenodd"}}]},DeleteEmptySingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"delete-empty-single",ref,icon:element$6}))});DeleteEmptySingle.displayName="DeleteEmptySingle";var element$5={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},DescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"descending-single",ref,icon:element$5}))});DescendingSingle.displayName="DescendingSingle";var element$4={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 3.20024C1.57503 3.20024 1.3064 2.93161 1.3064 2.60024C1.3064 2.26887 1.57503 2.00024 1.9064 2.00024H4.57306C4.90443 2.00024 5.17306 2.26887 5.17306 2.60024C5.17306 2.93161 4.90443 3.20024 4.57306 3.20024H1.9064ZM1.3064 6.19985C1.3064 6.53122 1.57503 6.79985 1.9064 6.79985H5.9064C6.23777 6.79985 6.5064 6.53122 6.5064 6.19985C6.5064 5.86848 6.23777 5.59985 5.9064 5.59985H1.9064C1.57503 5.59985 1.3064 5.86848 1.3064 6.19985ZM1.9064 10.3997C1.57503 10.3997 1.3064 10.1311 1.3064 9.79971C1.3064 9.46834 1.57503 9.19971 1.9064 9.19971H7.23973C7.5711 9.19971 7.83973 9.46834 7.83973 9.79971C7.83973 10.1311 7.5711 10.3997 7.23973 10.3997H1.9064ZM1.9064 13.9996C1.57503 13.9996 1.3064 13.7309 1.3064 13.3996C1.3064 13.0682 1.57503 12.7996 1.9064 12.7996H8.57306C8.90443 12.7996 9.17306 13.0682 9.17306 13.3996C9.17306 13.7309 8.90443 13.9996 8.57306 13.9996H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 14.2667C12.4267 14.5981 12.1581 14.8667 11.8267 14.8667C11.4953 14.8667 11.2267 14.5981 11.2267 14.2667V3.18198L9.98447 4.42422C9.75015 4.65853 9.37026 4.65853 9.13594 4.42422C8.90163 4.1899 8.90163 3.81 9.13594 3.57569L11.4026 1.30902C11.6369 1.07471 12.0168 1.07471 12.2511 1.30902L14.5178 3.57569C14.7521 3.81 14.7521 4.1899 14.5178 4.42422C14.2835 4.65853 13.9036 4.65853 13.6693 4.42422L12.4267 3.18165V14.2667Z"}}]},ExpandAscendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-ascending-single",ref,icon:element$4}))});ExpandAscendingSingle.displayName="ExpandAscendingSingle";var element$3={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.9064 12.7998C1.57503 12.7998 1.3064 13.0684 1.3064 13.3998C1.3064 13.7311 1.57503 13.9998 1.9064 13.9998H4.57306C4.90443 13.9998 5.17306 13.7311 5.17306 13.3998C5.17306 13.0684 4.90443 12.7998 4.57306 12.7998H1.9064ZM1.3064 9.80015C1.3064 9.46878 1.57503 9.20015 1.9064 9.20015H5.9064C6.23777 9.20015 6.5064 9.46878 6.5064 9.80015C6.5064 10.1315 6.23777 10.4001 5.9064 10.4001H1.9064C1.57503 10.4001 1.3064 10.1315 1.3064 9.80015ZM1.9064 5.60029C1.57503 5.60029 1.3064 5.86892 1.3064 6.20029C1.3064 6.53166 1.57503 6.80029 1.9064 6.80029H7.23973C7.5711 6.80029 7.83973 6.53166 7.83973 6.20029C7.83973 5.86892 7.5711 5.60029 7.23973 5.60029H1.9064ZM1.9064 2.00044C1.57503 2.00044 1.3064 2.26907 1.3064 2.60044C1.3064 2.93181 1.57503 3.20044 1.9064 3.20044H8.57306C8.90443 3.20044 9.17306 2.93181 9.17306 2.60044C9.17306 2.26907 8.90443 2.00044 8.57306 2.00044H1.9064Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M12.4267 1.7333C12.4267 1.40193 12.1581 1.1333 11.8267 1.1333C11.4953 1.1333 11.2267 1.40193 11.2267 1.7333V12.818L9.98447 11.5758C9.75015 11.3415 9.37026 11.3415 9.13594 11.5758C8.90163 11.8101 8.90163 12.19 9.13594 12.4243L11.4026 14.691C11.6369 14.9253 12.0168 14.9253 12.2511 14.691L14.5178 12.4243C14.7521 12.19 14.7521 11.8101 14.5178 11.5758C14.2835 11.3415 13.9036 11.3415 13.6693 11.5758L12.4267 12.8183V1.7333Z"}}]},ExpandDescendingSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"expand-descending-single",ref,icon:element$3}))});ExpandDescendingSingle.displayName="ExpandDescendingSingle";var element$2={tag:"svg",attrs:{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"}}]},IncreaseSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"increase-single",ref,icon:element$2}))});IncreaseSingle.displayName="IncreaseSingle";var element$1={tag:"svg",attrs:{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"}}]},MoreDownSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"more-down-single",ref,icon:element$1}))});MoreDownSingle.displayName="MoreDownSingle";var element={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"mask",attrs:{id:"mask0_622_8",style:{maskType:"alpha"},width:16,height:16,x:0,y:0,maskUnits:"userSpaceOnUse"},children:[{tag:"path",attrs:{fill:"#D9D9D9",d:"M0 0H16V16H0z"}}]},{tag:"g",attrs:{fill:"currentColor",mask:"url(#mask0_622_8)"},children:[{tag:"path",attrs:{d:"M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z"}}]}]},SequenceSingle=React.forwardRef(function(props,ref){return React.createElement(IconBase,Object.assign({},props,{id:"sequence-single",ref,icon:element}))});SequenceSingle.displayName="SequenceSingle";const SortRangeAscCommand={id:"sheet.command.sort-range-asc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtCommand={id:"sheet.command.sort-range-asc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescCommand={id:"sheet.command.sort-range-desc",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtCommand={id:"sheet.command.sort-range-desc-ext",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomCommand={id:"sheet.command.sort-range-custom",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")},SortRangeAscInCtxMenuCommand={id:"sheet.command.sort-range-asc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!1),"handler")},SortRangeAscExtInCtxMenuCommand={id:"sheet.command.sort-range-asc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!0,!0),"handler")},SortRangeDescInCtxMenuCommand={id:"sheet.command.sort-range-desc-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!1),"handler")},SortRangeDescExtInCtxMenuCommand={id:"sheet.command.sort-range-desc-ext-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortDirectly(!1,!0),"handler")},SortRangeCustomInCtxMenuCommand={id:"sheet.command.sort-range-custom-ctx",type:core.CommandType.COMMAND,handler:__name(async accessor=>await accessor.get(SheetsSortUIService).triggerSortCustomize(),"handler")};function CustomSortPanel(){const sheetsSortUIService=core.useDependency(SheetsSortUIService),sheetsSortService=core.useDependency(sheetsSort.SheetsSortService),localeService=core.useDependency(core.LocaleService),[hasTitle,setHasTitle]=React.useState(!1),[scrollPosition,setScrollPosition]=React.useState(0),listEndRef=React.useRef(null),state=sheetsSortUIService.customSortState();if(!state||!state.location)return null;const{range,unitId,subUnitId}=state.location,titles=sheetsSortUIService.getTitles(hasTitle),[list,setList]=React.useState([{type:sheetsSort.SortType.ASC,colIndex:range.startColumn}]),onItemChange=React.useCallback((index,value)=>{const newList=[...list];value===null?newList.splice(index,1):newList[index]=value,setList(newList)},[list]),newItem=React.useCallback(core.throttle(()=>{const newList=[...list],nextColIndex=findNextColIndex(range,list);nextColIndex!==null&&(newList.push({type:sheetsSort.SortType.ASC,colIndex:nextColIndex}),setList(newList))},200),[list,range]),apply=React.useCallback((orderRules,hasTitle2)=>{sheetsSortService.applySort({range,orderRules,hasTitle:hasTitle2}),sheetsSortUIService.closeCustomSortPanel()},[sheetsSortService,sheetsSortUIService,range]),cancel=React.useCallback(()=>{sheetsSortUIService.closeCustomSortPanel()},[sheetsSortUIService]),setTitle=React.useCallback(value=>{setHasTitle(value),value?sheetsSortUIService.setSelection(unitId,subUnitId,{...range,startRow:range.startRow+1}):sheetsSortUIService.setSelection(unitId,subUnitId,range)},[sheetsSortUIService,range,subUnitId,unitId]);React.useEffect(()=>{listEndRef.current&&list.length>5&&(listEndRef.current.scrollTop=listEndRef.current.scrollHeight)},[list]);const canNew=list.length<titles.length,dragList=list.map(item=>({...item,id:`${item.colIndex}`}));return React.createElement("div",{className:styles.customSortPanelContainer},React.createElement("div",{className:styles.customSortPanelContent,onMouseDown:__name(e=>{e.stopPropagation()},"onMouseDown")},React.createElement("div",{className:styles.customSortPanelExt},React.createElement("div",{className:styles.firstRowCheck},React.createElement(design.Checkbox,{checked:hasTitle,onChange:__name(value=>setTitle(!!value),"onChange")},localeService.t("sheets-sort.dialog.first-row-check"))),canNew?React.createElement("div",{className:styles.addCondition,onClick:newItem},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition"))):React.createElement("div",{className:`${styles.addCondition} ${styles.addConditionDisable}`},React.createElement(IncreaseSingle,null),React.createElement("span",{className:styles.addConditionText},localeService.t("sheets-sort.dialog.add-condition")))),React.createElement("div",{className:styles.conditionList,onScroll:__name(e=>{const position=e.currentTarget.scrollTop;setScrollPosition(position)},"onScroll"),ref:listEndRef},React.createElement(design.DraggableList,{list:dragList,onListChange:setList,idKey:"id",draggableHandle:`.${styles.customSortPanelItemHandler}`,itemRender:__name(item=>React.createElement(SortOptionItem,{titles,list:dragList,item,onChange:__name((value,index)=>onItemChange(index,value),"onChange"),scrollPosition}),"itemRender"),rowHeight:32,margin:[0,12]}))),React.createElement("div",{className:styles.customSortPanelFooter},React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"default",onClick:__name(()=>cancel(),"onClick")},localeService.t("sheets-sort.dialog.cancel")),React.createElement(design.Button,{className:styles.customSortPanelFooterBtn,type:"primary",onClick:__name(()=>apply(list,hasTitle),"onClick")},localeService.t("sheets-sort.dialog.confirm"))))}__name(CustomSortPanel,"CustomSortPanel");function SortOptionItem(props){var _a2;const{list,item,titles,onChange,scrollPosition}=props,localeService=core.useDependency(core.LocaleService),availableMenu=titles.filter(title=>!list.some(item2=>item2.colIndex===title.index)||title.index===item.colIndex),currentIndex=list.findIndex(listItem=>listItem.colIndex===item.colIndex),handleChangeColIndex=React.useCallback(menuItem=>{onChange({...item,colIndex:menuItem.index},currentIndex),setVisible(!1)},[currentIndex,item,onChange]),[visible,setVisible]=React.useState(!1),onVisibleChange=__name(visible2=>{setVisible(visible2)},"onVisibleChange");React.useEffect(()=>{setVisible(!1)},[scrollPosition]);const showDelete=list.length>1,itemLabel=(_a2=titles.find(title=>title.index===item.colIndex))==null?void 0:_a2.label,radioClass=localeService.getCurrentLocale()===core.LocaleType.ZH_CN?styles.customSortPanelItemOrderRadioCn:styles.customSortPanelItemOrderRadio;return React.createElement("div",{className:styles.customSortPanelItem},React.createElement("div",{className:styles.customSortPanelItemHead},React.createElement("div",{className:styles.customSortPanelItemHandler},React.createElement(SequenceSingle,null)),React.createElement("div",{className:styles.customSortPanelItemColumn},React.createElement(design.Dropdown,{placement:"bottomLeft",trigger:["click"],visible,onVisibleChange,overlay:React.createElement("ul",{className:styles.customSortColMenu},availableMenu.map(menuItem=>React.createElement("li",{key:menuItem.index,onClick:__name(()=>handleChangeColIndex(menuItem),"onClick"),className:styles.customSortColMenuItem},React.createElement("span",{className:styles.customSortColMenuItemDesc},menuItem.label),React.createElement("span",{className:styles.customSortColMenuItemCheck},menuItem.index===item.colIndex&&React.createElement(CheckMarkSingle,null)))))},React.createElement("div",{className:styles.customSortPanelItemColumnInput},React.createElement("span",{className:styles.customSortPanelItemColumnInputText},itemLabel),React.createElement(MoreDownSingle,{className:styles.customSortPanelItemColumnInputDropdown}))))),React.createElement("div",{className:styles.customSortPanelItemOrder},React.createElement(design.RadioGroup,{className:radioClass,value:item.type,onChange:__name(value=>{onChange({...item,type:value},currentIndex)},"onChange")},React.createElement(design.Radio,{value:sheetsSort.SortType.ASC},localeService.t("sheets-sort.general.sort-asc")),React.createElement(design.Radio,{value:sheetsSort.SortType.DESC},localeService.t("sheets-sort.general.sort-desc")))),React.createElement("div",{className:styles.customSortPanelItemRemove},showDelete&&React.createElement(DeleteEmptySingle,{onClick:__name(()=>onChange(null,currentIndex),"onClick")})))}__name(SortOptionItem,"SortOptionItem");function findNextColIndex(range,list){const{startColumn,endColumn}=range,used=new Set(list.map(item=>item==null?void 0:item.colIndex));for(let i=startColumn;i<=endColumn;i++)if(!used.has(i))return i;return null}__name(findNextColIndex,"findNextColIndex");function EmbedSortBtn(props){const{range,colIndex,onClose}=props,sheetsSortUIService=core.useDependency(SheetsSortUIService),univerInstanceService=core.useDependency(core.IUniverInstanceService),localeService=core.useDependency(core.LocaleService),apply=React.useCallback(asc=>{const{unitId,subUnitId}=sheets.getSheetCommandTarget(univerInstanceService)||{};if(range&&unitId&&subUnitId){const noTitleRange={...range,startRow:range.startRow+1};sheetsSortUIService.triggerSortDirectly(asc,!1,{unitId,subUnitId,range:noTitleRange,colIndex})}else console.warn(`Cannot find the target to sort. unitId: ${unitId}, subUnitId: ${subUnitId}, range: ${range}, colIndex: ${colIndex}`);onClose()},[range,colIndex,sheetsSortUIService,univerInstanceService,onClose]);return React.createElement("div",{className:styles.embedSortBtnContainer},React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnAsc}`,onClick:__name(()=>apply(!0),"onClick")},React.createElement(AscendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-asc")),React.createElement("div",{className:`${styles.embedSortBtn} ${styles.embedSortBtnDesc}`,onClick:__name(()=>apply(!1),"onClick")},React.createElement(DescendingSingle,{className:styles.embedSortBtnIcon}),localeService.t("sheets-sort.general.sort-desc")))}__name(EmbedSortBtn,"EmbedSortBtn");const SHEETS_SORT_MENU_ID="sheet.menu.sheets-sort",SHEETS_SORT_CTX_MENU_ID="sheet.menu.sheets-sort-ctx",SHEETS_SORT_ASC_ICON="AscendingSingle",SHEETS_SORT_ASC_EXT_ICON="ExpandAscendingSingle",SHEETS_SORT_DESC_ICON="DescendingSingle",SHEETS_SORT_DESC_EXT_ICON="ExpandDescendingSingle",SHEETS_SORT_CUSTOM_ICON="CustomSortSingle";function sortRangeMenuFactory(accessor){return{id:SHEETS_SORT_MENU_ID,type:ui.MenuItemType.SUBITEMS,icon:SHEETS_SORT_ASC_ICON,tooltip:"sheets-sort.general.sort",hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeMenuFactory,"sortRangeMenuFactory");function sortRangeAscMenuFactory(_accessor){return{id:SortRangeAscCommand.id,icon:SHEETS_SORT_ASC_ICON,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON}}__name(sortRangeAscMenuFactory,"sortRangeAscMenuFactory");function sortRangeAscExtMenuFactory(_accessor){return{id:SortRangeAscExtCommand.id,title:"sheets-sort.general.sort-asc-ext",icon:SHEETS_SORT_ASC_EXT_ICON,type:ui.MenuItemType.BUTTON}}__name(sortRangeAscExtMenuFactory,"sortRangeAscExtMenuFactory");function sortRangeDescMenuFactory(_accessor){return{id:SortRangeDescCommand.id,title:"sheets-sort.general.sort-desc-cur",icon:SHEETS_SORT_DESC_ICON,type:ui.MenuItemType.BUTTON}}__name(sortRangeDescMenuFactory,"sortRangeDescMenuFactory");function sortRangeDescExtMenuFactory(_accessor){return{id:SortRangeDescExtCommand.id,title:"sheets-sort.general.sort-desc-ext",icon:SHEETS_SORT_DESC_EXT_ICON,type:ui.MenuItemType.BUTTON}}__name(sortRangeDescExtMenuFactory,"sortRangeDescExtMenuFactory");function sortRangeCustomMenuFactory(_accessor){return{id:SortRangeCustomCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_CUSTOM_ICON}}__name(sortRangeCustomMenuFactory,"sortRangeCustomMenuFactory");function sortRangeCtxMenuFactory(accessor){return{id:SHEETS_SORT_CTX_MENU_ID,title:"sheets-sort.general.sort",type:ui.MenuItemType.SUBITEMS,icon:SHEETS_SORT_ASC_ICON,hidden$:ui.getMenuHiddenObservable(accessor,core.UniverInstanceType.UNIVER_SHEET),disabled$:sheetsUi.getCurrentRangeDisable$(accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCtxMenuFactory,"sortRangeCtxMenuFactory");function sortRangeAscCtxMenuFactory(_accessor){return{id:SortRangeAscInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-cur",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscCtxMenuFactory,"sortRangeAscCtxMenuFactory");function sortRangeAscExtCtxMenuFactory(_accessor){return{id:SortRangeAscExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-asc-ext",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_ASC_EXT_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeAscExtCtxMenuFactory,"sortRangeAscExtCtxMenuFactory");function sortRangeDescCtxMenuFactory(_accessor){return{id:SortRangeDescInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-cur",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_DESC_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescCtxMenuFactory,"sortRangeDescCtxMenuFactory");function sortRangeDescExtCtxMenuFactory(_accessor){return{id:SortRangeDescExtInCtxMenuCommand.id,title:"sheets-sort.general.sort-desc-ext",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_DESC_EXT_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeDescExtCtxMenuFactory,"sortRangeDescExtCtxMenuFactory");function sortRangeCustomCtxMenuFactory(_accessor){return{id:SortRangeCustomInCtxMenuCommand.id,title:"sheets-sort.general.sort-custom",type:ui.MenuItemType.BUTTON,icon:SHEETS_SORT_CUSTOM_ICON,disabled$:sheetsUi.getCurrentRangeDisable$(_accessor,{workbookTypes:[sheets.WorkbookEditablePermission],worksheetTypes:[sheets.WorksheetSortPermission,sheets.WorksheetEditPermission],rangeTypes:[sheets.RangeProtectionPermissionEditPoint]})}}__name(sortRangeCustomCtxMenuFactory,"sortRangeCustomCtxMenuFactory");const menuSchema={[ui.RibbonStartGroup.FORMULAS_INSERT]:{[SHEETS_SORT_MENU_ID]:{order:2,menuItemFactory:sortRangeMenuFactory,[SortRangeAscCommand.id]:{order:0,menuItemFactory:sortRangeAscMenuFactory},[SortRangeAscExtCommand.id]:{order:1,menuItemFactory:sortRangeAscExtMenuFactory},[SortRangeDescCommand.id]:{order:2,menuItemFactory:sortRangeDescMenuFactory},[SortRangeDescExtCommand.id]:{order:3,menuItemFactory:sortRangeDescExtMenuFactory},[SortRangeCustomCommand.id]:{order:4,menuItemFactory:sortRangeCustomMenuFactory}}},[ui.ContextMenuPosition.MAIN_AREA]:{[ui.ContextMenuGroup.DATA]:{[SHEETS_SORT_CTX_MENU_ID]:{order:0,menuItemFactory:sortRangeCtxMenuFactory,[SortRangeAscInCtxMenuCommand.id]:{order:0,menuItemFactory:sortRangeAscCtxMenuFactory},[SortRangeAscExtInCtxMenuCommand.id]:{order:1,menuItemFactory:sortRangeAscExtCtxMenuFactory},[SortRangeDescInCtxMenuCommand.id]:{order:2,menuItemFactory:sortRangeDescCtxMenuFactory},[SortRangeDescExtInCtxMenuCommand.id]:{order:3,menuItemFactory:sortRangeDescExtCtxMenuFactory},[SortRangeCustomInCtxMenuCommand.id]:{order:4,menuItemFactory:sortRangeCustomCtxMenuFactory}}}}};var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam$1");const CUSTOM_SORT_DIALOG_ID="custom-sort-dialog",CUSTOM_SORT_PANEL_WIDTH=560;let SheetsSortUIController=(_b=class extends core.RxDisposable{constructor(_commandService,_menuManagerService,_dialogService,_layoutService,_uiPartsService,_sheetRenderService,_localeService,_sheetsSortUIService,_injector,_componentManager){super(),this._commandService=_commandService,this._menuManagerService=_menuManagerService,this._dialogService=_dialogService,this._layoutService=_layoutService,this._uiPartsService=_uiPartsService,this._sheetRenderService=_sheetRenderService,this._localeService=_localeService,this._sheetsSortUIService=_sheetsSortUIService,this._injector=_injector,this._componentManager=_componentManager,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(menuSchema)}_initCommands(){[SortRangeAscCommand,SortRangeAscExtCommand,SortRangeDescCommand,SortRangeDescExtCommand,SortRangeCustomCommand,SortRangeAscInCtxMenuCommand,SortRangeAscExtInCtxMenuCommand,SortRangeDescInCtxMenuCommand,SortRangeDescExtInCtxMenuCommand,SortRangeCustomInCtxMenuCommand].forEach(command=>this.disposeWithMe(this._commandService.registerCommand(command))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(sheetsSort.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",CustomSortPanel)),this.disposeWithMe(this._uiPartsService.registerComponent(sheetsUi.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>core.connectInjector(EmbedSortBtn,this._injector))),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_ICON,AscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_ASC_EXT_ICON,ExpandAscendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_ICON,DescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_DESC_EXT_ICON,ExpandDescendingSingle)),this.disposeWithMe(this._componentManager.register(SHEETS_SORT_CUSTOM_ICON,CustomSortSingle)),this._sheetsSortUIService.customSortState$.pipe(rxjs.takeUntil(this.dispose$)).subscribe(newState=>{newState&&newState.show&&newState.location?this._openCustomSortPanel(newState.location):newState&&!(newState!=null&&newState.show)&&this._closePanel()})}_openCustomSortPanel(location){this._dialogService.open({id:CUSTOM_SORT_DIALOG_ID,draggable:!0,width:CUSTOM_SORT_PANEL_WIDTH,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${engineFormula.serializeRange(location.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:getCustomSortDialogDefaultPosition(),preservePositionOnDestroy:!1,onClose:__name(()=>this._closePanel(),"onClose"),mask:!0})}_closePanel(){this._dialogService.close(CUSTOM_SORT_DIALOG_ID),queueMicrotask(()=>this._layoutService.focus())}},__name(_b,"SheetsSortUIController"),_b);SheetsSortUIController=__decorateClass$1([core.OnLifecycle(core.LifecycleStages.Ready,SheetsSortUIController),__decorateParam$1(0,core.ICommandService),__decorateParam$1(1,ui.IMenuManagerService),__decorateParam$1(2,ui.IDialogService),__decorateParam$1(3,ui.ILayoutService),__decorateParam$1(4,ui.IUIPartsService),__decorateParam$1(5,core.Inject(sheetsUi.SheetsRenderService)),__decorateParam$1(6,core.Inject(core.LocaleService)),__decorateParam$1(7,core.Inject(SheetsSortUIService)),__decorateParam$1(8,core.Inject(core.Injector)),__decorateParam$1(9,core.Inject(ui.ComponentManager))],SheetsSortUIController);function getCustomSortDialogDefaultPosition(){return{x:0,y:0}}__name(getCustomSortDialogDefaultPosition,"getCustomSortDialogDefaultPosition");const PLUGIN_CONFIG_KEY="sheets-sort-ui.config",defaultPluginConfig={};var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__defNormalProp2=__name((obj,key,value)=>key in obj?__defProp2(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,"__defNormalProp"),__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index,decorator)=>(target,key)=>decorator(target,key,index),"__decorateParam"),__publicField2=__name((obj,key,value)=>__defNormalProp2(obj,typeof key!="symbol"?key+"":key,value),"__publicField");const NAME="UNIVER_SHEETS_SORT_UI_PLUGIN";exports2.UniverSheetsSortUIPlugin=(_c=class extends core.Plugin{constructor(_config=defaultPluginConfig,_injector,_configService){super(),this._config=_config,this._injector=_injector,this._configService=_configService;const{...rest}=this._config;this._configService.setConfig(PLUGIN_CONFIG_KEY,rest)}onStarting(){[[SheetsSortUIService],[SheetsSortUIController]].forEach(d=>this._injector.add(d))}},__name(_c,"UniverSheetsSortUIPlugin"),_c),__publicField2(exports2.UniverSheetsSortUIPlugin,"type",core.UniverInstanceType.UNIVER_SHEET),__publicField2(exports2.UniverSheetsSortUIPlugin,"pluginName",NAME),exports2.UniverSheetsSortUIPlugin=__decorateClass([core.DependentOn(sheetsSort.UniverSheetsSortPlugin),__decorateParam(1,core.Inject(core.Injector)),__decorateParam(2,core.IConfigService)],exports2.UniverSheetsSortUIPlugin),exports2.SortRangeAscCommand=SortRangeAscCommand,exports2.SortRangeAscExtCommand=SortRangeAscExtCommand,exports2.SortRangeAscExtInCtxMenuCommand=SortRangeAscExtInCtxMenuCommand,exports2.SortRangeAscInCtxMenuCommand=SortRangeAscInCtxMenuCommand,exports2.SortRangeCustomCommand=SortRangeCustomCommand,exports2.SortRangeCustomInCtxMenuCommand=SortRangeCustomInCtxMenuCommand,exports2.SortRangeDescCommand=SortRangeDescCommand,exports2.SortRangeDescExtCommand=SortRangeDescExtCommand,exports2.SortRangeDescExtInCtxMenuCommand=SortRangeDescExtInCtxMenuCommand,exports2.SortRangeDescInCtxMenuCommand=SortRangeDescInCtxMenuCommand,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-sort-ui",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "private": false,
5
5
  "description": "Univer Sheets Sort UI",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -50,13 +50,13 @@
50
50
  "peerDependencies": {
51
51
  "react": "^16.9.0 || ^17.0.0 || ^18.0.0",
52
52
  "rxjs": ">=7.0.0",
53
- "@univerjs/core": "0.2.11",
54
- "@univerjs/design": "0.2.11",
55
- "@univerjs/engine-formula": "0.2.11",
56
- "@univerjs/sheets": "0.2.11",
57
- "@univerjs/sheets-sort": "0.2.11",
58
- "@univerjs/sheets-ui": "0.2.11",
59
- "@univerjs/ui": "0.2.11"
53
+ "@univerjs/core": "0.2.12",
54
+ "@univerjs/design": "0.2.12",
55
+ "@univerjs/engine-formula": "0.2.12",
56
+ "@univerjs/sheets-sort": "0.2.12",
57
+ "@univerjs/sheets-ui": "0.2.12",
58
+ "@univerjs/sheets": "0.2.12",
59
+ "@univerjs/ui": "0.2.12"
60
60
  },
61
61
  "dependencies": {
62
62
  "@univerjs/icons": "^0.1.77",
@@ -70,14 +70,14 @@
70
70
  "typescript": "^5.5.4",
71
71
  "vite": "^5.4.2",
72
72
  "vitest": "^2.0.5",
73
- "@univerjs/core": "0.2.11",
74
- "@univerjs/design": "0.2.11",
75
- "@univerjs/engine-render": "0.2.11",
76
- "@univerjs/shared": "0.2.11",
77
- "@univerjs/sheets-sort": "0.2.11",
78
- "@univerjs/sheets": "0.2.11",
79
- "@univerjs/sheets-ui": "0.2.11",
80
- "@univerjs/ui": "0.2.11"
73
+ "@univerjs/core": "0.2.12",
74
+ "@univerjs/engine-render": "0.2.12",
75
+ "@univerjs/design": "0.2.12",
76
+ "@univerjs/shared": "0.2.12",
77
+ "@univerjs/sheets": "0.2.12",
78
+ "@univerjs/sheets-ui": "0.2.12",
79
+ "@univerjs/ui": "0.2.12",
80
+ "@univerjs/sheets-sort": "0.2.12"
81
81
  },
82
82
  "univerSpace": {
83
83
  ".": {