@univerjs/preset-sheets-sort 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.css +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
package/lib/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.univer-relative{position:relative}.univer-my-0{margin-top:0;margin-bottom:0}.univer-mb-3{margin-bottom:.75rem}.univer-ml-1\.5{margin-left:.375rem}.univer-ml-2{margin-left:.5rem}.univer-ml-3{margin-left:.75rem}.univer-mt-4{margin-top:1rem}.univer-mt-5{margin-top:1.25rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-grid{display:grid}.univer-h-7{height:1.75rem}.univer-max-h-\[310px\]{max-height:310px}.univer-w-\[
|
|
1
|
+
.univer-relative{position:relative}.univer-my-0{margin-top:0;margin-bottom:0}.univer-mb-3{margin-bottom:.75rem}.univer-ml-1\.5{margin-left:.375rem}.univer-ml-2{margin-left:.5rem}.univer-ml-3{margin-left:.75rem}.univer-mt-4{margin-top:1rem}.univer-mt-5{margin-top:1.25rem}.univer-box-border{box-sizing:border-box}.univer-flex{display:flex}.univer-grid{display:grid}.univer-h-7{height:1.75rem}.univer-max-h-\[310px\]{max-height:310px}.univer-w-\[var\(--radix-popper-anchor-width\)\]{width:var(--radix-popper-anchor-width)}.univer-w-full{width:100%}.univer-max-w-\[220px\]{max-width:220px}.univer-cursor-pointer{cursor:pointer}.univer-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.univer-list-none{list-style-type:none}.univer-grid-flow-col{grid-auto-flow:column}.univer-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.univer-items-center{align-items:center}.univer-justify-end{justify-content:flex-end}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-1{gap:.25rem}.univer-gap-2{gap:.5rem}.univer-overflow-hidden{overflow:hidden}.univer-overflow-y-auto{overflow-y:auto}.univer-overflow-x-hidden{overflow-x:hidden}.univer-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.univer-rounded{border-radius:.25rem}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-md{border-radius:.375rem}.univer-border{border-width:1px}.univer-bg-white{background-color:var(--univer-white)}.univer-p-1{padding:.25rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.univer-text-base{font-size:1rem;line-height:1.5rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-text-gray-700{color:var(--univer-gray-700)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-primary-500{color:var(--univer-primary-500)}.univer-shadow-lg{--univer-tw-shadow: 0px 4px 6px 0px rgba(30, 40, 77, .05), 0px 10px 15px -3px rgba(30, 40, 77, .1);--univer-tw-shadow-colored: 0px 4px 6px 0px var(--univer-tw-shadow-color), 0px 10px 15px -3px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 4px 6px #1e284d0d,0 10px 15px -3px #1e284d1a;box-shadow:var(--univer-tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)),var(--univer-tw-ring-shadow, 0 0 rgba(0,0,0,0)),var(--univer-tw-shadow)}.univer-transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.hover\:univer-text-red-500:hover{color:var(--univer-red-500)}.disabled\:univer-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:univer-divide-opacity-30:disabled>:not([hidden])~:not([hidden]){--univer-tw-divide-opacity: .3 }.disabled\:univer-text-gray-800:disabled{color:var(--univer-gray-800)}.dark\:\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\:hover\:\!univer-bg-gray-700:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.\[\&_\.react-grid-item\]\:univer-transition-none .react-grid-item{transition-property:none}.\[\&_\.react-grid-placeholder\]\:univer-rounded .react-grid-placeholder{border-radius:.25rem}.\[\&_\.react-grid-placeholder\]\:\!univer-bg-gray-200 .react-grid-placeholder{background-color:var(--univer-gray-200)!important}
|
package/lib/umd/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
// @univerjs/sheets-sort-ui/index
|
|
10
|
-
(function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("react/jsx-runtime"),require("@univerjs/sheets"),require("@univerjs/sheets-sort"),require("@univerjs/ui"),require("rxjs"),require("@univerjs/design"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","react/jsx-runtime","@univerjs/sheets","@univerjs/sheets-sort","@univerjs/ui","rxjs","@univerjs/design","react","@univerjs/engine-formula","@univerjs/sheets-ui"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsSortUi={},d.UniverCore,d.React,d.UniverSheets,d.UniverSheetsSort,d.UniverUi,d.rxjs,d.UniverDesign,d.React,d.UniverEngineFormula,d.UniverSheetsUi))})(this,(function(d,s,c,u,w,C,te,S,l,fe,E){"use strict";var ht=Object.defineProperty;var gt=(d,s,c)=>s in d?ht(d,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[s]=c;var ee=(d,s,c)=>gt(d,typeof s!="symbol"?s+"":s,c);const pe=t=>{const[e,n]=l.useState("0"),r=C.useDependency(s.LocaleService);return c.jsxs("div",{className:"univer-text-sm",children:[c.jsx("div",{className:"extend-confirm-desc",children:r.t("sheets-sort.dialog.sort-reminder-desc")}),c.jsxs(S.RadioGroup,{className:"univer-mt-4",value:e,direction:"vertical",onChange:o=>{n(o),t.onChange(o)},children:[c.jsx(S.Radio,{value:"0",children:r.t("sheets-sort.dialog.sort-reminder-no")}),c.jsx(S.Radio,{value:"1",children:r.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var ye=Object.getOwnPropertyDescriptor,Ie=(t,e,n,r)=>{for(var o=r>1?void 0:r?ye(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=a(o)||o);return o},R=(t,e)=>(n,r)=>e(n,r,t);const O={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 p=class extends s.Disposable{constructor(e,n,r,o,i,a){super();ee(this,"_customSortState$",new te.BehaviorSubject(null));ee(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=e,this._confirmService=n,this._selectionManagerService=r,this._sheetsSortService=o,this._localeService=i,this._commandService=a}async triggerSortDirectly(e,n,r){const o=r||await this._detectSortLocation(n);if(!o||!this._check(o))return!1;const a={orderRules:[{type:e?w.SortType.ASC:w.SortType.DESC,colIndex:o.colIndex}],range:o.range};return this._sheetsSortService.applySort(a,o.unitId,o.subUnitId),!0}async triggerSortCustomize(){const e=await this._detectSortLocation();return!e||!this._check(e)?!1:(this.showCustomSortPanel(e),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(e){var g,v;const n=(g=this.customSortState())==null?void 0:g.location;if(!n)return[];const{unitId:r,subUnitId:o,range:i}=n,a=(v=this._univerInstanceService.getUnit(r))==null?void 0:v.getSheetBySheetId(o);if(!a)return[];const h=xe(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(M,I)=>{var y;const b=(y=a.getCell(i.startRow,I+i.startColumn))==null?void 0:y.v;return{index:I+i.startColumn,label:e?`${b!=null?b:h(I+i.startColumn)}`:h(I+i.startColumn)}})}setSelection(e,n,r){var a;const o=(a=this._univerInstanceService.getUnit(e))==null?void 0:a.getSheetBySheetId(n);if(!o)return;const i={unitId:e,subUnitId:n,selections:[{range:r,primary:u.getPrimaryForRange(r,o),style:null}]};this._commandService.executeCommand(u.SetSelectionsOperation.id,i)}async showCheckError(e){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:c.jsx("div",{children:this._localeService.t(e)})},cancelText:this._localeService.t("sheets-sort.dialog.cancel"),confirmText:this._localeService.t("sheets-sort.dialog.confirm")})}async showExtendConfirm(){let e=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:c.jsx(pe,{onChange:r=>{e=r==="1"}})},width:400,cancelText:this._localeService.t("sheets-sort.dialog.cancel"),confirmText:this._localeService.t("sheets-sort.dialog.confirm")})?e?"extend":"keep":"cancel"}showCustomSortPanel(e){this._customSortState$.next({location:e,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(e){return this._sheetsSortService.singleCheck(e)?this._sheetsSortService.mergeCheck(e)?this._sheetsSortService.formulaCheck(e)?this._sheetsSortService.emptyCheck(e)?!0:(this.showCheckError(O.EMPTY_ERROR),!1):(this.showCheckError(O.FORMULA_ARRAY),!1):(this.showCheckError(O.MERGE_ERROR),!1):(this.showCheckError(O.SINGLE_ERROR),!1)}async _detectSortLocation(e){const n=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=n.getActiveSheet(),o=n.getUnitId(),i=r.getSheetId(),a=this._selectionManagerService.getCurrentLastSelection();if(!a)return null;let h;if(e===!0)h=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,i,h);else if(e===!1)h=a.range;else{const g=await this.showExtendConfirm();if(g==="cancel")return null;g==="keep"?h=a.range:(h=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,i,h))}return{range:h,unitId:o,subUnitId:i,colIndex:a.primary.actualColumn}}};p=Ie([R(0,s.IUniverInstanceService),R(1,C.IConfirmService),R(2,s.Inject(u.SheetsSelectionsService)),R(3,s.Inject(w.SheetsSortService)),R(4,s.Inject(s.LocaleService)),R(5,s.ICommandService)],p);function xe(t){return e=>{const n=s.Tools.chatAtABC(e);switch(t.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${n}"列`;case s.LocaleType.EN_US:return`Column "${n}"`;default:return`Column "${n}"`}}}const N={id:"sheet.command.sort-range-asc",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!1)},L={id:"sheet.command.sort-range-asc-ext",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!0)},$={id:"sheet.command.sort-range-desc",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!1)},U={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!0)},H={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortCustomize()},j={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!1)},A={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!0)},Z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!1)},B={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortCustomize()},_e="sheets-sort-ui.config",ne={};function x({ref:t,...e}){const{icon:n,id:r,className:o,extend:i,...a}=e,h=`univerjs-icon univerjs-icon-${r} ${o||""}`.trim(),g=l.useRef(`_${Te()}`);return re(n,`${r}`,{defIds:n.defIds,idSuffix:g.current},{ref:t,className:h,...a},i)}function re(t,e,n,r,o){return l.createElement(t.tag,{key:e,...we(t,n,o),...r},(Ee(t,n).children||[]).map((i,a)=>re(i,`${e}-${t.tag}-${a}`,n,void 0,o)))}function we(t,e,n){const r={...t.attrs};n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1),t.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(([i,a])=>{i==="mask"&&typeof a=="string"&&(r[i]=a.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:o}=e;return!o||o.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(([i,a])=>{typeof a=="string"&&(r[i]=a.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),r}function Ee(t,e){var r;const{defIds:n}=e;return!n||n.length===0?t:t.tag==="defs"&&((r=t.children)!=null&&r.length)?{...t,children:t.children.map(o=>typeof o.attrs.id=="string"&&n&&n.includes(o.attrs.id)?{...o,attrs:{...o.attrs,id:o.attrs.id+e.idSuffix}}:o)}:t}function Te(){return Math.random().toString(36).substring(2,8)}x.displayName="UniverIcon";const Me={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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.67983C1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022C7.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.1916C7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212C1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.1846 1.86439C4.8641 0.989866 3.62725 0.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655C2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055L3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655C7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439ZM4.98996 4.82056L4.24567 2.78971L3.50138 4.82056H4.98996Z",fillRule:"evenodd",clipRule:"evenodd"}}]},q=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"ascending-icon",ref:n,icon:Me}))});q.displayName="AscendingIcon";const be={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},oe=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"check-mark-icon",ref:n,icon:be}))});oe.displayName="CheckMarkIcon";const Re={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574C8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507C9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661C11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512C7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574C6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588C4.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"}}]},se=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"custom-sort-icon",ref:n,icon:Re}))});se.displayName="CustomSortIcon";const ke={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},ie=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"delete-empty-icon",ref:n,icon:ke}))});ie.displayName="DeleteEmptyIcon";const Pe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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.67983C1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022C7.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.1916C7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212C1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.1846 1.86439C4.8641 0.989866 3.62725 0.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655C2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055L3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655C7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439ZM4.98996 4.82056L4.24567 2.78971L3.50138 4.82056H4.98996Z",fillRule:"evenodd",clipRule:"evenodd"}}]},G=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"descending-icon",ref:n,icon:Pe}))});G.displayName="DescendingIcon";const De={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},ce=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"expand-ascending-icon",ref:n,icon:De}))});ce.displayName="ExpandAscendingIcon";const Oe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},ae=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"expand-descending-icon",ref:n,icon:Oe}))});ae.displayName="ExpandDescendingIcon";const Ne={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},z=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"increase-icon",ref:n,icon:Ne}))});z.displayName="IncreaseIcon";const Le={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},le=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"more-down-icon",ref:n,icon:Le}))});le.displayName="MoreDownIcon";const $e={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"}}]},de=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"sequence-icon",ref:n,icon:$e}))});de.displayName="SequenceIcon";function Ue(){const t=C.useDependency(p),e=C.useObservable(t.customSortState$);return!e||!e.location?null:c.jsx(He,{state:e})}function He({state:t}){const e=C.useDependency(w.SheetsSortService),n=C.useDependency(s.LocaleService),r=C.useDependency(p),[o,i]=l.useState(!1),[a,h]=l.useState(0),g=l.useRef(null),{range:v,unitId:M,subUnitId:I}=t.location,b=r.getTitles(o),[y,P]=l.useState([{type:w.SortType.ASC,colIndex:v.startColumn}]),V=l.useCallback((m,_)=>{const D=[...y];_===null?D.splice(m,1):D[m]=_,P(D)},[y]),f=l.useCallback(s.throttle(()=>{const m=[...y],_=Ae(v,y);_!==null&&(m.push({type:w.SortType.ASC,colIndex:_}),P(m))},200),[y,v]),Q=l.useCallback((m,_)=>{e.applySort({range:v,orderRules:m,hasTitle:_}),r.closeCustomSortPanel()},[e,r,v]),dt=l.useCallback(()=>{r.closeCustomSortPanel()},[r]),ut=l.useCallback(m=>{i(m),m?r.setSelection(M,I,{...v,startRow:v.startRow+1}):r.setSelection(M,I,v)},[r,v,I,M]);l.useEffect(()=>{g.current&&y.length>5&&(g.current.scrollTop=g.current.scrollHeight)},[y]);const Ct=y.length<b.length,Se=y.map(m=>({...m,id:`${m.colIndex}`}));return c.jsxs("div",{children:[c.jsxs("div",{onMouseDown:m=>{m.stopPropagation()},children:[c.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between",children:[c.jsx(S.Checkbox,{checked:o,onChange:m=>ut(!!m),children:n.t("sheets-sort.dialog.first-row-check")}),Ct?c.jsxs("div",{className:"univer-flex univer-cursor-pointer univer-select-none univer-items-center univer-text-base",onClick:f,children:[c.jsx(z,{}),c.jsx("span",{className:"univer-ml-1.5",children:n.t("sheets-sort.dialog.add-condition")})]}):c.jsxs("div",{className:"univer-flex univer-cursor-pointer univer-select-none univer-items-center univer-text-base univer-text-primary-500 disabled:univer-cursor-not-allowed disabled:univer-divide-opacity-30 disabled:univer-text-gray-800",children:[c.jsx(z,{}),c.jsx("span",{className:"univer-ml-1.5 univer-text-xs",children:n.t("sheets-sort.dialog.add-condition")})]})]}),c.jsx("div",{ref:g,className:S.clsx("univer-max-h-[310px] univer-overflow-y-auto univer-overflow-x-hidden",S.scrollbarClassName),onScroll:m=>{const _=m.currentTarget.scrollTop;h(_)},children:c.jsx(S.DraggableList,{className:"[&_.react-grid-item]:univer-transition-none [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200",list:Se,onListChange:P,idKey:"id",draggableHandle:"[data-u-comp=sort-panel-item-handler]",itemRender:m=>c.jsx(je,{titles:b,list:Se,item:m,onChange:(_,D)=>V(D,_),scrollPosition:a}),rowHeight:32,margin:[0,12]})})]}),c.jsxs("div",{className:"univer-mt-5 univer-flex univer-justify-end",children:[c.jsx(S.Button,{className:"univer-ml-3",onClick:()=>dt(),children:n.t("sheets-sort.dialog.cancel")}),c.jsx(S.Button,{className:"univer-ml-3",variant:"primary",onClick:()=>Q(y,o),children:n.t("sheets-sort.dialog.confirm")})]})]})}function je(t){var V;const{list:e,item:n,titles:r,onChange:o,scrollPosition:i}=t,a=C.useDependency(s.LocaleService),h=r.filter(f=>!e.some(Q=>Q.colIndex===f.index)||f.index===n.colIndex),g=e.findIndex(f=>f.colIndex===n.colIndex),v=l.useCallback(f=>{o({...n,colIndex:f.index},g),I(!1)},[g,n,o]),[M,I]=l.useState(!1),b=f=>{I(f)};l.useEffect(()=>{I(!1)},[i]);const y=e.length>1,P=(V=r.find(f=>f.index===n.colIndex))==null?void 0:V.label;return c.jsxs("div",{className:"univer-grid univer-grid-flow-col univer-grid-cols-2 univer-items-center univer-gap-2",children:[c.jsxs("div",{className:"univer-flex univer-items-center",children:[c.jsx("div",{"data-u-comp":"sort-panel-item-handler",className:"univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-text-base univer-text-gray-700",children:c.jsx(de,{})}),c.jsx(S.Dropdown,{overlay:c.jsx("ul",{className:S.clsx("univer-my-0 univer-box-border univer-grid univer-max-h-[310px] univer-w-[var(--radix-popper-anchor-width)] univer-items-center univer-gap-1 univer-overflow-y-auto univer-overflow-x-hidden univer-rounded-lg univer-border univer-bg-white univer-p-1 univer-text-base univer-shadow-lg",S.scrollbarClassName),children:h.map(f=>c.jsxs("li",{onClick:()=>v(f),className:"univer-relative univer-box-border univer-flex univer-h-7 univer-cursor-pointer univer-list-none univer-items-center univer-justify-between univer-rounded univer-px-2 univer-text-sm univer-transition-all hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:[c.jsx("span",{className:"univer-max-w-[220px] univer-truncate",children:f.label}),c.jsx("span",{children:f.index===n.colIndex&&c.jsx(oe,{})})]},f.index))}),open:M,onOpenChange:b,children:c.jsxs("div",{className:S.clsx("univer-ml-2 univer-flex univer-w-full univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-md univer-py-1.5 univer-text-sm univer-text-gray-900 dark:!univer-text-white"),children:[c.jsx("span",{className:"univer-max-w-[220px] univer-truncate",children:P}),c.jsx(le,{})]})})]}),c.jsxs("div",{className:"univer-flex univer-items-center univer-justify-end univer-gap-2",children:[c.jsxs(S.RadioGroup,{value:n.type,onChange:f=>{o({...n,type:f},g)},children:[c.jsx(S.Radio,{value:w.SortType.ASC,children:a.t("sheets-sort.general.sort-asc")}),c.jsx(S.Radio,{value:w.SortType.DESC,children:a.t("sheets-sort.general.sort-desc")})]}),c.jsx("a",{className:"univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-transition-colors hover:univer-text-red-500",onClick:()=>o(null,g),children:!y&&c.jsx(ie,{})})]})]})}function Ae(t,e){const{startColumn:n,endColumn:r}=t,o=new Set(e.map(i=>i==null?void 0:i.colIndex));for(let i=n;i<=r;i++)if(!o.has(i))return i;return null}function Ze(t){const{range:e,colIndex:n,onClose:r}=t,o=C.useDependency(p),i=C.useDependency(s.IUniverInstanceService),a=C.useDependency(s.LocaleService),h=l.useCallback(g=>{const{unitId:v,subUnitId:M}=u.getSheetCommandTarget(i)||{};if(e&&v&&M){const I={...e,startRow:e.startRow+1};o.triggerSortDirectly(g,!1,{unitId:v,subUnitId:M,range:I,colIndex:n})}else throw new Error(`Cannot find the target to sort. unitId: ${v}, subUnitId: ${M}, range: ${e}, colIndex: ${n}`);r()},[e,n,o,i,r]);return c.jsxs(S.ButtonGroup,{className:"univer-mb-3 univer-w-full univer-grid-cols-2",children:[c.jsxs(S.Button,{onClick:()=>h(!0),children:[c.jsx(q,{}),a.t("sheets-sort.general.sort-asc")]}),c.jsxs(S.Button,{onClick:()=>h(!1),children:[c.jsx(G,{}),a.t("sheets-sort.general.sort-desc")]})]})}const ue="sheet.menu.sheets-sort",Ce="sheet.menu.sheets-sort-ctx",k="AscendingIcon",Y="ExpandAscendingIcon",X="DescendingIcon",K="ExpandDescendingIcon",J="CustomSortIcon";function Be(t){return{id:ue,type:C.MenuItemType.SUBITEMS,icon:k,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Fe(t){return{id:N.id,icon:k,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(t)}}function We(t){return{id:L.id,title:"sheets-sort.general.sort-asc-ext",icon:Y,type:C.MenuItemType.BUTTON}}function Ve(t){return{id:$.id,title:"sheets-sort.general.sort-desc-cur",icon:X,type:C.MenuItemType.BUTTON}}function qe(t){return{id:U.id,title:"sheets-sort.general.sort-desc-ext",icon:K,type:C.MenuItemType.BUTTON}}function Ge(t){return{id:H.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:J}}function ze(t){return{id:Ce,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:k,hidden$:C.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Ye(t){return{id:j.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:k,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Xe(t){return{id:A.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:Y,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Ke(t){return{id:Z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:X,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Je(t){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:K,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Qe(t){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:J,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}const et={[C.RibbonDataGroup.ORGANIZATION]:{[ue]:{order:3,menuItemFactory:Be,[N.id]:{order:0,menuItemFactory:Fe},[L.id]:{order:1,menuItemFactory:We},[$.id]:{order:2,menuItemFactory:Ve},[U.id]:{order:3,menuItemFactory:qe},[H.id]:{order:4,menuItemFactory:Ge}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[Ce]:{order:0,menuItemFactory:ze,[j.id]:{order:0,menuItemFactory:Ye},[A.id]:{order:1,menuItemFactory:Xe},[Z.id]:{order:2,menuItemFactory:Ke},[B.id]:{order:3,menuItemFactory:Je},[F.id]:{order:4,menuItemFactory:Qe}}}}};var tt=Object.getOwnPropertyDescriptor,nt=(t,e,n,r)=>{for(var o=r>1?void 0:r?tt(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=a(o)||o);return o},T=(t,e)=>(n,r)=>e(n,r,t);const he="custom-sort-dialog",ge=560,rt=128;let W=class extends s.RxDisposable{constructor(t,e,n,r,o,i,a,h,g,v){super(),this._commandService=t,this._menuManagerService=e,this._dialogService=n,this._layoutService=r,this._uiPartsService=o,this._sheetRenderService=i,this._localeService=a,this._sheetsSortUIService=h,this._injector=g,this._componentManager=v,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(et)}_initCommands(){[N,L,$,U,H,j,A,Z,B,F].forEach(t=>this.disposeWithMe(this._commandService.registerCommand(t))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(w.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>C.connectInjector(Ze,this._injector))),[["CustomSortPanel",Ue],[k,q],[Y,ce],[X,G],[K,ae],[J,se]].forEach(([t,e])=>{this.disposeWithMe(this._componentManager.register(t,e))}),this._sheetsSortUIService.customSortState$.pipe(te.takeUntil(this.dispose$)).subscribe(t=>{t&&t.show&&t.location?this._openCustomSortPanel(t.location):t&&!(t!=null&&t.show)&&this._closePanel()})}_openCustomSortPanel(t){this._dialogService.open({id:he,draggable:!0,width:ge,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${fe.serializeRange(t.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:ot(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(he),queueMicrotask(()=>this._layoutService.focus())}};W=nt([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],W);function ot(){return{x:(window.innerWidth-ge)/2,y:rt}}var st=Object.defineProperty,it=Object.getOwnPropertyDescriptor,ct=(t,e,n)=>e in t?st(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,at=(t,e,n,r)=>{for(var o=r>1?void 0:r?it(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=a(o)||o);return o},me=(t,e)=>(n,r)=>e(n,r,t),ve=(t,e,n)=>ct(t,typeof e!="symbol"?e+"":e,n);const lt="SHEET_SORT_UI_PLUGIN";d.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(e=ne,n,r){super(),this._config=e,this._injector=n,this._configService=r;const{...o}=s.merge({},ne,this._config);this._configService.setConfig(_e,o)}onStarting(){[[p],[W]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(W)}},ve(d.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ve(d.UniverSheetsSortUIPlugin,"pluginName",lt),d.UniverSheetsSortUIPlugin=at([s.DependentOn(w.UniverSheetsSortPlugin),me(1,s.Inject(s.Injector)),me(2,s.IConfigService)],d.UniverSheetsSortUIPlugin),d.SortRangeAscCommand=N,d.SortRangeAscExtCommand=L,d.SortRangeAscExtInCtxMenuCommand=A,d.SortRangeAscInCtxMenuCommand=j,d.SortRangeCustomCommand=H,d.SortRangeCustomInCtxMenuCommand=F,d.SortRangeDescCommand=$,d.SortRangeDescExtCommand=U,d.SortRangeDescExtInCtxMenuCommand=B,d.SortRangeDescInCtxMenuCommand=Z,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
|
10
|
+
(function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("react/jsx-runtime"),require("@univerjs/sheets"),require("@univerjs/sheets-sort"),require("rxjs"),require("@univerjs/design"),require("@univerjs/ui"),require("react"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","react/jsx-runtime","@univerjs/sheets","@univerjs/sheets-sort","rxjs","@univerjs/design","@univerjs/ui","react","@univerjs/engine-formula","@univerjs/sheets-ui"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.UniverSheetsSortUi={},d.UniverCore,d.React,d.UniverSheets,d.UniverSheetsSort,d.rxjs,d.UniverDesign,d.UniverUi,d.React,d.UniverEngineFormula,d.UniverSheetsUi))})(this,(function(d,s,c,u,w,te,S,C,l,fe,E){"use strict";var ht=Object.defineProperty;var gt=(d,s,c)=>s in d?ht(d,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):d[s]=c;var ee=(d,s,c)=>gt(d,typeof s!="symbol"?s+"":s,c);const pe=t=>{const[e,n]=l.useState("0"),r=C.useDependency(s.LocaleService);return c.jsxs("div",{className:"univer-text-sm",children:[c.jsx("div",{className:"extend-confirm-desc",children:r.t("sheets-sort.dialog.sort-reminder-desc")}),c.jsxs(S.RadioGroup,{className:"univer-mt-4",value:e,direction:"vertical",onChange:o=>{n(o),t.onChange(o)},children:[c.jsx(S.Radio,{value:"0",children:r.t("sheets-sort.dialog.sort-reminder-no")}),c.jsx(S.Radio,{value:"1",children:r.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var ye=Object.getOwnPropertyDescriptor,Ie=(t,e,n,r)=>{for(var o=r>1?void 0:r?ye(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=a(o)||o);return o},R=(t,e)=>(n,r)=>e(n,r,t);const O={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 p=class extends s.Disposable{constructor(e,n,r,o,i,a){super();ee(this,"_customSortState$",new te.BehaviorSubject(null));ee(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=e,this._confirmService=n,this._selectionManagerService=r,this._sheetsSortService=o,this._localeService=i,this._commandService=a}async triggerSortDirectly(e,n,r){const o=r||await this._detectSortLocation(n);if(!o||!this._check(o))return!1;const a={orderRules:[{type:e?w.SortType.ASC:w.SortType.DESC,colIndex:o.colIndex}],range:o.range};return this._sheetsSortService.applySort(a,o.unitId,o.subUnitId),!0}async triggerSortCustomize(){const e=await this._detectSortLocation();return!e||!this._check(e)?!1:(this.showCustomSortPanel(e),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(e){var g,v;const n=(g=this.customSortState())==null?void 0:g.location;if(!n)return[];const{unitId:r,subUnitId:o,range:i}=n,a=(v=this._univerInstanceService.getUnit(r))==null?void 0:v.getSheetBySheetId(o);if(!a)return[];const h=xe(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(M,I)=>{var y;const b=(y=a.getCell(i.startRow,I+i.startColumn))==null?void 0:y.v;return{index:I+i.startColumn,label:e?`${b!=null?b:h(I+i.startColumn)}`:h(I+i.startColumn)}})}setSelection(e,n,r){var a;const o=(a=this._univerInstanceService.getUnit(e))==null?void 0:a.getSheetBySheetId(n);if(!o)return;const i={unitId:e,subUnitId:n,selections:[{range:r,primary:u.getPrimaryForRange(r,o),style:null}]};this._commandService.executeCommand(u.SetSelectionsOperation.id,i)}async showCheckError(e){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:c.jsx("div",{children:this._localeService.t(e)})},cancelText:this._localeService.t("sheets-sort.dialog.cancel"),confirmText:this._localeService.t("sheets-sort.dialog.confirm")})}async showExtendConfirm(){let e=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:c.jsx(pe,{onChange:r=>{e=r==="1"}})},width:400,cancelText:this._localeService.t("sheets-sort.dialog.cancel"),confirmText:this._localeService.t("sheets-sort.dialog.confirm")})?e?"extend":"keep":"cancel"}showCustomSortPanel(e){this._customSortState$.next({location:e,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(e){return this._sheetsSortService.singleCheck(e)?this._sheetsSortService.mergeCheck(e)?this._sheetsSortService.formulaCheck(e)?this._sheetsSortService.emptyCheck(e)?!0:(this.showCheckError(O.EMPTY_ERROR),!1):(this.showCheckError(O.FORMULA_ARRAY),!1):(this.showCheckError(O.MERGE_ERROR),!1):(this.showCheckError(O.SINGLE_ERROR),!1)}async _detectSortLocation(e){const n=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=n.getActiveSheet(),o=n.getUnitId(),i=r.getSheetId(),a=this._selectionManagerService.getCurrentLastSelection();if(!a)return null;let h;if(e===!0)h=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,i,h);else if(e===!1)h=a.range;else{const g=await this.showExtendConfirm();if(g==="cancel")return null;g==="keep"?h=a.range:(h=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,i,h))}return{range:h,unitId:o,subUnitId:i,colIndex:a.primary.actualColumn}}};p=Ie([R(0,s.IUniverInstanceService),R(1,s.IConfirmService),R(2,s.Inject(u.SheetsSelectionsService)),R(3,s.Inject(w.SheetsSortService)),R(4,s.Inject(s.LocaleService)),R(5,s.ICommandService)],p);function xe(t){return e=>{const n=s.Tools.chatAtABC(e);switch(t.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${n}"列`;case s.LocaleType.EN_US:return`Column "${n}"`;default:return`Column "${n}"`}}}const N={id:"sheet.command.sort-range-asc",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!1)},L={id:"sheet.command.sort-range-asc-ext",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!0)},$={id:"sheet.command.sort-range-desc",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!1)},U={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!0)},H={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortCustomize()},j={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!1)},A={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!0,!0)},Z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!1)},B={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async t=>await t.get(p).triggerSortCustomize()},_e="sheets-sort-ui.config",ne={};function x({ref:t,...e}){const{icon:n,id:r,className:o,extend:i,...a}=e,h=`univerjs-icon univerjs-icon-${r} ${o||""}`.trim(),g=l.useRef(`_${Te()}`);return re(n,`${r}`,{defIds:n.defIds,idSuffix:g.current},{ref:t,className:h,...a},i)}function re(t,e,n,r,o){return l.createElement(t.tag,{key:e,...we(t,n,o),...r},(Ee(t,n).children||[]).map((i,a)=>re(i,`${e}-${t.tag}-${a}`,n,void 0,o)))}function we(t,e,n){const r={...t.attrs};n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1),t.tag==="mask"&&r.id&&(r.id=r.id+e.idSuffix),Object.entries(r).forEach(([i,a])=>{i==="mask"&&typeof a=="string"&&(r[i]=a.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))});const{defIds:o}=e;return!o||o.length===0||(t.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+e.idSuffix),Object.entries(r).forEach(([i,a])=>{typeof a=="string"&&(r[i]=a.replace(/url\(#(.*)\)/,`url(#$1${e.idSuffix})`))})),r}function Ee(t,e){var r;const{defIds:n}=e;return!n||n.length===0?t:t.tag==="defs"&&((r=t.children)!=null&&r.length)?{...t,children:t.children.map(o=>typeof o.attrs.id=="string"&&n&&n.includes(o.attrs.id)?{...o,attrs:{...o.attrs,id:o.attrs.id+e.idSuffix}}:o)}:t}function Te(){return Math.random().toString(36).substring(2,8)}x.displayName="UniverIcon";const Me={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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.67983C1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022C7.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.1916C7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212C1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.1846 1.86439C4.8641 0.989866 3.62725 0.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655C2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055L3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655C7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439ZM4.98996 4.82056L4.24567 2.78971L3.50138 4.82056H4.98996Z",fillRule:"evenodd",clipRule:"evenodd"}}]},q=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"ascending-icon",ref:n,icon:Me}))});q.displayName="AscendingIcon";const be={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},oe=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"check-mark-icon",ref:n,icon:be}))});oe.displayName="CheckMarkIcon";const Re={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574C8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507C9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661C11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512C7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574C6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588C4.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"}}]},se=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"custom-sort-icon",ref:n,icon:Re}))});se.displayName="CustomSortIcon";const ke={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M5.3313 1.4667C5.3313 1.13533 5.59993 0.866699 5.9313 0.866699H10.069C10.4004 0.866699 10.669 1.13533 10.669 1.4667C10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443C14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443Z"}},{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},ie=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"delete-empty-icon",ref:n,icon:ke}))});ie.displayName="DeleteEmptyIcon";const Pe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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.67983C1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022C7.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.1916C7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212C1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967Z",fillRule:"evenodd",clipRule:"evenodd"}},{tag:"path",attrs:{fill:"currentColor",d:"M5.1846 1.86439C4.8641 0.989866 3.62725 0.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655C2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055L3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655C7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439ZM4.98996 4.82056L4.24567 2.78971L3.50138 4.82056H4.98996Z",fillRule:"evenodd",clipRule:"evenodd"}}]},G=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"descending-icon",ref:n,icon:Pe}))});G.displayName="DescendingIcon";const De={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},ce=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"expand-ascending-icon",ref:n,icon:De}))});ce.displayName="ExpandAscendingIcon";const Oe={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"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"}}]},ae=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"expand-descending-icon",ref:n,icon:Oe}))});ae.displayName="ExpandDescendingIcon";const Ne={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z"}}]},z=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"increase-icon",ref:n,icon:Ne}))});z.displayName="IncreaseIcon";const Le={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z",fillRule:"evenodd",clipRule:"evenodd"}}]},le=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"more-down-icon",ref:n,icon:Le}))});le.displayName="MoreDownIcon";const $e={tag:"svg",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M6 5C6.55228 5 7 4.55228 7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4C5 4.55228 5.44772 5 6 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M6 9C6.55228 9 7 8.55229 7 8C7 7.44772 6.55228 7 6 7C5.44772 7 5 7.44772 5 8C5 8.55229 5.44772 9 6 9Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M7 12C7 12.5523 6.55228 13 6 13C5.44772 13 5 12.5523 5 12C5 11.4477 5.44772 11 6 11C6.55228 11 7 11.4477 7 12Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 5C10.5523 5 11 4.55228 11 4C11 3.44772 10.5523 3 10 3C9.44771 3 9 3.44772 9 4C9 4.55228 9.44771 5 10 5Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M11 8C11 8.55229 10.5523 9 10 9C9.44771 9 9 8.55229 9 8C9 7.44772 9.44771 7 10 7C10.5523 7 11 7.44772 11 8Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M10 13C10.5523 13 11 12.5523 11 12C11 11.4477 10.5523 11 10 11C9.44771 11 9 11.4477 9 12C9 12.5523 9.44771 13 10 13Z"}}]},de=l.forwardRef(function(e,n){return l.createElement(x,Object.assign({},e,{id:"sequence-icon",ref:n,icon:$e}))});de.displayName="SequenceIcon";function Ue(){const t=C.useDependency(p),e=C.useObservable(t.customSortState$);return!e||!e.location?null:c.jsx(He,{state:e})}function He({state:t}){const e=C.useDependency(w.SheetsSortService),n=C.useDependency(s.LocaleService),r=C.useDependency(p),[o,i]=l.useState(!1),[a,h]=l.useState(0),g=l.useRef(null),{range:v,unitId:M,subUnitId:I}=t.location,b=r.getTitles(o),[y,P]=l.useState([{type:w.SortType.ASC,colIndex:v.startColumn}]),V=l.useCallback((m,_)=>{const D=[...y];_===null?D.splice(m,1):D[m]=_,P(D)},[y]),f=l.useCallback(s.throttle(()=>{const m=[...y],_=Ae(v,y);_!==null&&(m.push({type:w.SortType.ASC,colIndex:_}),P(m))},200),[y,v]),Q=l.useCallback((m,_)=>{e.applySort({range:v,orderRules:m,hasTitle:_}),r.closeCustomSortPanel()},[e,r,v]),dt=l.useCallback(()=>{r.closeCustomSortPanel()},[r]),ut=l.useCallback(m=>{i(m),m?r.setSelection(M,I,{...v,startRow:v.startRow+1}):r.setSelection(M,I,v)},[r,v,I,M]);l.useEffect(()=>{g.current&&y.length>5&&(g.current.scrollTop=g.current.scrollHeight)},[y]);const Ct=y.length<b.length,Se=y.map(m=>({...m,id:`${m.colIndex}`}));return c.jsxs("div",{children:[c.jsxs("div",{onMouseDown:m=>{m.stopPropagation()},children:[c.jsxs("div",{className:"univer-flex univer-items-center univer-justify-between",children:[c.jsx(S.Checkbox,{checked:o,onChange:m=>ut(!!m),children:n.t("sheets-sort.dialog.first-row-check")}),Ct?c.jsxs("div",{className:"univer-flex univer-cursor-pointer univer-select-none univer-items-center univer-text-base",onClick:f,children:[c.jsx(z,{}),c.jsx("span",{className:"univer-ml-1.5",children:n.t("sheets-sort.dialog.add-condition")})]}):c.jsxs("div",{className:"univer-flex univer-cursor-pointer univer-select-none univer-items-center univer-text-base univer-text-primary-500 disabled:univer-cursor-not-allowed disabled:univer-divide-opacity-30 disabled:univer-text-gray-800",children:[c.jsx(z,{}),c.jsx("span",{className:"univer-ml-1.5 univer-text-xs",children:n.t("sheets-sort.dialog.add-condition")})]})]}),c.jsx("div",{ref:g,className:S.clsx("univer-max-h-[310px] univer-overflow-y-auto univer-overflow-x-hidden",S.scrollbarClassName),onScroll:m=>{const _=m.currentTarget.scrollTop;h(_)},children:c.jsx(S.DraggableList,{className:"[&_.react-grid-item]:univer-transition-none [&_.react-grid-placeholder]:univer-rounded [&_.react-grid-placeholder]:!univer-bg-gray-200",list:Se,onListChange:P,idKey:"id",draggableHandle:"[data-u-comp=sort-panel-item-handler]",itemRender:m=>c.jsx(je,{titles:b,list:Se,item:m,onChange:(_,D)=>V(D,_),scrollPosition:a}),rowHeight:32,margin:[0,12]})})]}),c.jsxs("div",{className:"univer-mt-5 univer-flex univer-justify-end",children:[c.jsx(S.Button,{className:"univer-ml-3",onClick:()=>dt(),children:n.t("sheets-sort.dialog.cancel")}),c.jsx(S.Button,{className:"univer-ml-3",variant:"primary",onClick:()=>Q(y,o),children:n.t("sheets-sort.dialog.confirm")})]})]})}function je(t){var V;const{list:e,item:n,titles:r,onChange:o,scrollPosition:i}=t,a=C.useDependency(s.LocaleService),h=r.filter(f=>!e.some(Q=>Q.colIndex===f.index)||f.index===n.colIndex),g=e.findIndex(f=>f.colIndex===n.colIndex),v=l.useCallback(f=>{o({...n,colIndex:f.index},g),I(!1)},[g,n,o]),[M,I]=l.useState(!1),b=f=>{I(f)};l.useEffect(()=>{I(!1)},[i]);const y=e.length>1,P=(V=r.find(f=>f.index===n.colIndex))==null?void 0:V.label;return c.jsxs("div",{className:"univer-grid univer-grid-flow-col univer-grid-cols-2 univer-items-center univer-gap-2",children:[c.jsxs("div",{className:"univer-flex univer-items-center",children:[c.jsx("div",{"data-u-comp":"sort-panel-item-handler",className:"univer-flex univer-cursor-pointer univer-items-center univer-justify-center univer-text-base univer-text-gray-700",children:c.jsx(de,{})}),c.jsx(S.Dropdown,{overlay:c.jsx("ul",{className:S.clsx("univer-my-0 univer-box-border univer-grid univer-max-h-[310px] univer-w-[var(--radix-popper-anchor-width)] univer-items-center univer-gap-1 univer-overflow-y-auto univer-overflow-x-hidden univer-rounded-lg univer-border univer-bg-white univer-p-1 univer-text-base univer-shadow-lg",S.scrollbarClassName),children:h.map(f=>c.jsxs("li",{onClick:()=>v(f),className:"univer-relative univer-box-border univer-flex univer-h-7 univer-cursor-pointer univer-list-none univer-items-center univer-justify-between univer-rounded univer-px-2 univer-text-sm univer-transition-all hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",children:[c.jsx("span",{className:"univer-max-w-[220px] univer-truncate",children:f.label}),c.jsx("span",{children:f.index===n.colIndex&&c.jsx(oe,{})})]},f.index))}),open:M,onOpenChange:b,children:c.jsxs("div",{className:S.clsx("univer-ml-2 univer-flex univer-w-full univer-items-center univer-justify-between univer-overflow-hidden univer-rounded-md univer-py-1.5 univer-text-sm univer-text-gray-900 dark:!univer-text-white"),children:[c.jsx("span",{className:"univer-max-w-[220px] univer-truncate",children:P}),c.jsx(le,{})]})})]}),c.jsxs("div",{className:"univer-flex univer-items-center univer-justify-end univer-gap-2",children:[c.jsxs(S.RadioGroup,{value:n.type,onChange:f=>{o({...n,type:f},g)},children:[c.jsx(S.Radio,{value:w.SortType.ASC,children:a.t("sheets-sort.general.sort-asc")}),c.jsx(S.Radio,{value:w.SortType.DESC,children:a.t("sheets-sort.general.sort-desc")})]}),c.jsx("a",{className:"univer-flex univer-cursor-pointer univer-items-center univer-text-sm univer-transition-colors hover:univer-text-red-500",onClick:()=>o(null,g),children:!y&&c.jsx(ie,{})})]})]})}function Ae(t,e){const{startColumn:n,endColumn:r}=t,o=new Set(e.map(i=>i==null?void 0:i.colIndex));for(let i=n;i<=r;i++)if(!o.has(i))return i;return null}function Ze(t){const{range:e,colIndex:n,onClose:r}=t,o=C.useDependency(p),i=C.useDependency(s.IUniverInstanceService),a=C.useDependency(s.LocaleService),h=l.useCallback(g=>{const{unitId:v,subUnitId:M}=u.getSheetCommandTarget(i)||{};if(e&&v&&M){const I={...e,startRow:e.startRow+1};o.triggerSortDirectly(g,!1,{unitId:v,subUnitId:M,range:I,colIndex:n})}else throw new Error(`Cannot find the target to sort. unitId: ${v}, subUnitId: ${M}, range: ${e}, colIndex: ${n}`);r()},[e,n,o,i,r]);return c.jsxs(S.ButtonGroup,{className:"univer-mb-3 univer-w-full univer-grid-cols-2",children:[c.jsxs(S.Button,{onClick:()=>h(!0),children:[c.jsx(q,{}),a.t("sheets-sort.general.sort-asc")]}),c.jsxs(S.Button,{onClick:()=>h(!1),children:[c.jsx(G,{}),a.t("sheets-sort.general.sort-desc")]})]})}const ue="sheet.menu.sheets-sort",Ce="sheet.menu.sheets-sort-ctx",k="AscendingIcon",Y="ExpandAscendingIcon",X="DescendingIcon",K="ExpandDescendingIcon",J="CustomSortIcon";function Be(t){return{id:ue,type:C.MenuItemType.SUBITEMS,icon:k,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Fe(t){return{id:N.id,icon:k,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(t)}}function We(t){return{id:L.id,title:"sheets-sort.general.sort-asc-ext",icon:Y,type:C.MenuItemType.BUTTON}}function Ve(t){return{id:$.id,title:"sheets-sort.general.sort-desc-cur",icon:X,type:C.MenuItemType.BUTTON}}function qe(t){return{id:U.id,title:"sheets-sort.general.sort-desc-ext",icon:K,type:C.MenuItemType.BUTTON}}function Ge(t){return{id:H.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:J}}function ze(t){return{id:Ce,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:k,hidden$:C.getMenuHiddenObservable(t,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Ye(t){return{id:j.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:k,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Xe(t){return{id:A.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:Y,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Ke(t){return{id:Z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:X,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Je(t){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:K,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Qe(t){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:J,disabled$:E.getCurrentRangeDisable$(t,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}const et={[C.RibbonDataGroup.ORGANIZATION]:{[ue]:{order:3,menuItemFactory:Be,[N.id]:{order:0,menuItemFactory:Fe},[L.id]:{order:1,menuItemFactory:We},[$.id]:{order:2,menuItemFactory:Ve},[U.id]:{order:3,menuItemFactory:qe},[H.id]:{order:4,menuItemFactory:Ge}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[Ce]:{order:0,menuItemFactory:ze,[j.id]:{order:0,menuItemFactory:Ye},[A.id]:{order:1,menuItemFactory:Xe},[Z.id]:{order:2,menuItemFactory:Ke},[B.id]:{order:3,menuItemFactory:Je},[F.id]:{order:4,menuItemFactory:Qe}}}}};var tt=Object.getOwnPropertyDescriptor,nt=(t,e,n,r)=>{for(var o=r>1?void 0:r?tt(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=a(o)||o);return o},T=(t,e)=>(n,r)=>e(n,r,t);const he="custom-sort-dialog",ge=560,rt=128;let W=class extends s.RxDisposable{constructor(t,e,n,r,o,i,a,h,g,v){super(),this._commandService=t,this._menuManagerService=e,this._dialogService=n,this._layoutService=r,this._uiPartsService=o,this._sheetRenderService=i,this._localeService=a,this._sheetsSortUIService=h,this._injector=g,this._componentManager=v,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(et)}_initCommands(){[N,L,$,U,H,j,A,Z,B,F].forEach(t=>this.disposeWithMe(this._commandService.registerCommand(t))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(w.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>C.connectInjector(Ze,this._injector))),[["CustomSortPanel",Ue],[k,q],[Y,ce],[X,G],[K,ae],[J,se]].forEach(([t,e])=>{this.disposeWithMe(this._componentManager.register(t,e))}),this._sheetsSortUIService.customSortState$.pipe(te.takeUntil(this.dispose$)).subscribe(t=>{t&&t.show&&t.location?this._openCustomSortPanel(t.location):t&&!(t!=null&&t.show)&&this._closePanel()})}_openCustomSortPanel(t){this._dialogService.open({id:he,draggable:!0,width:ge,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${fe.serializeRange(t.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:ot(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(he),queueMicrotask(()=>this._layoutService.focus())}};W=nt([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],W);function ot(){return{x:(window.innerWidth-ge)/2,y:rt}}var st=Object.defineProperty,it=Object.getOwnPropertyDescriptor,ct=(t,e,n)=>e in t?st(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,at=(t,e,n,r)=>{for(var o=r>1?void 0:r?it(e,n):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(o=a(o)||o);return o},me=(t,e)=>(n,r)=>e(n,r,t),ve=(t,e,n)=>ct(t,typeof e!="symbol"?e+"":e,n);const lt="SHEET_SORT_UI_PLUGIN";d.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(e=ne,n,r){super(),this._config=e,this._injector=n,this._configService=r;const{...o}=s.merge({},ne,this._config);this._configService.setConfig(_e,o)}onStarting(){[[p],[W]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(W)}},ve(d.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ve(d.UniverSheetsSortUIPlugin,"pluginName",lt),d.UniverSheetsSortUIPlugin=at([s.DependentOn(w.UniverSheetsSortPlugin),me(1,s.Inject(s.Injector)),me(2,s.IConfigService)],d.UniverSheetsSortUIPlugin),d.SortRangeAscCommand=N,d.SortRangeAscExtCommand=L,d.SortRangeAscExtInCtxMenuCommand=A,d.SortRangeAscInCtxMenuCommand=j,d.SortRangeCustomCommand=H,d.SortRangeCustomInCtxMenuCommand=F,d.SortRangeDescCommand=$,d.SortRangeDescExtCommand=U,d.SortRangeDescExtInCtxMenuCommand=B,d.SortRangeDescInCtxMenuCommand=Z,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
// index
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-sheets-sort",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum Co., Ltd. <developer@univer.ai>",
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"rxjs": ">=7.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@univerjs/sheets-sort": "0.
|
|
62
|
-
"@univerjs/sheets-sort-ui": "0.
|
|
61
|
+
"@univerjs/sheets-sort": "0.14.0",
|
|
62
|
+
"@univerjs/sheets-sort-ui": "0.14.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@univerjs/core": "0.
|
|
65
|
+
"@univerjs/core": "0.14.0",
|
|
66
66
|
"react": "18.3.1",
|
|
67
67
|
"react-dom": "18.3.1",
|
|
68
68
|
"rxjs": "7.8.2",
|
|
69
69
|
"typescript": "^5.9.3",
|
|
70
|
-
"@univerjs-infra/shared": "0.
|
|
70
|
+
"@univerjs-infra/shared": "0.14.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"prebuild:preset": "tsx prepare.ts",
|