@univerjs/sheets-sort-ui 0.6.10-experimental.20250421-e4eb9bc → 0.6.10-experimental.20250424-9e348ed

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,10 +1,13 @@
1
- "use strict";var ye=Object.defineProperty;var xe=(e,t,n)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Y=(e,t,n)=>xe(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@univerjs/core"),T=require("@univerjs/sheets-sort"),_e=require("@univerjs/engine-formula"),P=require("@univerjs/sheets-ui"),h=require("@univerjs/ui"),ae=require("rxjs"),i=require("react/jsx-runtime"),u=require("@univerjs/sheets"),x=require("@univerjs/design"),l=require("react"),Re="sheets-sort-ui.config",oe={};var y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},y.apply(this,arguments)},Me=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},R=l.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,s=e.extend,c=Me(e,["icon","id","className","extend"]),m="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),S=l.useRef("_".concat(Pe()));return ce(n,"".concat(r),{defIds:n.defIds,idSuffix:S.current},y({ref:t,className:m},c),s)});function ce(e,t,n,r,o){return l.createElement(e.tag,y(y({key:t},Ee(e,n,o)),r),(Te(e,n).children||[]).map(function(s,c){return ce(s,"".concat(t,"-").concat(e.tag,"-").concat(c),n,void 0,o)}))}function Ee(e,t,n){var r=y({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1),e.tag==="mask"&&r.id&&(r.id=r.id+t.idSuffix),Object.entries(r).forEach(function(s){var c=s[0],m=s[1];c==="mask"&&typeof m=="string"&&(r[c]=m.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(s){var c=s[0],m=s[1];typeof m=="string"&&(r[c]=m.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Te(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?y(y({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?y(y({},o),{attrs:y(y({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function Pe(){return Math.random().toString(36).substring(2,8)}R.displayName="UniverIcon";var be={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"}}]},K=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"ascending- single",ref:t,icon:be}))});K.displayName="AscendingSingle";var ke={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"}}]},le=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ke}))});le.displayName="CheckMarkSingle";var we={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"}}]},de=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:we}))});de.displayName="CustomSortSingle";var Oe={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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:Oe}))});ue.displayName="DeleteEmptySingle";var De={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"}}]},J=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"descending-single",ref:t,icon:De}))});J.displayName="DescendingSingle";var Ne={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"}}]},me=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});me.displayName="ExpandAscendingSingle";var je={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"}}]},he=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:je}))});he.displayName="ExpandDescendingSingle";var Le={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"}}]},X=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"increase-single",ref:t,icon:Le}))});X.displayName="IncreaseSingle";var He={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"}}]},ge=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"more-down-single",ref:t,icon:He}))});ge.displayName="MoreDownSingle";var Ue={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"}}]}]},Se=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ue}))});Se.displayName="SequenceSingle";const $e="univer-extend-confirm-radio-group",Ae="univer-custom-sort-panel-container",Be="univer-custom-sort-panel-ext",Fe="univer-add-condition",We="univer-add-condition-text",Ve="univer-add-condition-disable",ze="univer-custom-sort-panel-footer",Ze="univer-custom-sort-panel-footer-btn",Ge="univer-custom-sort-panel-item",qe="univer-custom-sort-panel-item-head",Ye="univer-custom-sort-panel-item-handler",Xe="univer-custom-sort-panel-item-remove",Ke="univer-custom-sort-panel-item-column-input",Je="univer-custom-sort-panel-item-column-input-dropdown",Qe="univer-custom-sort-panel-item-column-input-text",et="univer-custom-sort-panel-item-order-radio",tt="univer-custom-sort-panel-item-order-radio-cn",nt="univer-condition-list",rt="univer-embed-sort-btn-container",ot="univer-embed-sort-btn",st="univer-embed-sort-btn-asc",it="univer-embed-sort-btn-desc",at="univer-embed-sort-btn-icon",ct="univer-custom-sort-col-menu",lt="univer-custom-sort-col-menu-item",dt="univer-custom-sort-col-menu-item-desc",d={extendConfirmRadioGroup:$e,customSortPanelContainer:Ae,customSortPanelExt:Be,addCondition:Fe,addConditionText:We,addConditionDisable:Ve,customSortPanelFooter:ze,customSortPanelFooterBtn:Ze,customSortPanelItem:Ge,customSortPanelItemHead:qe,customSortPanelItemHandler:Ye,customSortPanelItemRemove:Xe,customSortPanelItemColumnInput:Ke,customSortPanelItemColumnInputDropdown:Je,customSortPanelItemColumnInputText:Qe,customSortPanelItemOrderRadio:et,customSortPanelItemOrderRadioCn:tt,conditionList:nt,embedSortBtnContainer:rt,embedSortBtn:ot,embedSortBtnAsc:st,embedSortBtnDesc:it,embedSortBtnIcon:at,customSortColMenu:ct,customSortColMenuItem:lt,customSortColMenuItemDesc:dt},ut=e=>{const[t,n]=l.useState("0"),r=h.useDependency(a.LocaleService);return i.jsxs("div",{className:"univer-text-sm univer-theme",children:[i.jsx("div",{className:"extend-confirm-desc",children:r.t("sheets-sort.dialog.sort-reminder-desc")}),i.jsxs(x.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:o=>{n(o),e.onChange(o)},children:[i.jsx(x.Radio,{value:"0",children:r.t("sheets-sort.dialog.sort-reminder-no")}),i.jsx(x.Radio,{value:"1",children:r.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var mt=Object.getOwnPropertyDescriptor,ht=(e,t,n,r)=>{for(var o=r>1?void 0:r?mt(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(o=c(o)||o);return o},k=(e,t)=>(n,r)=>t(n,r,e);const j={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 v=class extends a.Disposable{constructor(t,n,r,o,s,c,m){super();Y(this,"_customSortState$",new ae.BehaviorSubject(null));Y(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=n,this._logService=r,this._selectionManagerService=o,this._sheetsSortService=s,this._localeService=c,this._commandService=m}async triggerSortDirectly(t,n,r){const o=r||await this._detectSortLocation(n);if(!o||!this._check(o))return!1;const c={orderRules:[{type:t?T.SortType.ASC:T.SortType.DESC,colIndex:o.colIndex}],range:o.range};return this._sheetsSortService.applySort(c,o.unitId,o.subUnitId),!0}async triggerSortCustomize(){const t=await this._detectSortLocation();return!t||!this._check(t)?!1:(this.showCustomSortPanel(t),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(t){var S,C;const n=(S=this.customSortState())==null?void 0:S.location;if(!n)return[];const{unitId:r,subUnitId:o,range:s}=n,c=(C=this._univerInstanceService.getUnit(r))==null?void 0:C.getSheetBySheetId(o);if(!c)return[];const m=gt(this._localeService);return Array.from({length:s.endColumn-s.startColumn+1},(M,I)=>{var p;const b=(p=c.getCell(s.startRow,I+s.startColumn))==null?void 0:p.v;return{index:I+s.startColumn,label:t?`${b!=null?b:m(I+s.startColumn)}`:m(I+s.startColumn)}})}setSelection(t,n,r){var c;const o=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(n);if(!o)return;const s={unitId:t,subUnitId:n,selections:[{range:r,primary:u.getPrimaryForRange(r,o),style:null}]};this._commandService.executeCommand(u.SetSelectionsOperation.id,s)}async showCheckError(t){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:i.jsx("div",{children:this._localeService.t(t)})}})}async showExtendConfirm(){let t=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:i.jsx(ut,{onChange:r=>{t=r==="1"}})},width:400})?t?"extend":"keep":"cancel"}showCustomSortPanel(t){this._customSortState$.next({location:t,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(t){return this._sheetsSortService.singleCheck(t)?this._sheetsSortService.mergeCheck(t)?this._sheetsSortService.formulaCheck(t)?this._sheetsSortService.emptyCheck(t)?!0:(this.showCheckError(j.EMPTY_ERROR),!1):(this.showCheckError(j.FORMULA_ARRAY),!1):(this.showCheckError(j.MERGE_ERROR),!1):(this.showCheckError(j.SINGLE_ERROR),!1)}async _detectSortLocation(t){const n=this._univerInstanceService.getCurrentUnitForType(a.UniverInstanceType.UNIVER_SHEET),r=n.getActiveSheet(),o=n.getUnitId(),s=r.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let m;if(t===!0)m=u.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,s,m);else if(t===!1)m=c.range;else{const S=await this.showExtendConfirm();if(S==="cancel")return null;S==="keep"?m=c.range:(m=u.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,s,m))}return{range:m,unitId:o,subUnitId:s,colIndex:c.primary.actualColumn}}};v=ht([k(0,a.IUniverInstanceService),k(1,h.IConfirmService),k(2,a.ILogService),k(3,a.Inject(u.SheetsSelectionsService)),k(4,a.Inject(T.SheetsSortService)),k(5,a.Inject(a.LocaleService)),k(6,a.ICommandService)],v);function gt(e){return t=>{const n=a.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case a.LocaleType.ZH_CN:return`"${n}"列`;case a.LocaleType.EN_US:return`Column "${n}"`;default:return`Column "${n}"`}}}const H={id:"sheet.command.sort-range-asc",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!1)},U={id:"sheet.command.sort-range-asc-ext",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!0)},$={id:"sheet.command.sort-range-desc",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!1)},A={id:"sheet.command.sort-range-desc-ext",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!0)},B={id:"sheet.command.sort-range-custom",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortCustomize()},F={id:"sheet.command.sort-range-asc-ctx",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!1)},W={id:"sheet.command.sort-range-asc-ext-ctx",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!0)},V={id:"sheet.command.sort-range-desc-ctx",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!1)},z={id:"sheet.command.sort-range-desc-ext-ctx",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!0)},Z={id:"sheet.command.sort-range-custom-ctx",type:a.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortCustomize()};function St(){const e=h.useDependency(v),t=h.useDependency(T.SheetsSortService),n=h.useDependency(a.LocaleService),[r,o]=l.useState(!1),[s,c]=l.useState(0),m=l.useRef(null),S=e.customSortState();if(!S||!S.location)return null;const{range:C,unitId:M,subUnitId:I}=S.location,b=e.getTitles(r),[p,w]=l.useState([{type:T.SortType.ASC,colIndex:C.startColumn}]),G=l.useCallback((g,_)=>{const O=[...p];_===null?O.splice(g,1):O[g]=_,w(O)},[p]),N=l.useCallback(a.throttle(()=>{const g=[...p],_=ft(C,p);_!==null&&(g.push({type:T.SortType.ASC,colIndex:_}),w(g))},200),[p,C]),f=l.useCallback((g,_)=>{t.applySort({range:C,orderRules:g,hasTitle:_}),e.closeCustomSortPanel()},[t,e,C]),q=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),pe=l.useCallback(g=>{o(g),g?e.setSelection(M,I,{...C,startRow:C.startRow+1}):e.setSelection(M,I,C)},[e,C,I,M]);l.useEffect(()=>{m.current&&p.length>5&&(m.current.scrollTop=m.current.scrollHeight)},[p]);const Ie=p.length<b.length,re=p.map(g=>({...g,id:`${g.colIndex}`}));return i.jsxs("div",{className:d.customSortPanelContainer,children:[i.jsxs("div",{className:d.customSortPanelContent,onMouseDown:g=>{g.stopPropagation()},children:[i.jsxs("div",{className:d.customSortPanelExt,children:[i.jsx("div",{className:d.firstRowCheck,children:i.jsx(x.Checkbox,{checked:r,onChange:g=>pe(!!g),children:n.t("sheets-sort.dialog.first-row-check")})}),Ie?i.jsxs("div",{className:d.addCondition,onClick:N,children:[i.jsx(X,{}),i.jsx("span",{className:d.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]}):i.jsxs("div",{className:`
1
+ "use strict";var ye=Object.defineProperty;var xe=(e,t,n)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Y=(e,t,n)=>xe(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@univerjs/core"),T=require("@univerjs/sheets-sort"),_e=require("@univerjs/engine-formula"),P=require("@univerjs/sheets-ui"),h=require("@univerjs/ui"),ce=require("rxjs"),i=require("react/jsx-runtime"),u=require("@univerjs/sheets"),x=require("@univerjs/design"),l=require("react"),Re="sheets-sort-ui.config",oe={};var y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},y.apply(this,arguments)},Me=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},R=l.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,s=e.extend,a=Me(e,["icon","id","className","extend"]),m="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),S=l.useRef("_".concat(Pe()));return ae(n,"".concat(r),{defIds:n.defIds,idSuffix:S.current},y({ref:t,className:m},a),s)});function ae(e,t,n,r,o){return l.createElement(e.tag,y(y({key:t},Ee(e,n,o)),r),(Te(e,n).children||[]).map(function(s,a){return ae(s,"".concat(t,"-").concat(e.tag,"-").concat(a),n,void 0,o)}))}function Ee(e,t,n){var r=y({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1),e.tag==="mask"&&r.id&&(r.id=r.id+t.idSuffix),Object.entries(r).forEach(function(s){var a=s[0],m=s[1];a==="mask"&&typeof m=="string"&&(r[a]=m.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&r["xlink:href"]&&(r["xlink:href"]=r["xlink:href"]+t.idSuffix),Object.entries(r).forEach(function(s){var a=s[0],m=s[1];typeof m=="string"&&(r[a]=m.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Te(e,t){var n,r=t.defIds;return!r||r.length===0?e:e.tag==="defs"&&(!((n=e.children)===null||n===void 0)&&n.length)?y(y({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?y(y({},o),{attrs:y(y({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function Pe(){return Math.random().toString(36).substring(2,8)}R.displayName="UniverIcon";var be={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"}}]},K=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"ascending- single",ref:t,icon:be}))});K.displayName="AscendingSingle";var ke={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"}}]},le=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"check-mark-single",ref:t,icon:ke}))});le.displayName="CheckMarkSingle";var we={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"}}]},de=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:we}))});de.displayName="CustomSortSingle";var Oe={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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:Oe}))});ue.displayName="DeleteEmptySingle";var De={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"}}]},J=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"descending-single",ref:t,icon:De}))});J.displayName="DescendingSingle";var Ne={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"}}]},me=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});me.displayName="ExpandAscendingSingle";var je={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"}}]},he=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:je}))});he.displayName="ExpandDescendingSingle";var Le={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"}}]},X=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"increase-single",ref:t,icon:Le}))});X.displayName="IncreaseSingle";var He={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"}}]},ge=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"more-down-single",ref:t,icon:He}))});ge.displayName="MoreDownSingle";var Ue={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"}}]}]},Se=l.forwardRef(function(e,t){return l.createElement(R,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ue}))});Se.displayName="SequenceSingle";const $e="univer-extend-confirm-radio-group",Ae="univer-custom-sort-panel-container",Be="univer-custom-sort-panel-ext",Fe="univer-add-condition",We="univer-add-condition-text",Ve="univer-add-condition-disable",ze="univer-custom-sort-panel-footer",Ze="univer-custom-sort-panel-footer-btn",Ge="univer-custom-sort-panel-item",qe="univer-custom-sort-panel-item-head",Ye="univer-custom-sort-panel-item-handler",Xe="univer-custom-sort-panel-item-remove",Ke="univer-custom-sort-panel-item-column-input",Je="univer-custom-sort-panel-item-column-input-dropdown",Qe="univer-custom-sort-panel-item-column-input-text",et="univer-custom-sort-panel-item-order-radio",tt="univer-custom-sort-panel-item-order-radio-cn",nt="univer-condition-list",rt="univer-embed-sort-btn",ot="univer-embed-sort-btn-asc",st="univer-embed-sort-btn-desc",it="univer-embed-sort-btn-icon",ct="univer-custom-sort-col-menu",at="univer-custom-sort-col-menu-item",lt="univer-custom-sort-col-menu-item-desc",d={extendConfirmRadioGroup:$e,customSortPanelContainer:Ae,customSortPanelExt:Be,addCondition:Fe,addConditionText:We,addConditionDisable:Ve,customSortPanelFooter:ze,customSortPanelFooterBtn:Ze,customSortPanelItem:Ge,customSortPanelItemHead:qe,customSortPanelItemHandler:Ye,customSortPanelItemRemove:Xe,customSortPanelItemColumnInput:Ke,customSortPanelItemColumnInputDropdown:Je,customSortPanelItemColumnInputText:Qe,customSortPanelItemOrderRadio:et,customSortPanelItemOrderRadioCn:tt,conditionList:nt,embedSortBtn:rt,embedSortBtnAsc:ot,embedSortBtnDesc:st,embedSortBtnIcon:it,customSortColMenu:ct,customSortColMenuItem:at,customSortColMenuItemDesc:lt},dt=e=>{const[t,n]=l.useState("0"),r=h.useDependency(c.LocaleService);return i.jsxs("div",{className:"univer-text-sm univer-theme",children:[i.jsx("div",{className:"extend-confirm-desc",children:r.t("sheets-sort.dialog.sort-reminder-desc")}),i.jsxs(x.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:o=>{n(o),e.onChange(o)},children:[i.jsx(x.Radio,{value:"0",children:r.t("sheets-sort.dialog.sort-reminder-no")}),i.jsx(x.Radio,{value:"1",children:r.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var ut=Object.getOwnPropertyDescriptor,mt=(e,t,n,r)=>{for(var o=r>1?void 0:r?ut(t,n):t,s=e.length-1,a;s>=0;s--)(a=e[s])&&(o=a(o)||o);return o},k=(e,t)=>(n,r)=>t(n,r,e);const j={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 v=class extends c.Disposable{constructor(t,n,r,o,s,a,m){super();Y(this,"_customSortState$",new ce.BehaviorSubject(null));Y(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=n,this._logService=r,this._selectionManagerService=o,this._sheetsSortService=s,this._localeService=a,this._commandService=m}async triggerSortDirectly(t,n,r){const o=r||await this._detectSortLocation(n);if(!o||!this._check(o))return!1;const a={orderRules:[{type:t?T.SortType.ASC:T.SortType.DESC,colIndex:o.colIndex}],range:o.range};return this._sheetsSortService.applySort(a,o.unitId,o.subUnitId),!0}async triggerSortCustomize(){const t=await this._detectSortLocation();return!t||!this._check(t)?!1:(this.showCustomSortPanel(t),!0)}customSortState(){return this._customSortState$.getValue()}getTitles(t){var S,C;const n=(S=this.customSortState())==null?void 0:S.location;if(!n)return[];const{unitId:r,subUnitId:o,range:s}=n,a=(C=this._univerInstanceService.getUnit(r))==null?void 0:C.getSheetBySheetId(o);if(!a)return[];const m=ht(this._localeService);return Array.from({length:s.endColumn-s.startColumn+1},(M,I)=>{var p;const b=(p=a.getCell(s.startRow,I+s.startColumn))==null?void 0:p.v;return{index:I+s.startColumn,label:t?`${b!=null?b:m(I+s.startColumn)}`:m(I+s.startColumn)}})}setSelection(t,n,r){var a;const o=(a=this._univerInstanceService.getUnit(t))==null?void 0:a.getSheetBySheetId(n);if(!o)return;const s={unitId:t,subUnitId:n,selections:[{range:r,primary:u.getPrimaryForRange(r,o),style:null}]};this._commandService.executeCommand(u.SetSelectionsOperation.id,s)}async showCheckError(t){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:i.jsx("div",{children:this._localeService.t(t)})}})}async showExtendConfirm(){let t=!1;return await this._confirmService.confirm({id:"extend-sort-range-dialog",title:{title:this._localeService.t("sheets-sort.dialog.sort-reminder")},children:{title:i.jsx(dt,{onChange:r=>{t=r==="1"}})},width:400})?t?"extend":"keep":"cancel"}showCustomSortPanel(t){this._customSortState$.next({location:t,show:!0})}closeCustomSortPanel(){this._customSortState$.next({show:!1})}_check(t){return this._sheetsSortService.singleCheck(t)?this._sheetsSortService.mergeCheck(t)?this._sheetsSortService.formulaCheck(t)?this._sheetsSortService.emptyCheck(t)?!0:(this.showCheckError(j.EMPTY_ERROR),!1):(this.showCheckError(j.FORMULA_ARRAY),!1):(this.showCheckError(j.MERGE_ERROR),!1):(this.showCheckError(j.SINGLE_ERROR),!1)}async _detectSortLocation(t){const n=this._univerInstanceService.getCurrentUnitForType(c.UniverInstanceType.UNIVER_SHEET),r=n.getActiveSheet(),o=n.getUnitId(),s=r.getSheetId(),a=this._selectionManagerService.getCurrentLastSelection();if(!a)return null;let m;if(t===!0)m=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,s,m);else if(t===!1)m=a.range;else{const S=await this.showExtendConfirm();if(S==="cancel")return null;S==="keep"?m=a.range:(m=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,s,m))}return{range:m,unitId:o,subUnitId:s,colIndex:a.primary.actualColumn}}};v=mt([k(0,c.IUniverInstanceService),k(1,h.IConfirmService),k(2,c.ILogService),k(3,c.Inject(u.SheetsSelectionsService)),k(4,c.Inject(T.SheetsSortService)),k(5,c.Inject(c.LocaleService)),k(6,c.ICommandService)],v);function ht(e){return t=>{const n=c.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case c.LocaleType.ZH_CN:return`"${n}"列`;case c.LocaleType.EN_US:return`Column "${n}"`;default:return`Column "${n}"`}}}const H={id:"sheet.command.sort-range-asc",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!1)},U={id:"sheet.command.sort-range-asc-ext",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!0)},$={id:"sheet.command.sort-range-desc",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!1)},A={id:"sheet.command.sort-range-desc-ext",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!0)},B={id:"sheet.command.sort-range-custom",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortCustomize()},F={id:"sheet.command.sort-range-asc-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!1)},W={id:"sheet.command.sort-range-asc-ext-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!0,!0)},V={id:"sheet.command.sort-range-desc-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!1)},z={id:"sheet.command.sort-range-desc-ext-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortDirectly(!1,!0)},Z={id:"sheet.command.sort-range-custom-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(v).triggerSortCustomize()};function gt(){const e=h.useDependency(v),t=h.useDependency(T.SheetsSortService),n=h.useDependency(c.LocaleService),[r,o]=l.useState(!1),[s,a]=l.useState(0),m=l.useRef(null),S=e.customSortState();if(!S||!S.location)return null;const{range:C,unitId:M,subUnitId:I}=S.location,b=e.getTitles(r),[p,w]=l.useState([{type:T.SortType.ASC,colIndex:C.startColumn}]),G=l.useCallback((g,_)=>{const O=[...p];_===null?O.splice(g,1):O[g]=_,w(O)},[p]),N=l.useCallback(c.throttle(()=>{const g=[...p],_=Ct(C,p);_!==null&&(g.push({type:T.SortType.ASC,colIndex:_}),w(g))},200),[p,C]),f=l.useCallback((g,_)=>{t.applySort({range:C,orderRules:g,hasTitle:_}),e.closeCustomSortPanel()},[t,e,C]),q=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),pe=l.useCallback(g=>{o(g),g?e.setSelection(M,I,{...C,startRow:C.startRow+1}):e.setSelection(M,I,C)},[e,C,I,M]);l.useEffect(()=>{m.current&&p.length>5&&(m.current.scrollTop=m.current.scrollHeight)},[p]);const Ie=p.length<b.length,re=p.map(g=>({...g,id:`${g.colIndex}`}));return i.jsxs("div",{className:d.customSortPanelContainer,children:[i.jsxs("div",{className:d.customSortPanelContent,onMouseDown:g=>{g.stopPropagation()},children:[i.jsxs("div",{className:d.customSortPanelExt,children:[i.jsx("div",{className:d.firstRowCheck,children:i.jsx(x.Checkbox,{checked:r,onChange:g=>pe(!!g),children:n.t("sheets-sort.dialog.first-row-check")})}),Ie?i.jsxs("div",{className:d.addCondition,onClick:N,children:[i.jsx(X,{}),i.jsx("span",{className:d.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]}):i.jsxs("div",{className:`
2
2
  ${d.addCondition}
3
3
  ${d.addConditionDisable}
4
- `,children:[i.jsx(X,{}),i.jsx("span",{className:d.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]})]}),i.jsx("div",{className:d.conditionList,onScroll:g=>{const _=g.currentTarget.scrollTop;c(_)},ref:m,children:i.jsx(x.DraggableList,{list:re,onListChange:w,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>i.jsx(Ct,{titles:b,list:re,item:g,onChange:(_,O)=>G(O,_),scrollPosition:s}),rowHeight:32,margin:[0,12]})})]}),i.jsxs("div",{className:d.customSortPanelFooter,children:[i.jsx(x.Button,{className:d.customSortPanelFooterBtn,onClick:()=>q(),children:n.t("sheets-sort.dialog.cancel")}),i.jsx(x.Button,{className:d.customSortPanelFooterBtn,variant:"primary",onClick:()=>f(p,r),children:n.t("sheets-sort.dialog.confirm")})]})]})}function Ct(e){var N;const{list:t,item:n,titles:r,onChange:o,scrollPosition:s}=e,c=h.useDependency(a.LocaleService),m=r.filter(f=>!t.some(q=>q.colIndex===f.index)||f.index===n.colIndex),S=t.findIndex(f=>f.colIndex===n.colIndex),C=l.useCallback(f=>{o({...n,colIndex:f.index},S),I(!1)},[S,n,o]),[M,I]=l.useState(!1),b=f=>{I(f)};l.useEffect(()=>{I(!1)},[s]);const p=t.length>1,w=(N=r.find(f=>f.index===n.colIndex))==null?void 0:N.label,G=c.getCurrentLocale()===a.LocaleType.ZH_CN?d.customSortPanelItemOrderRadioCn:d.customSortPanelItemOrderRadio;return i.jsxs("div",{className:d.customSortPanelItem,children:[i.jsxs("div",{className:d.customSortPanelItemHead,children:[i.jsx("div",{className:d.customSortPanelItemHandler,children:i.jsx(Se,{})}),i.jsx("div",{className:d.customSortPanelItemColumn,children:i.jsx(x.Dropdown,{align:"start",overlay:i.jsx("ul",{className:x.clsx(d.customSortColMenu,"univer-theme"),children:m.map(f=>i.jsxs("li",{onClick:()=>C(f),className:d.customSortColMenuItem,children:[i.jsx("span",{className:d.customSortColMenuItemDesc,children:f.label}),i.jsx("span",{className:d.customSortColMenuItemCheck,children:f.index===n.colIndex&&i.jsx(le,{})})]},f.index))}),open:M,onOpenChange:b,children:i.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[i.jsx("span",{className:d.customSortPanelItemColumnInputText,children:w}),i.jsx(ge,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),i.jsx("div",{className:d.customSortPanelItemOrder,children:i.jsxs(x.RadioGroup,{className:G,value:n.type,onChange:f=>{o({...n,type:f},S)},children:[i.jsx(x.Radio,{value:T.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),i.jsx(x.Radio,{value:T.SortType.DESC,children:c.t("sheets-sort.general.sort-desc")})]})}),i.jsx("div",{className:d.customSortPanelItemRemove,children:p&&i.jsx(ue,{onClick:()=>o(null,S)})})]})}function ft(e,t){const{startColumn:n,endColumn:r}=e,o=new Set(t.map(s=>s==null?void 0:s.colIndex));for(let s=n;s<=r;s++)if(!o.has(s))return s;return null}function vt(e){const{range:t,colIndex:n,onClose:r}=e,o=h.useDependency(v),s=h.useDependency(a.IUniverInstanceService),c=h.useDependency(a.LocaleService),m=l.useCallback(S=>{const{unitId:C,subUnitId:M}=u.getSheetCommandTarget(s)||{};if(t&&C&&M){const I={...t,startRow:t.startRow+1};o.triggerSortDirectly(S,!1,{unitId:C,subUnitId:M,range:I,colIndex:n})}else console.warn(`Cannot find the target to sort. unitId: ${C}, subUnitId: ${M}, range: ${t}, colIndex: ${n}`);r()},[t,n,o,s,r]);return i.jsxs("div",{className:d.embedSortBtnContainer,children:[i.jsxs("div",{className:`
4
+ `,children:[i.jsx(X,{}),i.jsx("span",{className:d.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]})]}),i.jsx("div",{className:d.conditionList,onScroll:g=>{const _=g.currentTarget.scrollTop;a(_)},ref:m,children:i.jsx(x.DraggableList,{list:re,onListChange:w,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>i.jsx(St,{titles:b,list:re,item:g,onChange:(_,O)=>G(O,_),scrollPosition:s}),rowHeight:32,margin:[0,12]})})]}),i.jsxs("div",{className:d.customSortPanelFooter,children:[i.jsx(x.Button,{className:d.customSortPanelFooterBtn,onClick:()=>q(),children:n.t("sheets-sort.dialog.cancel")}),i.jsx(x.Button,{className:d.customSortPanelFooterBtn,variant:"primary",onClick:()=>f(p,r),children:n.t("sheets-sort.dialog.confirm")})]})]})}function St(e){var N;const{list:t,item:n,titles:r,onChange:o,scrollPosition:s}=e,a=h.useDependency(c.LocaleService),m=r.filter(f=>!t.some(q=>q.colIndex===f.index)||f.index===n.colIndex),S=t.findIndex(f=>f.colIndex===n.colIndex),C=l.useCallback(f=>{o({...n,colIndex:f.index},S),I(!1)},[S,n,o]),[M,I]=l.useState(!1),b=f=>{I(f)};l.useEffect(()=>{I(!1)},[s]);const p=t.length>1,w=(N=r.find(f=>f.index===n.colIndex))==null?void 0:N.label,G=a.getCurrentLocale()===c.LocaleType.ZH_CN?d.customSortPanelItemOrderRadioCn:d.customSortPanelItemOrderRadio;return i.jsxs("div",{className:d.customSortPanelItem,children:[i.jsxs("div",{className:d.customSortPanelItemHead,children:[i.jsx("div",{className:d.customSortPanelItemHandler,children:i.jsx(Se,{})}),i.jsx("div",{className:d.customSortPanelItemColumn,children:i.jsx(x.Dropdown,{align:"start",overlay:i.jsx("ul",{className:x.clsx(d.customSortColMenu,"univer-theme"),children:m.map(f=>i.jsxs("li",{onClick:()=>C(f),className:d.customSortColMenuItem,children:[i.jsx("span",{className:d.customSortColMenuItemDesc,children:f.label}),i.jsx("span",{className:d.customSortColMenuItemCheck,children:f.index===n.colIndex&&i.jsx(le,{})})]},f.index))}),open:M,onOpenChange:b,children:i.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[i.jsx("span",{className:d.customSortPanelItemColumnInputText,children:w}),i.jsx(ge,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),i.jsx("div",{className:d.customSortPanelItemOrder,children:i.jsxs(x.RadioGroup,{className:G,value:n.type,onChange:f=>{o({...n,type:f},S)},children:[i.jsx(x.Radio,{value:T.SortType.ASC,children:a.t("sheets-sort.general.sort-asc")}),i.jsx(x.Radio,{value:T.SortType.DESC,children:a.t("sheets-sort.general.sort-desc")})]})}),i.jsx("div",{className:d.customSortPanelItemRemove,children:p&&i.jsx(ue,{onClick:()=>o(null,S)})})]})}function Ct(e,t){const{startColumn:n,endColumn:r}=e,o=new Set(t.map(s=>s==null?void 0:s.colIndex));for(let s=n;s<=r;s++)if(!o.has(s))return s;return null}function ft(e){const{range:t,colIndex:n,onClose:r}=e,o=h.useDependency(v),s=h.useDependency(c.IUniverInstanceService),a=h.useDependency(c.LocaleService),m=l.useCallback(S=>{const{unitId:C,subUnitId:M}=u.getSheetCommandTarget(s)||{};if(t&&C&&M){const I={...t,startRow:t.startRow+1};o.triggerSortDirectly(S,!1,{unitId:C,subUnitId:M,range:I,colIndex:n})}else console.warn(`Cannot find the target to sort. unitId: ${C}, subUnitId: ${M}, range: ${t}, colIndex: ${n}`);r()},[t,n,o,s,r]);return i.jsxs("div",{"data-univer-comp-embed-sort-btn-container":!0,className:`
5
+ univer-mb-3 univer-flex univer-w-full univer-items-center univer-justify-center univer-py-[6px]
6
+ univer-text-sm
7
+ `,children:[i.jsxs("div",{className:`
5
8
  ${d.embedSortBtn}
6
9
  ${d.embedSortBtnAsc}
7
- `,onClick:()=>m(!0),children:[i.jsx(K,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),i.jsxs("div",{className:`
10
+ `,onClick:()=>m(!0),children:[i.jsx(K,{className:d.embedSortBtnIcon}),a.t("sheets-sort.general.sort-asc")]}),i.jsxs("div",{className:`
8
11
  ${d.embedSortBtn}
9
12
  ${d.embedSortBtnDesc}
10
- `,onClick:()=>m(!1),children:[i.jsx(J,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const Ce="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",D="AscendingSingle",Q="ExpandAscendingSingle",ee="DescendingSingle",te="ExpandDescendingSingle",ne="CustomSortSingle";function pt(e){return{id:Ce,type:h.MenuItemType.SUBITEMS,icon:D,tooltip:"sheets-sort.general.sort",hidden$:h.getMenuHiddenObservable(e,a.UniverInstanceType.UNIVER_SHEET),disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function It(e){return{id:H.id,icon:D,title:"sheets-sort.general.sort-asc-cur",type:h.MenuItemType.BUTTON,hidden$:P.getCurrentExclusiveRangeInterest$(e)}}function yt(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:Q,type:h.MenuItemType.BUTTON}}function xt(e){return{id:$.id,title:"sheets-sort.general.sort-desc-cur",icon:ee,type:h.MenuItemType.BUTTON}}function _t(e){return{id:A.id,title:"sheets-sort.general.sort-desc-ext",icon:te,type:h.MenuItemType.BUTTON}}function Rt(e){return{id:B.id,title:"sheets-sort.general.sort-custom",type:h.MenuItemType.BUTTON,icon:ne}}function Mt(e){return{id:fe,title:"sheets-sort.general.sort",type:h.MenuItemType.SUBITEMS,icon:D,hidden$:h.getMenuHiddenObservable(e,a.UniverInstanceType.UNIVER_SHEET),disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Et(e){return{id:F.id,title:"sheets-sort.general.sort-asc-cur",type:h.MenuItemType.BUTTON,icon:D,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Tt(e){return{id:W.id,title:"sheets-sort.general.sort-asc-ext",type:h.MenuItemType.BUTTON,icon:Q,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Pt(e){return{id:V.id,title:"sheets-sort.general.sort-desc-cur",type:h.MenuItemType.BUTTON,icon:ee,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function bt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-ext",type:h.MenuItemType.BUTTON,icon:te,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function kt(e){return{id:Z.id,title:"sheets-sort.general.sort-custom",type:h.MenuItemType.BUTTON,icon:ne,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}const wt={[h.RibbonStartGroup.FORMULAS_INSERT]:{[Ce]:{order:2,menuItemFactory:pt,[H.id]:{order:0,menuItemFactory:It},[U.id]:{order:1,menuItemFactory:yt},[$.id]:{order:2,menuItemFactory:xt},[A.id]:{order:3,menuItemFactory:_t},[B.id]:{order:4,menuItemFactory:Rt}}},[h.ContextMenuPosition.MAIN_AREA]:{[h.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:Mt,[F.id]:{order:0,menuItemFactory:Et},[W.id]:{order:1,menuItemFactory:Tt},[V.id]:{order:2,menuItemFactory:Pt},[z.id]:{order:3,menuItemFactory:bt},[Z.id]:{order:4,menuItemFactory:kt}}}}};var Ot=Object.getOwnPropertyDescriptor,Dt=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ot(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(o=c(o)||o);return o},E=(e,t)=>(n,r)=>t(n,r,e);const se="custom-sort-dialog",Nt=560;let L=class extends a.RxDisposable{constructor(e,t,n,r,o,s,c,m,S,C){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=n,this._layoutService=r,this._uiPartsService=o,this._sheetRenderService=s,this._localeService=c,this._sheetsSortUIService=m,this._injector=S,this._componentManager=C,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(wt)}_initCommands(){[H,U,$,A,B,F,W,V,z,Z].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(T.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",St)),this.disposeWithMe(this._uiPartsService.registerComponent(P.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>h.connectInjector(vt,this._injector))),this.disposeWithMe(this._componentManager.register(D,K)),this.disposeWithMe(this._componentManager.register(Q,me)),this.disposeWithMe(this._componentManager.register(ee,J)),this.disposeWithMe(this._componentManager.register(te,he)),this.disposeWithMe(this._componentManager.register(ne,de)),this._sheetsSortUIService.customSortState$.pipe(ae.takeUntil(this.dispose$)).subscribe(e=>{e&&e.show&&e.location?this._openCustomSortPanel(e.location):e&&!(e!=null&&e.show)&&this._closePanel()})}_openCustomSortPanel(e){this._dialogService.open({id:se,draggable:!0,width:Nt,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:jt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(se),queueMicrotask(()=>this._layoutService.focus())}};L=Dt([E(0,a.ICommandService),E(1,h.IMenuManagerService),E(2,h.IDialogService),E(3,h.ILayoutService),E(4,h.IUIPartsService),E(5,a.Inject(P.SheetsRenderService)),E(6,a.Inject(a.LocaleService)),E(7,a.Inject(v)),E(8,a.Inject(a.Injector)),E(9,a.Inject(h.ComponentManager))],L);function jt(){return{x:0,y:0}}var Lt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,Ut=(e,t,n)=>t in e?Lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$t=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ht(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(o=c(o)||o);return o},ie=(e,t)=>(n,r)=>t(n,r,e),ve=(e,t,n)=>Ut(e,typeof t!="symbol"?t+"":t,n);const At="SHEET_SORT_UI_PLUGIN";exports.UniverSheetsSortUIPlugin=class extends a.Plugin{constructor(t=oe,n,r){super(),this._config=t,this._injector=n,this._configService=r;const{...o}=a.merge({},oe,this._config);this._configService.setConfig(Re,o)}onStarting(){[[v],[L]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(L)}};ve(exports.UniverSheetsSortUIPlugin,"type",a.UniverInstanceType.UNIVER_SHEET);ve(exports.UniverSheetsSortUIPlugin,"pluginName",At);exports.UniverSheetsSortUIPlugin=$t([a.DependentOn(T.UniverSheetsSortPlugin),ie(1,a.Inject(a.Injector)),ie(2,a.IConfigService)],exports.UniverSheetsSortUIPlugin);exports.SortRangeAscCommand=H;exports.SortRangeAscExtCommand=U;exports.SortRangeAscExtInCtxMenuCommand=W;exports.SortRangeAscInCtxMenuCommand=F;exports.SortRangeCustomCommand=B;exports.SortRangeCustomInCtxMenuCommand=Z;exports.SortRangeDescCommand=$;exports.SortRangeDescExtCommand=A;exports.SortRangeDescExtInCtxMenuCommand=z;exports.SortRangeDescInCtxMenuCommand=V;
13
+ `,onClick:()=>m(!1),children:[i.jsx(J,{className:d.embedSortBtnIcon}),a.t("sheets-sort.general.sort-desc")]})]})}const Ce="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",D="AscendingSingle",Q="ExpandAscendingSingle",ee="DescendingSingle",te="ExpandDescendingSingle",ne="CustomSortSingle";function vt(e){return{id:Ce,type:h.MenuItemType.SUBITEMS,icon:D,tooltip:"sheets-sort.general.sort",hidden$:h.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_SHEET),disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function pt(e){return{id:H.id,icon:D,title:"sheets-sort.general.sort-asc-cur",type:h.MenuItemType.BUTTON,hidden$:P.getCurrentExclusiveRangeInterest$(e)}}function It(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:Q,type:h.MenuItemType.BUTTON}}function yt(e){return{id:$.id,title:"sheets-sort.general.sort-desc-cur",icon:ee,type:h.MenuItemType.BUTTON}}function xt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-ext",icon:te,type:h.MenuItemType.BUTTON}}function _t(e){return{id:B.id,title:"sheets-sort.general.sort-custom",type:h.MenuItemType.BUTTON,icon:ne}}function Rt(e){return{id:fe,title:"sheets-sort.general.sort",type:h.MenuItemType.SUBITEMS,icon:D,hidden$:h.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_SHEET),disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Mt(e){return{id:F.id,title:"sheets-sort.general.sort-asc-cur",type:h.MenuItemType.BUTTON,icon:D,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Et(e){return{id:W.id,title:"sheets-sort.general.sort-asc-ext",type:h.MenuItemType.BUTTON,icon:Q,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Tt(e){return{id:V.id,title:"sheets-sort.general.sort-desc-cur",type:h.MenuItemType.BUTTON,icon:ee,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Pt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-ext",type:h.MenuItemType.BUTTON,icon:te,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function bt(e){return{id:Z.id,title:"sheets-sort.general.sort-custom",type:h.MenuItemType.BUTTON,icon:ne,disabled$:P.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}const kt={[h.RibbonStartGroup.FORMULAS_INSERT]:{[Ce]:{order:2,menuItemFactory:vt,[H.id]:{order:0,menuItemFactory:pt},[U.id]:{order:1,menuItemFactory:It},[$.id]:{order:2,menuItemFactory:yt},[A.id]:{order:3,menuItemFactory:xt},[B.id]:{order:4,menuItemFactory:_t}}},[h.ContextMenuPosition.MAIN_AREA]:{[h.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:Rt,[F.id]:{order:0,menuItemFactory:Mt},[W.id]:{order:1,menuItemFactory:Et},[V.id]:{order:2,menuItemFactory:Tt},[z.id]:{order:3,menuItemFactory:Pt},[Z.id]:{order:4,menuItemFactory:bt}}}}};var wt=Object.getOwnPropertyDescriptor,Ot=(e,t,n,r)=>{for(var o=r>1?void 0:r?wt(t,n):t,s=e.length-1,a;s>=0;s--)(a=e[s])&&(o=a(o)||o);return o},E=(e,t)=>(n,r)=>t(n,r,e);const se="custom-sort-dialog",Dt=560;let L=class extends c.RxDisposable{constructor(e,t,n,r,o,s,a,m,S,C){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=n,this._layoutService=r,this._uiPartsService=o,this._sheetRenderService=s,this._localeService=a,this._sheetsSortUIService=m,this._injector=S,this._componentManager=C,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(kt)}_initCommands(){[H,U,$,A,B,F,W,V,z,Z].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(T.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",gt)),this.disposeWithMe(this._uiPartsService.registerComponent(P.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>h.connectInjector(ft,this._injector))),this.disposeWithMe(this._componentManager.register(D,K)),this.disposeWithMe(this._componentManager.register(Q,me)),this.disposeWithMe(this._componentManager.register(ee,J)),this.disposeWithMe(this._componentManager.register(te,he)),this.disposeWithMe(this._componentManager.register(ne,de)),this._sheetsSortUIService.customSortState$.pipe(ce.takeUntil(this.dispose$)).subscribe(e=>{e&&e.show&&e.location?this._openCustomSortPanel(e.location):e&&!(e!=null&&e.show)&&this._closePanel()})}_openCustomSortPanel(e){this._dialogService.open({id:se,draggable:!0,width:Dt,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:Nt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(se),queueMicrotask(()=>this._layoutService.focus())}};L=Ot([E(0,c.ICommandService),E(1,h.IMenuManagerService),E(2,h.IDialogService),E(3,h.ILayoutService),E(4,h.IUIPartsService),E(5,c.Inject(P.SheetsRenderService)),E(6,c.Inject(c.LocaleService)),E(7,c.Inject(v)),E(8,c.Inject(c.Injector)),E(9,c.Inject(h.ComponentManager))],L);function Nt(){return{x:0,y:0}}var jt=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,Ht=(e,t,n)=>t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ut=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lt(t,n):t,s=e.length-1,a;s>=0;s--)(a=e[s])&&(o=a(o)||o);return o},ie=(e,t)=>(n,r)=>t(n,r,e),ve=(e,t,n)=>Ht(e,typeof t!="symbol"?t+"":t,n);const $t="SHEET_SORT_UI_PLUGIN";exports.UniverSheetsSortUIPlugin=class extends c.Plugin{constructor(t=oe,n,r){super(),this._config=t,this._injector=n,this._configService=r;const{...o}=c.merge({},oe,this._config);this._configService.setConfig(Re,o)}onStarting(){[[v],[L]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(L)}};ve(exports.UniverSheetsSortUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET);ve(exports.UniverSheetsSortUIPlugin,"pluginName",$t);exports.UniverSheetsSortUIPlugin=Ut([c.DependentOn(T.UniverSheetsSortPlugin),ie(1,c.Inject(c.Injector)),ie(2,c.IConfigService)],exports.UniverSheetsSortUIPlugin);exports.SortRangeAscCommand=H;exports.SortRangeAscExtCommand=U;exports.SortRangeAscExtInCtxMenuCommand=W;exports.SortRangeAscInCtxMenuCommand=F;exports.SortRangeCustomCommand=B;exports.SortRangeCustomInCtxMenuCommand=Z;exports.SortRangeDescCommand=$;exports.SortRangeDescExtCommand=A;exports.SortRangeDescExtInCtxMenuCommand=z;exports.SortRangeDescInCtxMenuCommand=V;