@univerjs/sheets-sort-ui 0.6.0 → 0.6.1-nightly.202502221605

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,10 @@
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"),P=require("@univerjs/sheets-sort"),_e=require("@univerjs/engine-formula"),T=require("@univerjs/sheets-ui"),m=require("@univerjs/ui"),ce=require("rxjs"),i=require("react/jsx-runtime"),u=require("@univerjs/sheets"),_=require("@univerjs/design"),d=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=d.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,s=e.extend,a=Me(e,["icon","id","className","extend"]),h="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),S=d.useRef("_".concat(Te()));return ae(n,"".concat(r),{defIds:n.defIds,idSuffix:S.current},y({ref:t,className:h},a),s)});function ae(e,t,n,r,o){return d.createElement(e.tag,y(y({key:t},Ee(e,n,o)),r),(Pe(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);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],h=s[1];typeof h=="string"&&(r[a]=h.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Pe(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 Te(){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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.createElement(R,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});me.displayName="ExpandAscendingSingle";var Le={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=d.forwardRef(function(e,t){return d.createElement(R,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Le}))});he.displayName="ExpandDescendingSingle";var je={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=d.forwardRef(function(e,t){return d.createElement(R,Object.assign({},e,{id:"increase-single",ref:t,icon:je}))});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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.createElement(R,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ue}))});Se.displayName="SequenceSingle";const Ae="univer-extend-confirm-content",$e="univer-extend-confirm-radio-group",Be="univer-custom-sort-panel-container",Fe="univer-custom-sort-panel-ext",We="univer-add-condition",Ve="univer-add-condition-text",ze="univer-add-condition-disable",Ze="univer-custom-sort-panel-footer",Ge="univer-custom-sort-panel-footer-btn",qe="univer-custom-sort-panel-item",Ye="univer-custom-sort-panel-item-head",Xe="univer-custom-sort-panel-item-handler",Ke="univer-custom-sort-panel-item-remove",Je="univer-custom-sort-panel-item-column-input",Qe="univer-custom-sort-panel-item-column-input-dropdown",et="univer-custom-sort-panel-item-column-input-text",tt="univer-custom-sort-panel-item-order-radio",nt="univer-custom-sort-panel-item-order-radio-cn",rt="univer-condition-list",ot="univer-embed-sort-btn-container",st="univer-embed-sort-btn",it="univer-embed-sort-btn-asc",ct="univer-embed-sort-btn-desc",at="univer-embed-sort-btn-icon",lt="univer-custom-sort-col-menu",dt="univer-custom-sort-col-menu-item",ut="univer-custom-sort-col-menu-item-desc",l={extendConfirmContent:Ae,extendConfirmRadioGroup:$e,customSortPanelContainer:Be,customSortPanelExt:Fe,addCondition:We,addConditionText:Ve,addConditionDisable:ze,customSortPanelFooter:Ze,customSortPanelFooterBtn:Ge,customSortPanelItem:qe,customSortPanelItemHead:Ye,customSortPanelItemHandler:Xe,customSortPanelItemRemove:Ke,customSortPanelItemColumnInput:Je,customSortPanelItemColumnInputDropdown:Qe,customSortPanelItemColumnInputText:et,customSortPanelItemOrderRadio:tt,customSortPanelItemOrderRadioCn:nt,conditionList:rt,embedSortBtnContainer:ot,embedSortBtn:st,embedSortBtnAsc:it,embedSortBtnDesc:ct,embedSortBtnIcon:at,customSortColMenu:lt,customSortColMenuItem:dt,customSortColMenuItemDesc:ut},mt=e=>{const[t,n]=d.useState("0"),r=m.useDependency(c.LocaleService);return i.jsxs("div",{className:l.extendConfirmContent,children:[i.jsx("div",{className:"extend-confirm-desc",children:r.t("sheets-sort.dialog.sort-reminder-desc")}),i.jsxs(_.RadioGroup,{className:l.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:o=>{n(o),e.onChange(o)},children:[i.jsx(_.Radio,{value:"0",children:r.t("sheets-sort.dialog.sort-reminder-no")}),i.jsx(_.Radio,{value:"1",children:r.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var ht=Object.getOwnPropertyDescriptor,gt=(e,t,n,r)=>{for(var o=r>1?void 0:r?ht(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 L={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 c.Disposable{constructor(t,n,r,o,s,a,h){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=h}async triggerSortDirectly(t,n,r){const o=r||await this._detectSortLocation(n);if(!o||!this._check(o))return!1;const a={orderRules:[{type:t?P.SortType.ASC:P.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 h=St(this._localeService);return Array.from({length:s.endColumn-s.startColumn+1},(M,I)=>{var v;const b=(v=a.getCell(s.startRow,I+s.startColumn))==null?void 0:v.v;return{index:I+s.startColumn,label:t?`${b!=null?b:h(I+s.startColumn)}`:h(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(mt,{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(L.EMPTY_ERROR),!1):(this.showCheckError(L.FORMULA_ARRAY),!1):(this.showCheckError(L.MERGE_ERROR),!1):(this.showCheckError(L.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 h;if(t===!0)h=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,s,h);else if(t===!1)h=a.range;else{const S=await this.showExtendConfirm();if(S==="cancel")return null;S==="keep"?h=a.range:(h=u.expandToContinuousRange(a.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,s,h))}return{range:h,unitId:o,subUnitId:s,colIndex:a.primary.actualColumn}}};p=gt([k(0,c.IUniverInstanceService),k(1,m.IConfirmService),k(2,c.ILogService),k(3,c.Inject(u.SheetsSelectionsService)),k(4,c.Inject(P.SheetsSortService)),k(5,c.Inject(c.LocaleService)),k(6,c.ICommandService)],p);function St(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(p).triggerSortDirectly(!0,!1)},U={id:"sheet.command.sort-range-asc-ext",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},A={id:"sheet.command.sort-range-desc",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},$={id:"sheet.command.sort-range-desc-ext",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},B={id:"sheet.command.sort-range-custom",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},F={id:"sheet.command.sort-range-asc-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},W={id:"sheet.command.sort-range-asc-ext-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},V={id:"sheet.command.sort-range-desc-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},z={id:"sheet.command.sort-range-desc-ext-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},Z={id:"sheet.command.sort-range-custom-ctx",type:c.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function Ct(){const e=m.useDependency(p),t=m.useDependency(P.SheetsSortService),n=m.useDependency(c.LocaleService),[r,o]=d.useState(!1),[s,a]=d.useState(0),h=d.useRef(null),S=e.customSortState();if(!S||!S.location)return null;const{range:C,unitId:M,subUnitId:I}=S.location,b=e.getTitles(r),[v,w]=d.useState([{type:P.SortType.ASC,colIndex:C.startColumn}]),G=d.useCallback((g,x)=>{const O=[...v];x===null?O.splice(g,1):O[g]=x,w(O)},[v]),N=d.useCallback(c.throttle(()=>{const g=[...v],x=pt(C,v);x!==null&&(g.push({type:P.SortType.ASC,colIndex:x}),w(g))},200),[v,C]),f=d.useCallback((g,x)=>{t.applySort({range:C,orderRules:g,hasTitle:x}),e.closeCustomSortPanel()},[t,e,C]),q=d.useCallback(()=>{e.closeCustomSortPanel()},[e]),ve=d.useCallback(g=>{o(g),g?e.setSelection(M,I,{...C,startRow:C.startRow+1}):e.setSelection(M,I,C)},[e,C,I,M]);d.useEffect(()=>{h.current&&v.length>5&&(h.current.scrollTop=h.current.scrollHeight)},[v]);const Ie=v.length<b.length,re=v.map(g=>({...g,id:`${g.colIndex}`}));return i.jsxs("div",{className:l.customSortPanelContainer,children:[i.jsxs("div",{className:l.customSortPanelContent,onMouseDown:g=>{g.stopPropagation()},children:[i.jsxs("div",{className:l.customSortPanelExt,children:[i.jsx("div",{className:l.firstRowCheck,children:i.jsx(_.Checkbox,{checked:r,onChange:g=>ve(!!g),children:n.t("sheets-sort.dialog.first-row-check")})}),Ie?i.jsxs("div",{className:l.addCondition,onClick:N,children:[i.jsx(X,{}),i.jsx("span",{className:l.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"),_=require("@univerjs/design"),d=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=d.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=d.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 d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.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=d.forwardRef(function(e,t){return d.createElement(R,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ue}))});Se.displayName="SequenceSingle";const $e="univer-extend-confirm-content",Ae="univer-extend-confirm-radio-group",Be="univer-custom-sort-panel-container",Fe="univer-custom-sort-panel-ext",We="univer-add-condition",Ve="univer-add-condition-text",ze="univer-add-condition-disable",Ze="univer-custom-sort-panel-footer",Ge="univer-custom-sort-panel-footer-btn",qe="univer-custom-sort-panel-item",Ye="univer-custom-sort-panel-item-head",Xe="univer-custom-sort-panel-item-handler",Ke="univer-custom-sort-panel-item-remove",Je="univer-custom-sort-panel-item-column-input",Qe="univer-custom-sort-panel-item-column-input-dropdown",et="univer-custom-sort-panel-item-column-input-text",tt="univer-custom-sort-panel-item-order-radio",nt="univer-custom-sort-panel-item-order-radio-cn",rt="univer-condition-list",ot="univer-embed-sort-btn-container",st="univer-embed-sort-btn",it="univer-embed-sort-btn-asc",ct="univer-embed-sort-btn-desc",at="univer-embed-sort-btn-icon",lt="univer-custom-sort-col-menu",dt="univer-custom-sort-col-menu-item",ut="univer-custom-sort-col-menu-item-desc",l={extendConfirmContent:$e,extendConfirmRadioGroup:Ae,customSortPanelContainer:Be,customSortPanelExt:Fe,addCondition:We,addConditionText:Ve,addConditionDisable:ze,customSortPanelFooter:Ze,customSortPanelFooterBtn:Ge,customSortPanelItem:qe,customSortPanelItemHead:Ye,customSortPanelItemHandler:Xe,customSortPanelItemRemove:Ke,customSortPanelItemColumnInput:Je,customSortPanelItemColumnInputDropdown:Qe,customSortPanelItemColumnInputText:et,customSortPanelItemOrderRadio:tt,customSortPanelItemOrderRadioCn:nt,conditionList:rt,embedSortBtnContainer:ot,embedSortBtn:st,embedSortBtnAsc:it,embedSortBtnDesc:ct,embedSortBtnIcon:at,customSortColMenu:lt,customSortColMenuItem:dt,customSortColMenuItemDesc:ut},mt=e=>{const[t,n]=d.useState("0"),r=h.useDependency(c.LocaleService);return i.jsxs("div",{className:l.extendConfirmContent,children:[i.jsx("div",{className:"extend-confirm-desc",children:r.t("sheets-sort.dialog.sort-reminder-desc")}),i.jsxs(_.RadioGroup,{className:l.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:o=>{n(o),e.onChange(o)},children:[i.jsx(_.Radio,{value:"0",children:r.t("sheets-sort.dialog.sort-reminder-no")}),i.jsx(_.Radio,{value:"1",children:r.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var ht=Object.getOwnPropertyDescriptor,gt=(e,t,n,r)=>{for(var o=r>1?void 0:r?ht(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=St(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(mt,{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=gt([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 St(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 Ct(){const e=h.useDependency(v),t=h.useDependency(T.SheetsSortService),n=h.useDependency(c.LocaleService),[r,o]=d.useState(!1),[s,a]=d.useState(0),m=d.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]=d.useState([{type:T.SortType.ASC,colIndex:C.startColumn}]),G=d.useCallback((g,x)=>{const O=[...p];x===null?O.splice(g,1):O[g]=x,w(O)},[p]),N=d.useCallback(c.throttle(()=>{const g=[...p],x=vt(C,p);x!==null&&(g.push({type:T.SortType.ASC,colIndex:x}),w(g))},200),[p,C]),f=d.useCallback((g,x)=>{t.applySort({range:C,orderRules:g,hasTitle:x}),e.closeCustomSortPanel()},[t,e,C]),q=d.useCallback(()=>{e.closeCustomSortPanel()},[e]),pe=d.useCallback(g=>{o(g),g?e.setSelection(M,I,{...C,startRow:C.startRow+1}):e.setSelection(M,I,C)},[e,C,I,M]);d.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:l.customSortPanelContainer,children:[i.jsxs("div",{className:l.customSortPanelContent,onMouseDown:g=>{g.stopPropagation()},children:[i.jsxs("div",{className:l.customSortPanelExt,children:[i.jsx("div",{className:l.firstRowCheck,children:i.jsx(_.Checkbox,{checked:r,onChange:g=>pe(!!g),children:n.t("sheets-sort.dialog.first-row-check")})}),Ie?i.jsxs("div",{className:l.addCondition,onClick:N,children:[i.jsx(X,{}),i.jsx("span",{className:l.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]}):i.jsxs("div",{className:`
2
2
  ${l.addCondition}
3
3
  ${l.addConditionDisable}
4
- `,children:[i.jsx(X,{}),i.jsx("span",{className:l.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]})]}),i.jsx("div",{className:l.conditionList,onScroll:g=>{const x=g.currentTarget.scrollTop;a(x)},ref:h,children:i.jsx(_.DraggableList,{list:re,onListChange:w,idKey:"id",draggableHandle:`.${l.customSortPanelItemHandler}`,itemRender:g=>i.jsx(ft,{titles:b,list:re,item:g,onChange:(x,O)=>G(O,x),scrollPosition:s}),rowHeight:32,margin:[0,12]})})]}),i.jsxs("div",{className:l.customSortPanelFooter,children:[i.jsx(_.Button,{className:l.customSortPanelFooterBtn,type:"default",onClick:()=>q(),children:n.t("sheets-sort.dialog.cancel")}),i.jsx(_.Button,{className:l.customSortPanelFooterBtn,type:"primary",onClick:()=>f(v,r),children:n.t("sheets-sort.dialog.confirm")})]})]})}function ft(e){var N;const{list:t,item:n,titles:r,onChange:o,scrollPosition:s}=e,a=m.useDependency(c.LocaleService),h=r.filter(f=>!t.some(q=>q.colIndex===f.index)||f.index===n.colIndex),S=t.findIndex(f=>f.colIndex===n.colIndex),C=d.useCallback(f=>{o({...n,colIndex:f.index},S),I(!1)},[S,n,o]),[M,I]=d.useState(!1),b=f=>{I(f)};d.useEffect(()=>{I(!1)},[s]);const v=t.length>1,w=(N=r.find(f=>f.index===n.colIndex))==null?void 0:N.label,G=a.getCurrentLocale()===c.LocaleType.ZH_CN?l.customSortPanelItemOrderRadioCn:l.customSortPanelItemOrderRadio;return i.jsxs("div",{className:l.customSortPanelItem,children:[i.jsxs("div",{className:l.customSortPanelItemHead,children:[i.jsx("div",{className:l.customSortPanelItemHandler,children:i.jsx(Se,{})}),i.jsx("div",{className:l.customSortPanelItemColumn,children:i.jsx(_.DropdownLegacy,{placement:"bottomLeft",trigger:["click"],visible:M,onVisibleChange:b,overlay:i.jsx("ul",{className:l.customSortColMenu,children:h.map(f=>i.jsxs("li",{onClick:()=>C(f),className:l.customSortColMenuItem,children:[i.jsx("span",{className:l.customSortColMenuItemDesc,children:f.label}),i.jsx("span",{className:l.customSortColMenuItemCheck,children:f.index===n.colIndex&&i.jsx(le,{})})]},f.index))}),children:i.jsxs("div",{className:l.customSortPanelItemColumnInput,children:[i.jsx("span",{className:l.customSortPanelItemColumnInputText,children:w}),i.jsx(ge,{className:l.customSortPanelItemColumnInputDropdown})]})})})]}),i.jsx("div",{className:l.customSortPanelItemOrder,children:i.jsxs(_.RadioGroup,{className:G,value:n.type,onChange:f=>{o({...n,type:f},S)},children:[i.jsx(_.Radio,{value:P.SortType.ASC,children:a.t("sheets-sort.general.sort-asc")}),i.jsx(_.Radio,{value:P.SortType.DESC,children:a.t("sheets-sort.general.sort-desc")})]})}),i.jsx("div",{className:l.customSortPanelItemRemove,children:v&&i.jsx(ue,{onClick:()=>o(null,S)})})]})}function pt(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=m.useDependency(p),s=m.useDependency(c.IUniverInstanceService),a=m.useDependency(c.LocaleService),h=d.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:l.embedSortBtnContainer,children:[i.jsxs("div",{className:`
4
+ `,children:[i.jsx(X,{}),i.jsx("span",{className:l.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]})]}),i.jsx("div",{className:l.conditionList,onScroll:g=>{const x=g.currentTarget.scrollTop;a(x)},ref:m,children:i.jsx(_.DraggableList,{list:re,onListChange:w,idKey:"id",draggableHandle:`.${l.customSortPanelItemHandler}`,itemRender:g=>i.jsx(ft,{titles:b,list:re,item:g,onChange:(x,O)=>G(O,x),scrollPosition:s}),rowHeight:32,margin:[0,12]})})]}),i.jsxs("div",{className:l.customSortPanelFooter,children:[i.jsx(_.Button,{className:l.customSortPanelFooterBtn,type:"default",onClick:()=>q(),children:n.t("sheets-sort.dialog.cancel")}),i.jsx(_.Button,{className:l.customSortPanelFooterBtn,type:"primary",onClick:()=>f(p,r),children:n.t("sheets-sort.dialog.confirm")})]})]})}function ft(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=d.useCallback(f=>{o({...n,colIndex:f.index},S),I(!1)},[S,n,o]),[M,I]=d.useState(!1),b=f=>{I(f)};d.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?l.customSortPanelItemOrderRadioCn:l.customSortPanelItemOrderRadio;return i.jsxs("div",{className:l.customSortPanelItem,children:[i.jsxs("div",{className:l.customSortPanelItemHead,children:[i.jsx("div",{className:l.customSortPanelItemHandler,children:i.jsx(Se,{})}),i.jsx("div",{className:l.customSortPanelItemColumn,children:i.jsx(_.DropdownLegacy,{placement:"bottomLeft",trigger:["click"],visible:M,onVisibleChange:b,overlay:i.jsx("ul",{className:l.customSortColMenu,children:m.map(f=>i.jsxs("li",{onClick:()=>C(f),className:l.customSortColMenuItem,children:[i.jsx("span",{className:l.customSortColMenuItemDesc,children:f.label}),i.jsx("span",{className:l.customSortColMenuItemCheck,children:f.index===n.colIndex&&i.jsx(le,{})})]},f.index))}),children:i.jsxs("div",{className:l.customSortPanelItemColumnInput,children:[i.jsx("span",{className:l.customSortPanelItemColumnInputText,children:w}),i.jsx(ge,{className:l.customSortPanelItemColumnInputDropdown})]})})})]}),i.jsx("div",{className:l.customSortPanelItemOrder,children:i.jsxs(_.RadioGroup,{className:G,value:n.type,onChange:f=>{o({...n,type:f},S)},children:[i.jsx(_.Radio,{value:T.SortType.ASC,children:a.t("sheets-sort.general.sort-asc")}),i.jsx(_.Radio,{value:T.SortType.DESC,children:a.t("sheets-sort.general.sort-desc")})]})}),i.jsx("div",{className:l.customSortPanelItemRemove,children:p&&i.jsx(ue,{onClick:()=>o(null,S)})})]})}function vt(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 pt(e){const{range:t,colIndex:n,onClose:r}=e,o=h.useDependency(v),s=h.useDependency(c.IUniverInstanceService),a=h.useDependency(c.LocaleService),m=d.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:l.embedSortBtnContainer,children:[i.jsxs("div",{className:`
5
5
  ${l.embedSortBtn}
6
6
  ${l.embedSortBtnAsc}
7
- `,onClick:()=>h(!0),children:[i.jsx(K,{className:l.embedSortBtnIcon}),a.t("sheets-sort.general.sort-asc")]}),i.jsxs("div",{className:`
7
+ `,onClick:()=>m(!0),children:[i.jsx(K,{className:l.embedSortBtnIcon}),a.t("sheets-sort.general.sort-asc")]}),i.jsxs("div",{className:`
8
8
  ${l.embedSortBtn}
9
9
  ${l.embedSortBtnDesc}
10
- `,onClick:()=>h(!1),children:[i.jsx(J,{className:l.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 It(e){return{id:Ce,type:m.MenuItemType.SUBITEMS,icon:D,tooltip:"sheets-sort.general.sort",hidden$:m.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_SHEET),disabled$:T.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function yt(e){return{id:H.id,icon:D,title:"sheets-sort.general.sort-asc-cur",type:m.MenuItemType.BUTTON,hidden$:T.getCurrentExclusiveRangeInterest$(e)}}function xt(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:Q,type:m.MenuItemType.BUTTON}}function _t(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:ee,type:m.MenuItemType.BUTTON}}function Rt(e){return{id:$.id,title:"sheets-sort.general.sort-desc-ext",icon:te,type:m.MenuItemType.BUTTON}}function Mt(e){return{id:B.id,title:"sheets-sort.general.sort-custom",type:m.MenuItemType.BUTTON,icon:ne}}function Et(e){return{id:fe,title:"sheets-sort.general.sort",type:m.MenuItemType.SUBITEMS,icon:D,hidden$:m.getMenuHiddenObservable(e,c.UniverInstanceType.UNIVER_SHEET),disabled$:T.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function Pt(e){return{id:F.id,title:"sheets-sort.general.sort-asc-cur",type:m.MenuItemType.BUTTON,icon:D,disabled$:T.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:m.MenuItemType.BUTTON,icon:Q,disabled$:T.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function bt(e){return{id:V.id,title:"sheets-sort.general.sort-desc-cur",type:m.MenuItemType.BUTTON,icon:ee,disabled$:T.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-desc-ext",type:m.MenuItemType.BUTTON,icon:te,disabled$:T.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}function wt(e){return{id:Z.id,title:"sheets-sort.general.sort-custom",type:m.MenuItemType.BUTTON,icon:ne,disabled$:T.getCurrentRangeDisable$(e,{workbookTypes:[u.WorkbookEditablePermission],worksheetTypes:[u.WorksheetSortPermission,u.WorksheetEditPermission],rangeTypes:[u.RangeProtectionPermissionEditPoint]})}}const Ot={[m.RibbonStartGroup.FORMULAS_INSERT]:{[Ce]:{order:2,menuItemFactory:It,[H.id]:{order:0,menuItemFactory:yt},[U.id]:{order:1,menuItemFactory:xt},[A.id]:{order:2,menuItemFactory:_t},[$.id]:{order:3,menuItemFactory:Rt},[B.id]:{order:4,menuItemFactory:Mt}}},[m.ContextMenuPosition.MAIN_AREA]:{[m.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:Et,[F.id]:{order:0,menuItemFactory:Pt},[W.id]:{order:1,menuItemFactory:Tt},[V.id]:{order:2,menuItemFactory:bt},[z.id]:{order:3,menuItemFactory:kt},[Z.id]:{order:4,menuItemFactory:wt}}}}};var Dt=Object.getOwnPropertyDescriptor,Nt=(e,t,n,r)=>{for(var o=r>1?void 0:r?Dt(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",Lt=560;let j=class extends c.RxDisposable{constructor(e,t,n,r,o,s,a,h,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=h,this._injector=S,this._componentManager=C,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(Ot)}_initCommands(){[H,U,A,$,B,F,W,V,z,Z].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(P.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",Ct)),this.disposeWithMe(this._uiPartsService.registerComponent(T.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>m.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(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:Lt,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())}};j=Nt([E(0,c.ICommandService),E(1,m.IMenuManagerService),E(2,m.IDialogService),E(3,m.ILayoutService),E(4,m.IUIPartsService),E(5,c.Inject(T.SheetsRenderService)),E(6,c.Inject(c.LocaleService)),E(7,c.Inject(p)),E(8,c.Inject(c.Injector)),E(9,c.Inject(m.ComponentManager))],j);function jt(){return{x:0,y:0}}var Ht=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,At=(e,t,n)=>t in e?Ht(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?Ut(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),pe=(e,t,n)=>At(e,typeof t!="symbol"?t+"":t,n);const Bt="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(){[[p],[j]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(j)}};pe(exports.UniverSheetsSortUIPlugin,"type",c.UniverInstanceType.UNIVER_SHEET);pe(exports.UniverSheetsSortUIPlugin,"pluginName",Bt);exports.UniverSheetsSortUIPlugin=$t([c.DependentOn(P.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=A;exports.SortRangeDescExtCommand=$;exports.SortRangeDescExtInCtxMenuCommand=z;exports.SortRangeDescInCtxMenuCommand=V;
10
+ `,onClick:()=>m(!1),children:[i.jsx(J,{className:l.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 It(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 yt(e){return{id:H.id,icon:D,title:"sheets-sort.general.sort-asc-cur",type:h.MenuItemType.BUTTON,hidden$:P.getCurrentExclusiveRangeInterest$(e)}}function xt(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:Q,type:h.MenuItemType.BUTTON}}function _t(e){return{id:$.id,title:"sheets-sort.general.sort-desc-cur",icon:ee,type:h.MenuItemType.BUTTON}}function Rt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-ext",icon:te,type:h.MenuItemType.BUTTON}}function Mt(e){return{id:B.id,title:"sheets-sort.general.sort-custom",type:h.MenuItemType.BUTTON,icon:ne}}function Et(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 Tt(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 Pt(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 bt(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 kt(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 wt(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 Ot={[h.RibbonStartGroup.FORMULAS_INSERT]:{[Ce]:{order:2,menuItemFactory:It,[H.id]:{order:0,menuItemFactory:yt},[U.id]:{order:1,menuItemFactory:xt},[$.id]:{order:2,menuItemFactory:_t},[A.id]:{order:3,menuItemFactory:Rt},[B.id]:{order:4,menuItemFactory:Mt}}},[h.ContextMenuPosition.MAIN_AREA]:{[h.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:Et,[F.id]:{order:0,menuItemFactory:Tt},[W.id]:{order:1,menuItemFactory:Pt},[V.id]:{order:2,menuItemFactory:bt},[z.id]:{order:3,menuItemFactory:kt},[Z.id]:{order:4,menuItemFactory:wt}}}}};var Dt=Object.getOwnPropertyDescriptor,Nt=(e,t,n,r)=>{for(var o=r>1?void 0:r?Dt(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",jt=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(Ot)}_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",Ct)),this.disposeWithMe(this._uiPartsService.registerComponent(P.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>h.connectInjector(pt,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:jt,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:Lt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(se),queueMicrotask(()=>this._layoutService.focus())}};L=Nt([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 Lt(){return{x:0,y:0}}var Ht=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,$t=(e,t,n)=>t in e?Ht(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,At=(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},ie=(e,t)=>(n,r)=>t(n,r,e),ve=(e,t,n)=>$t(e,typeof t!="symbol"?t+"":t,n);const Bt="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",Bt);exports.UniverSheetsSortUIPlugin=At([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;
package/lib/es/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  var Ve = Object.defineProperty;
2
2
  var ze = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var K = (e, t, n) => ze(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { LocaleService as A, IUniverInstanceService as ye, ILogService as Ze, Inject as T, ICommandService as Me, Disposable as Ge, UniverInstanceType as Y, Tools as We, LocaleType as J, CommandType as b, throttle as Ye, Injector as xe, RxDisposable as qe, DependentOn as Xe, IConfigService as Ke, Plugin as Je, merge as Qe } from "@univerjs/core";
4
+ import { LocaleService as A, IUniverInstanceService as ye, ILogService as Ze, Inject as E, ICommandService as xe, Disposable as Ge, UniverInstanceType as Y, Tools as We, LocaleType as J, CommandType as b, throttle as Ye, Injector as Me, RxDisposable as qe, DependentOn as Xe, IConfigService as Ke, Plugin as Je, merge as Qe } from "@univerjs/core";
5
5
  import { SheetsSortService as Re, SortType as U, SortRangeCommand as et, UniverSheetsSortPlugin as tt } from "@univerjs/sheets-sort";
6
6
  import { serializeRange as nt } from "@univerjs/engine-formula";
7
- import { getCurrentRangeDisable$ as N, getCurrentExclusiveRangeInterest$ as rt, SheetsRenderService as ot, SheetsUIPart as st } from "@univerjs/sheets-ui";
7
+ import { getCurrentRangeDisable$ as P, getCurrentExclusiveRangeInterest$ as rt, SheetsRenderService as ot, SheetsUIPart as st } from "@univerjs/sheets-ui";
8
8
  import { useDependency as O, IConfirmService as it, MenuItemType as p, getMenuHiddenObservable as be, ContextMenuPosition as ct, ContextMenuGroup as at, RibbonStartGroup as lt, IMenuManagerService as dt, IDialogService as ut, ILayoutService as mt, IUIPartsService as ht, ComponentManager as gt, connectInjector as Ct } from "@univerjs/ui";
9
9
  import { BehaviorSubject as St, takeUntil as ft } from "rxjs";
10
10
  import { jsxs as g, jsx as a } from "react/jsx-runtime";
11
11
  import { SheetsSelectionsService as vt, getPrimaryForRange as pt, SetSelectionsOperation as _t, expandToContinuousRange as fe, getSheetCommandTarget as It, RangeProtectionPermissionEditPoint as k, WorksheetSortPermission as L, WorksheetEditPermission as D, WorkbookEditablePermission as H } from "@univerjs/sheets";
12
- import { RadioGroup as Te, Radio as Z, Checkbox as yt, DraggableList as Mt, Button as ve, DropdownLegacy as xt } from "@univerjs/design";
13
- import { forwardRef as I, useRef as Ee, createElement as y, useState as F, useCallback as P, useEffect as Oe } from "react";
12
+ import { RadioGroup as Ee, Radio as Z, Checkbox as yt, DraggableList as xt, Button as ve, DropdownLegacy as Mt } from "@univerjs/design";
13
+ import { forwardRef as I, useRef as Te, createElement as y, useState as F, useCallback as N, useEffect as Oe } from "react";
14
14
  const Rt = "sheets-sort-ui.config", pe = {};
15
15
  var v = function() {
16
16
  return v = Object.assign || function(e) {
@@ -27,25 +27,28 @@ var v = function() {
27
27
  for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
28
28
  t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
29
29
  return n;
30
- }, M = I(function(e, t) {
31
- var n = e.icon, r = e.id, o = e.className, s = e.extend, i = bt(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), u = Ee("_".concat(Ot()));
30
+ }, x = I(function(e, t) {
31
+ var n = e.icon, r = e.id, o = e.className, s = e.extend, i = bt(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), u = Te("_".concat(Ot()));
32
32
  return we(n, "".concat(r), { defIds: n.defIds, idSuffix: u.current }, v({ ref: t, className: l }, i), s);
33
33
  });
34
34
  function we(e, t, n, r, o) {
35
- return y(e.tag, v(v({ key: t }, Tt(e, n, o)), r), (Et(e, n).children || []).map(function(s, i) {
35
+ return y(e.tag, v(v({ key: t }, Et(e, n, o)), r), (Tt(e, n).children || []).map(function(s, i) {
36
36
  return we(s, "".concat(t, "-").concat(e.tag, "-").concat(i), n, void 0, o);
37
37
  }));
38
38
  }
39
- function Tt(e, t, n) {
39
+ function Et(e, t, n) {
40
40
  var r = v({}, e.attrs);
41
- n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
41
+ 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) {
42
+ var i = s[0], l = s[1];
43
+ i === "mask" && typeof l == "string" && (r[i] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
44
+ });
42
45
  var o = t.defIds;
43
46
  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) {
44
47
  var i = s[0], l = s[1];
45
48
  typeof l == "string" && (r[i] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
46
49
  })), r;
47
50
  }
48
- function Et(e, t) {
51
+ function Tt(e, t) {
49
52
  var n, r = t.defIds;
50
53
  return !r || r.length === 0 ? e : e.tag === "defs" && (!((n = e.children) === null || n === void 0) && n.length) ? v(v({}, e), { children: e.children.map(function(o) {
51
54
  return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? v(v({}, o), { attrs: v(v({}, o.attrs), { id: o.attrs.id + t.idSuffix }) }) : o;
@@ -54,33 +57,33 @@ function Et(e, t) {
54
57
  function Ot() {
55
58
  return Math.random().toString(36).substring(2, 8);
56
59
  }
57
- M.displayName = "UniverIcon";
60
+ x.displayName = "UniverIcon";
58
61
  var wt = { 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" } }] }, ee = I(function(e, t) {
59
- return y(M, Object.assign({}, e, {
62
+ return y(x, Object.assign({}, e, {
60
63
  id: "ascending- single",
61
64
  ref: t,
62
65
  icon: wt
63
66
  }));
64
67
  });
65
68
  ee.displayName = "AscendingSingle";
66
- var Pt = { 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" } }] }, Pe = I(function(e, t) {
67
- return y(M, Object.assign({}, e, {
69
+ var Nt = { 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" } }] }, Ne = I(function(e, t) {
70
+ return y(x, Object.assign({}, e, {
68
71
  id: "check-mark-single",
69
72
  ref: t,
70
- icon: Pt
73
+ icon: Nt
71
74
  }));
72
75
  });
73
- Pe.displayName = "CheckMarkSingle";
74
- var Nt = { 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" } }] }, Ne = I(function(e, t) {
75
- return y(M, Object.assign({}, e, {
76
+ Ne.displayName = "CheckMarkSingle";
77
+ var Pt = { 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" } }] }, Pe = I(function(e, t) {
78
+ return y(x, Object.assign({}, e, {
76
79
  id: "custom-sort-single",
77
80
  ref: t,
78
- icon: Nt
81
+ icon: Pt
79
82
  }));
80
83
  });
81
- Ne.displayName = "CustomSortSingle";
84
+ Pe.displayName = "CustomSortSingle";
82
85
  var kt = { 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" } }] }, ke = I(function(e, t) {
83
- return y(M, Object.assign({}, e, {
86
+ return y(x, Object.assign({}, e, {
84
87
  id: "delete-empty-single",
85
88
  ref: t,
86
89
  icon: kt
@@ -88,7 +91,7 @@ var kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
88
91
  });
89
92
  ke.displayName = "DeleteEmptySingle";
90
93
  var Lt = { 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" } }] }, te = I(function(e, t) {
91
- return y(M, Object.assign({}, e, {
94
+ return y(x, Object.assign({}, e, {
92
95
  id: "descending-single",
93
96
  ref: t,
94
97
  icon: Lt
@@ -96,7 +99,7 @@ var Lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
96
99
  });
97
100
  te.displayName = "DescendingSingle";
98
101
  var Dt = { 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" } }] }, Le = I(function(e, t) {
99
- return y(M, Object.assign({}, e, {
102
+ return y(x, Object.assign({}, e, {
100
103
  id: "expand-ascending-single",
101
104
  ref: t,
102
105
  icon: Dt
@@ -104,7 +107,7 @@ var Dt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
104
107
  });
105
108
  Le.displayName = "ExpandAscendingSingle";
106
109
  var Ht = { 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" } }] }, De = I(function(e, t) {
107
- return y(M, Object.assign({}, e, {
110
+ return y(x, Object.assign({}, e, {
108
111
  id: "expand-descending-single",
109
112
  ref: t,
110
113
  icon: Ht
@@ -112,7 +115,7 @@ var Ht = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
112
115
  });
113
116
  De.displayName = "ExpandDescendingSingle";
114
117
  var Ut = { 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" } }] }, Q = I(function(e, t) {
115
- return y(M, Object.assign({}, e, {
118
+ return y(x, Object.assign({}, e, {
116
119
  id: "increase-single",
117
120
  ref: t,
118
121
  icon: Ut
@@ -120,7 +123,7 @@ var Ut = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
120
123
  });
121
124
  Q.displayName = "IncreaseSingle";
122
125
  var At = { 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" } }] }, He = I(function(e, t) {
123
- return y(M, Object.assign({}, e, {
126
+ return y(x, Object.assign({}, e, {
124
127
  id: "more-down-single",
125
128
  ref: t,
126
129
  icon: At
@@ -128,7 +131,7 @@ var At = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em"
128
131
  });
129
132
  He.displayName = "MoreDownSingle";
130
133
  var $t = { 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" } }] }] }, Ue = I(function(e, t) {
131
- return y(M, Object.assign({}, e, {
134
+ return y(x, Object.assign({}, e, {
132
135
  id: "sequence-single",
133
136
  ref: t,
134
137
  icon: $t
@@ -168,7 +171,7 @@ const Bt = "univer-extend-confirm-content", Ft = "univer-extend-confirm-radio-gr
168
171
  return /* @__PURE__ */ g("div", { className: c.extendConfirmContent, children: [
169
172
  /* @__PURE__ */ a("div", { className: "extend-confirm-desc", children: r.t("sheets-sort.dialog.sort-reminder-desc") }),
170
173
  /* @__PURE__ */ g(
171
- Te,
174
+ Ee,
172
175
  {
173
176
  className: c.extendConfirmRadioGroup,
174
177
  value: t,
@@ -239,12 +242,12 @@ let C = class extends Ge {
239
242
  const l = fn(this._localeService);
240
243
  return Array.from(
241
244
  { length: s.endColumn - s.startColumn + 1 },
242
- (x, f) => {
245
+ (M, f) => {
243
246
  var S;
244
- const E = (S = i.getCell(s.startRow, f + s.startColumn)) == null ? void 0 : S.v;
247
+ const T = (S = i.getCell(s.startRow, f + s.startColumn)) == null ? void 0 : S.v;
245
248
  return {
246
249
  index: f + s.startColumn,
247
- label: t ? `${E != null ? E : l(f + s.startColumn)}` : l(f + s.startColumn)
250
+ label: t ? `${T != null ? T : l(f + s.startColumn)}` : l(f + s.startColumn)
248
251
  };
249
252
  }
250
253
  );
@@ -328,10 +331,10 @@ C = Sn([
328
331
  w(0, ye),
329
332
  w(1, it),
330
333
  w(2, Ze),
331
- w(3, T(vt)),
332
- w(4, T(Re)),
333
- w(5, T(A)),
334
- w(6, Me)
334
+ w(3, E(vt)),
335
+ w(4, E(Re)),
336
+ w(5, E(A)),
337
+ w(6, xe)
335
338
  ], C);
336
339
  function fn(e) {
337
340
  return (t) => {
@@ -388,31 +391,31 @@ const ne = {
388
391
  handler: async (e) => await e.get(C).triggerSortCustomize()
389
392
  };
390
393
  function vn() {
391
- const e = O(C), t = O(Re), n = O(A), [r, o] = F(!1), [s, i] = F(0), l = Ee(null), u = e.customSortState();
394
+ const e = O(C), t = O(Re), n = O(A), [r, o] = F(!1), [s, i] = F(0), l = Te(null), u = e.customSortState();
392
395
  if (!u || !u.location)
393
396
  return null;
394
- const { range: m, unitId: x, subUnitId: f } = u.location, E = e.getTitles(r), [S, $] = F([
397
+ const { range: m, unitId: M, subUnitId: f } = u.location, T = e.getTitles(r), [S, $] = F([
395
398
  { type: U.ASC, colIndex: m.startColumn }
396
- ]), q = P((d, _) => {
399
+ ]), q = N((d, _) => {
397
400
  const B = [...S];
398
401
  _ === null ? B.splice(d, 1) : B[d] = _, $(B);
399
- }, [S]), V = P(
402
+ }, [S]), V = N(
400
403
  Ye(() => {
401
404
  const d = [...S], _ = _n(m, S);
402
405
  _ !== null && (d.push({ type: U.ASC, colIndex: _ }), $(d));
403
406
  }, 200),
404
407
  [S, m]
405
- ), h = P((d, _) => {
408
+ ), h = N((d, _) => {
406
409
  t.applySort({ range: m, orderRules: d, hasTitle: _ }), e.closeCustomSortPanel();
407
- }, [t, e, m]), X = P(() => {
410
+ }, [t, e, m]), X = N(() => {
408
411
  e.closeCustomSortPanel();
409
- }, [e]), Fe = P((d) => {
410
- o(d), d ? e.setSelection(x, f, { ...m, startRow: m.startRow + 1 }) : e.setSelection(x, f, m);
411
- }, [e, m, f, x]);
412
+ }, [e]), Fe = N((d) => {
413
+ o(d), d ? e.setSelection(M, f, { ...m, startRow: m.startRow + 1 }) : e.setSelection(M, f, m);
414
+ }, [e, m, f, M]);
412
415
  Oe(() => {
413
416
  l.current && S.length > 5 && (l.current.scrollTop = l.current.scrollHeight);
414
417
  }, [S]);
415
- const je = S.length < E.length, Se = S.map((d) => ({ ...d, id: `${d.colIndex}` }));
418
+ const je = S.length < T.length, Se = S.map((d) => ({ ...d, id: `${d.colIndex}` }));
416
419
  return /* @__PURE__ */ g("div", { className: c.customSortPanelContainer, children: [
417
420
  /* @__PURE__ */ g("div", { className: c.customSortPanelContent, onMouseDown: (d) => {
418
421
  d.stopPropagation();
@@ -446,7 +449,7 @@ function vn() {
446
449
  },
447
450
  ref: l,
448
451
  children: /* @__PURE__ */ a(
449
- Mt,
452
+ xt,
450
453
  {
451
454
  list: Se,
452
455
  onListChange: $,
@@ -455,7 +458,7 @@ function vn() {
455
458
  itemRender: (d) => /* @__PURE__ */ a(
456
459
  pn,
457
460
  {
458
- titles: E,
461
+ titles: T,
459
462
  list: Se,
460
463
  item: d,
461
464
  onChange: (_, B) => q(B, _),
@@ -477,9 +480,9 @@ function vn() {
477
480
  }
478
481
  function pn(e) {
479
482
  var V;
480
- const { list: t, item: n, titles: r, onChange: o, scrollPosition: s } = e, i = O(A), l = r.filter((h) => !t.some((X) => X.colIndex === h.index) || h.index === n.colIndex), u = t.findIndex((h) => h.colIndex === n.colIndex), m = P((h) => {
483
+ const { list: t, item: n, titles: r, onChange: o, scrollPosition: s } = e, i = O(A), l = r.filter((h) => !t.some((X) => X.colIndex === h.index) || h.index === n.colIndex), u = t.findIndex((h) => h.colIndex === n.colIndex), m = N((h) => {
481
484
  o({ ...n, colIndex: h.index }, u), f(!1);
482
- }, [u, n, o]), [x, f] = F(!1), E = (h) => {
485
+ }, [u, n, o]), [M, f] = F(!1), T = (h) => {
483
486
  f(h);
484
487
  };
485
488
  Oe(() => {
@@ -490,12 +493,12 @@ function pn(e) {
490
493
  /* @__PURE__ */ g("div", { className: c.customSortPanelItemHead, children: [
491
494
  /* @__PURE__ */ a("div", { className: c.customSortPanelItemHandler, children: /* @__PURE__ */ a(Ue, {}) }),
492
495
  /* @__PURE__ */ a("div", { className: c.customSortPanelItemColumn, children: /* @__PURE__ */ a(
493
- xt,
496
+ Mt,
494
497
  {
495
498
  placement: "bottomLeft",
496
499
  trigger: ["click"],
497
- visible: x,
498
- onVisibleChange: E,
500
+ visible: M,
501
+ onVisibleChange: T,
499
502
  overlay: /* @__PURE__ */ a("ul", { className: c.customSortColMenu, children: l.map((h) => /* @__PURE__ */ g(
500
503
  "li",
501
504
  {
@@ -503,7 +506,7 @@ function pn(e) {
503
506
  className: c.customSortColMenuItem,
504
507
  children: [
505
508
  /* @__PURE__ */ a("span", { className: c.customSortColMenuItemDesc, children: h.label }),
506
- /* @__PURE__ */ a("span", { className: c.customSortColMenuItemCheck, children: h.index === n.colIndex && /* @__PURE__ */ a(Pe, {}) })
509
+ /* @__PURE__ */ a("span", { className: c.customSortColMenuItemCheck, children: h.index === n.colIndex && /* @__PURE__ */ a(Ne, {}) })
507
510
  ]
508
511
  },
509
512
  h.index
@@ -516,7 +519,7 @@ function pn(e) {
516
519
  ) })
517
520
  ] }),
518
521
  /* @__PURE__ */ a("div", { className: c.customSortPanelItemOrder, children: /* @__PURE__ */ g(
519
- Te,
522
+ Ee,
520
523
  {
521
524
  className: q,
522
525
  value: n.type,
@@ -540,13 +543,13 @@ function _n(e, t) {
540
543
  return null;
541
544
  }
542
545
  function In(e) {
543
- const { range: t, colIndex: n, onClose: r } = e, o = O(C), s = O(ye), i = O(A), l = P((u) => {
544
- const { unitId: m, subUnitId: x } = It(s) || {};
545
- if (t && m && x) {
546
+ const { range: t, colIndex: n, onClose: r } = e, o = O(C), s = O(ye), i = O(A), l = N((u) => {
547
+ const { unitId: m, subUnitId: M } = It(s) || {};
548
+ if (t && m && M) {
546
549
  const f = { ...t, startRow: t.startRow + 1 };
547
- o.triggerSortDirectly(u, !1, { unitId: m, subUnitId: x, range: f, colIndex: n });
550
+ o.triggerSortDirectly(u, !1, { unitId: m, subUnitId: M, range: f, colIndex: n });
548
551
  } else
549
- console.warn(`Cannot find the target to sort. unitId: ${m}, subUnitId: ${x}, range: ${t}, colIndex: ${n}`);
552
+ console.warn(`Cannot find the target to sort. unitId: ${m}, subUnitId: ${M}, range: ${t}, colIndex: ${n}`);
550
553
  r();
551
554
  }, [t, n, o, s, r]);
552
555
  return /* @__PURE__ */ g("div", { className: c.embedSortBtnContainer, children: [
@@ -588,10 +591,10 @@ function yn(e) {
588
591
  icon: j,
589
592
  tooltip: "sheets-sort.general.sort",
590
593
  hidden$: be(e, Y.UNIVER_SHEET),
591
- disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
594
+ disabled$: P(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
592
595
  };
593
596
  }
594
- function Mn(e) {
597
+ function xn(e) {
595
598
  return {
596
599
  id: ne.id,
597
600
  icon: j,
@@ -600,7 +603,7 @@ function Mn(e) {
600
603
  hidden$: rt(e)
601
604
  };
602
605
  }
603
- function xn(e) {
606
+ function Mn(e) {
604
607
  return {
605
608
  id: re.id,
606
609
  title: "sheets-sort.general.sort-asc-ext",
@@ -624,7 +627,7 @@ function bn(e) {
624
627
  type: p.BUTTON
625
628
  };
626
629
  }
627
- function Tn(e) {
630
+ function En(e) {
628
631
  return {
629
632
  id: ie.id,
630
633
  title: "sheets-sort.general.sort-custom",
@@ -632,14 +635,14 @@ function Tn(e) {
632
635
  icon: Ce
633
636
  };
634
637
  }
635
- function En(e) {
638
+ function Tn(e) {
636
639
  return {
637
640
  id: $e,
638
641
  title: "sheets-sort.general.sort",
639
642
  type: p.SUBITEMS,
640
643
  icon: j,
641
644
  hidden$: be(e, Y.UNIVER_SHEET),
642
- disabled$: N(e, {
645
+ disabled$: P(e, {
643
646
  workbookTypes: [H],
644
647
  worksheetTypes: [L, D],
645
648
  rangeTypes: [k]
@@ -652,7 +655,7 @@ function On(e) {
652
655
  title: "sheets-sort.general.sort-asc-cur",
653
656
  type: p.BUTTON,
654
657
  icon: j,
655
- disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
658
+ disabled$: P(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
656
659
  };
657
660
  }
658
661
  function wn(e) {
@@ -661,25 +664,25 @@ function wn(e) {
661
664
  title: "sheets-sort.general.sort-asc-ext",
662
665
  type: p.BUTTON,
663
666
  icon: me,
664
- disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
667
+ disabled$: P(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
665
668
  };
666
669
  }
667
- function Pn(e) {
670
+ function Nn(e) {
668
671
  return {
669
672
  id: le.id,
670
673
  title: "sheets-sort.general.sort-desc-cur",
671
674
  type: p.BUTTON,
672
675
  icon: he,
673
- disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
676
+ disabled$: P(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
674
677
  };
675
678
  }
676
- function Nn(e) {
679
+ function Pn(e) {
677
680
  return {
678
681
  id: de.id,
679
682
  title: "sheets-sort.general.sort-desc-ext",
680
683
  type: p.BUTTON,
681
684
  icon: ge,
682
- disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
685
+ disabled$: P(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
683
686
  };
684
687
  }
685
688
  function kn(e) {
@@ -688,7 +691,7 @@ function kn(e) {
688
691
  title: "sheets-sort.general.sort-custom",
689
692
  type: p.BUTTON,
690
693
  icon: Ce,
691
- disabled$: N(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
694
+ disabled$: P(e, { workbookTypes: [H], worksheetTypes: [L, D], rangeTypes: [k] })
692
695
  };
693
696
  }
694
697
  const Ln = {
@@ -698,11 +701,11 @@ const Ln = {
698
701
  menuItemFactory: yn,
699
702
  [ne.id]: {
700
703
  order: 0,
701
- menuItemFactory: Mn
704
+ menuItemFactory: xn
702
705
  },
703
706
  [re.id]: {
704
707
  order: 1,
705
- menuItemFactory: xn
708
+ menuItemFactory: Mn
706
709
  },
707
710
  [oe.id]: {
708
711
  order: 2,
@@ -714,7 +717,7 @@ const Ln = {
714
717
  },
715
718
  [ie.id]: {
716
719
  order: 4,
717
- menuItemFactory: Tn
720
+ menuItemFactory: En
718
721
  }
719
722
  }
720
723
  },
@@ -722,7 +725,7 @@ const Ln = {
722
725
  [at.DATA]: {
723
726
  [$e]: {
724
727
  order: 0,
725
- menuItemFactory: En,
728
+ menuItemFactory: Tn,
726
729
  [ce.id]: {
727
730
  order: 0,
728
731
  menuItemFactory: On
@@ -733,11 +736,11 @@ const Ln = {
733
736
  },
734
737
  [le.id]: {
735
738
  order: 2,
736
- menuItemFactory: Pn
739
+ menuItemFactory: Nn
737
740
  },
738
741
  [de.id]: {
739
742
  order: 3,
740
- menuItemFactory: Nn
743
+ menuItemFactory: Pn
741
744
  },
742
745
  [ue.id]: {
743
746
  order: 4,
@@ -775,7 +778,7 @@ let G = class extends qe {
775
778
  ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e))), this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(et.id));
776
779
  }
777
780
  _initUI() {
778
- this.disposeWithMe(this._componentManager.register("CustomSortPanel", vn)), this.disposeWithMe(this._uiPartsService.registerComponent(st.FILTER_PANEL_EMBED_POINT, () => Ct(In, this._injector))), this.disposeWithMe(this._componentManager.register(j, ee)), this.disposeWithMe(this._componentManager.register(me, Le)), this.disposeWithMe(this._componentManager.register(he, te)), this.disposeWithMe(this._componentManager.register(ge, De)), this.disposeWithMe(this._componentManager.register(Ce, Ne)), this._sheetsSortUIService.customSortState$.pipe(ft(this.dispose$)).subscribe((e) => {
781
+ this.disposeWithMe(this._componentManager.register("CustomSortPanel", vn)), this.disposeWithMe(this._uiPartsService.registerComponent(st.FILTER_PANEL_EMBED_POINT, () => Ct(In, this._injector))), this.disposeWithMe(this._componentManager.register(j, ee)), this.disposeWithMe(this._componentManager.register(me, Le)), this.disposeWithMe(this._componentManager.register(he, te)), this.disposeWithMe(this._componentManager.register(ge, De)), this.disposeWithMe(this._componentManager.register(Ce, Pe)), this._sheetsSortUIService.customSortState$.pipe(ft(this.dispose$)).subscribe((e) => {
779
782
  e && e.show && e.location ? this._openCustomSortPanel(e.location) : e && !(e != null && e.show) && this._closePanel();
780
783
  });
781
784
  }
@@ -798,16 +801,16 @@ let G = class extends qe {
798
801
  }
799
802
  };
800
803
  G = Hn([
801
- R(0, Me),
804
+ R(0, xe),
802
805
  R(1, dt),
803
806
  R(2, ut),
804
807
  R(3, mt),
805
808
  R(4, ht),
806
- R(5, T(ot)),
807
- R(6, T(A)),
808
- R(7, T(C)),
809
- R(8, T(xe)),
810
- R(9, T(gt))
809
+ R(5, E(ot)),
810
+ R(6, E(A)),
811
+ R(7, E(C)),
812
+ R(8, E(Me)),
813
+ R(9, E(gt))
811
814
  ], G);
812
815
  function An() {
813
816
  return { x: 0, y: 0 };
@@ -842,7 +845,7 @@ Be(W, "type", Y.UNIVER_SHEET);
842
845
  Be(W, "pluginName", Vn);
843
846
  W = jn([
844
847
  Xe(tt),
845
- Ie(1, T(xe)),
848
+ Ie(1, E(Me)),
846
849
  Ie(2, Ke)
847
850
  ], W);
848
851
  export {
package/lib/umd/index.js CHANGED
@@ -1,10 +1,10 @@
1
- (function(u,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets-sort"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/sheets"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react/jsx-runtime","@univerjs/sheets","@univerjs/design","react"],s):(u=typeof globalThis<"u"?globalThis:u||self,s(u.UniverSheetsSortUi={},u.UniverCore,u.UniverSheetsSort,u.UniverEngineFormula,u.UniverSheetsUi,u.UniverUi,u.rxjs,u.React,u.UniverSheets,u.UniverDesign,u.React))})(this,function(u,s,I,Ie,E,S,oe,a,m,P,l){"use strict";var Ct=Object.defineProperty;var gt=(u,s,I)=>s in u?Ct(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>gt(u,typeof s!="symbol"?s+"":s,I);const ye="sheets-sort-ui.config",se={};var M=function(){return M=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},M.apply(this,arguments)},_e=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},T=l.forwardRef(function(e,t){var n=e.icon,r=e.id,o=e.className,i=e.extend,c=_e(e,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(r," ").concat(o||"").trim(),h=l.useRef("_".concat(Te()));return ie(n,"".concat(r),{defIds:n.defIds,idSuffix:h.current},M({ref:t,className:C},c),i)});function ie(e,t,n,r,o){return l.createElement(e.tag,M(M({key:t},Me(e,n,o)),r),(Pe(e,n).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),n,void 0,o)}))}function Me(e,t,n){var r=M({},e.attrs);n!=null&&n.colorChannel1&&r.fill==="colorChannel1"&&(r.fill=n.colorChannel1);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(i){var c=i[0],C=i[1];typeof C=="string"&&(r[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),r}function Pe(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)?M(M({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&r&&r.indexOf(o.attrs.id)>-1?M(M({},o),{attrs:M(M({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function Te(){return Math.random().toString(36).substring(2,8)}T.displayName="UniverIcon";var xe={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"}}]},q=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"ascending- single",ref:t,icon:xe}))});q.displayName="AscendingSingle";var Ee={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"}}]},ae=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"check-mark-single",ref:t,icon:Ee}))});ae.displayName="CheckMarkSingle";var be={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"}}]},ce=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:be}))});ce.displayName="CustomSortSingle";var Re={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"}}]},le=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:Re}))});le.displayName="DeleteEmptySingle";var ke={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"}}]},Y=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"descending-single",ref:t,icon:ke}))});Y.displayName="DescendingSingle";var we={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"}}]},de=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:we}))});de.displayName="ExpandAscendingSingle";var Oe={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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Oe}))});ue.displayName="ExpandDescendingSingle";var De={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(T,Object.assign({},e,{id:"increase-single",ref:t,icon:De}))});X.displayName="IncreaseSingle";var Ne={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"}}]},me=l.forwardRef(function(e,t){return l.createElement(T,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ne}))});me.displayName="MoreDownSingle";var Le={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(T,Object.assign({},e,{id:"sequence-single",ref:t,icon:Le}))});Se.displayName="SequenceSingle";const d={extendConfirmContent:"univer-extend-confirm-content",extendConfirmRadioGroup:"univer-extend-confirm-radio-group",customSortPanelContainer:"univer-custom-sort-panel-container",customSortPanelExt:"univer-custom-sort-panel-ext",addCondition:"univer-add-condition",addConditionText:"univer-add-condition-text",addConditionDisable:"univer-add-condition-disable",customSortPanelFooter:"univer-custom-sort-panel-footer",customSortPanelFooterBtn:"univer-custom-sort-panel-footer-btn",customSortPanelItem:"univer-custom-sort-panel-item",customSortPanelItemHead:"univer-custom-sort-panel-item-head",customSortPanelItemHandler:"univer-custom-sort-panel-item-handler",customSortPanelItemRemove:"univer-custom-sort-panel-item-remove",customSortPanelItemColumnInput:"univer-custom-sort-panel-item-column-input",customSortPanelItemColumnInputDropdown:"univer-custom-sort-panel-item-column-input-dropdown",customSortPanelItemColumnInputText:"univer-custom-sort-panel-item-column-input-text",customSortPanelItemOrderRadio:"univer-custom-sort-panel-item-order-radio",customSortPanelItemOrderRadioCn:"univer-custom-sort-panel-item-order-radio-cn",conditionList:"univer-condition-list",embedSortBtnContainer:"univer-embed-sort-btn-container",embedSortBtn:"univer-embed-sort-btn",embedSortBtnAsc:"univer-embed-sort-btn-asc",embedSortBtnDesc:"univer-embed-sort-btn-desc",embedSortBtnIcon:"univer-embed-sort-btn-icon",customSortColMenu:"univer-custom-sort-col-menu",customSortColMenuItem:"univer-custom-sort-col-menu-item",customSortColMenuItemDesc:"univer-custom-sort-col-menu-item-desc"},He=e=>{const[t,n]=l.useState("0"),r=S.useDependency(s.LocaleService);return a.jsxs("div",{className:d.extendConfirmContent,children:[a.jsx("div",{className:"extend-confirm-desc",children:r.t("sheets-sort.dialog.sort-reminder-desc")}),a.jsxs(P.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:o=>{n(o),e.onChange(o)},children:[a.jsx(P.Radio,{value:"0",children:r.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(P.Radio,{value:"1",children:r.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ue=Object.getOwnPropertyDescriptor,Ae=(e,t,n,r)=>{for(var o=r>1?void 0:r?Ue(t,n):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(o=c(o)||o);return o},w=(e,t)=>(n,r)=>t(n,r,e);const L={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(t,n,r,o,i,c,C){super();re(this,"_customSortState$",new oe.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=n,this._logService=r,this._selectionManagerService=o,this._sheetsSortService=i,this._localeService=c,this._commandService=C}async triggerSortDirectly(t,n,r){const o=r||await this._detectSortLocation(n);if(!o||!this._check(o))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.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 h,f;const n=(h=this.customSortState())==null?void 0:h.location;if(!n)return[];const{unitId:r,subUnitId:o,range:i}=n,c=(f=this._univerInstanceService.getUnit(r))==null?void 0:f.getSheetBySheetId(o);if(!c)return[];const C=je(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(R,_)=>{var y;const k=(y=c.getCell(i.startRow,_+i.startColumn))==null?void 0:y.v;return{index:_+i.startColumn,label:t?`${k!=null?k:C(_+i.startColumn)}`:C(_+i.startColumn)}})}setSelection(t,n,r){var c;const o=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(n);if(!o)return;const i={unitId:t,subUnitId:n,selections:[{range:r,primary:m.getPrimaryForRange(r,o),style:null}]};this._commandService.executeCommand(m.SetSelectionsOperation.id,i)}async showCheckError(t){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:a.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:a.jsx(He,{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(L.EMPTY_ERROR),!1):(this.showCheckError(L.FORMULA_ARRAY),!1):(this.showCheckError(L.MERGE_ERROR),!1):(this.showCheckError(L.SINGLE_ERROR),!1)}async _detectSortLocation(t){const n=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),r=n.getActiveSheet(),o=n.getUnitId(),i=r.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let C;if(t===!0)C=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,i,C);else if(t===!1)C=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?C=c.range:(C=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},r),this.setSelection(o,i,C))}return{range:C,unitId:o,subUnitId:i,colIndex:c.primary.actualColumn}}};p=Ae([w(0,s.IUniverInstanceService),w(1,S.IConfirmService),w(2,s.ILogService),w(3,s.Inject(m.SheetsSelectionsService)),w(4,s.Inject(I.SheetsSortService)),w(5,s.Inject(s.LocaleService)),w(6,s.ICommandService)],p);function je(e){return t=>{const n=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${n}"列`;case s.LocaleType.EN_US:return`Column "${n}"`;default:return`Column "${n}"`}}}const H={id:"sheet.command.sort-range-asc",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},U={id:"sheet.command.sort-range-asc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},A={id:"sheet.command.sort-range-desc",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},j={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},$={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},B={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},F={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},W={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},V={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},z={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function $e(){const e=S.useDependency(p),t=S.useDependency(I.SheetsSortService),n=S.useDependency(s.LocaleService),[r,o]=l.useState(!1),[i,c]=l.useState(0),C=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:R,subUnitId:_}=h.location,k=e.getTitles(r),[y,D]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),te=l.useCallback((g,x)=>{const N=[...y];x===null?N.splice(g,1):N[g]=x,D(N)},[y]),G=l.useCallback(s.throttle(()=>{const g=[...y],x=Fe(f,y);x!==null&&(g.push({type:I.SortType.ASC,colIndex:x}),D(g))},200),[y,f]),v=l.useCallback((g,x)=>{t.applySort({range:f,orderRules:g,hasTitle:x}),e.closeCustomSortPanel()},[t,e,f]),ne=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),mt=l.useCallback(g=>{o(g),g?e.setSelection(R,_,{...f,startRow:f.startRow+1}):e.setSelection(R,_,f)},[e,f,_,R]);l.useEffect(()=>{C.current&&y.length>5&&(C.current.scrollTop=C.current.scrollHeight)},[y]);const St=y.length<k.length,pe=y.map(g=>({...g,id:`${g.colIndex}`}));return a.jsxs("div",{className:d.customSortPanelContainer,children:[a.jsxs("div",{className:d.customSortPanelContent,onMouseDown:g=>{g.stopPropagation()},children:[a.jsxs("div",{className:d.customSortPanelExt,children:[a.jsx("div",{className:d.firstRowCheck,children:a.jsx(P.Checkbox,{checked:r,onChange:g=>mt(!!g),children:n.t("sheets-sort.dialog.first-row-check")})}),St?a.jsxs("div",{className:d.addCondition,onClick:G,children:[a.jsx(X,{}),a.jsx("span",{className:d.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`
1
+ (function(u,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/sheets-sort"),require("@univerjs/engine-formula"),require("@univerjs/sheets-ui"),require("@univerjs/ui"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/sheets"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react/jsx-runtime","@univerjs/sheets","@univerjs/design","react"],s):(u=typeof globalThis<"u"?globalThis:u||self,s(u.UniverSheetsSortUi={},u.UniverCore,u.UniverSheetsSort,u.UniverEngineFormula,u.UniverSheetsUi,u.UniverUi,u.rxjs,u.React,u.UniverSheets,u.UniverDesign,u.React))})(this,function(u,s,I,Ie,E,S,oe,a,m,P,l){"use strict";var Ct=Object.defineProperty;var gt=(u,s,I)=>s in u?Ct(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>gt(u,typeof s!="symbol"?s+"":s,I);const ye="sheets-sort-ui.config",se={};var M=function(){return M=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},M.apply(this,arguments)},_e=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},x=l.forwardRef(function(e,t){var r=e.icon,n=e.id,o=e.className,i=e.extend,c=_e(e,["icon","id","className","extend"]),C="univerjs-icon univerjs-icon-".concat(n," ").concat(o||"").trim(),h=l.useRef("_".concat(xe()));return ie(r,"".concat(n),{defIds:r.defIds,idSuffix:h.current},M({ref:t,className:C},c),i)});function ie(e,t,r,n,o){return l.createElement(e.tag,M(M({key:t},Me(e,r,o)),n),(Pe(e,r).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),r,void 0,o)}))}function Me(e,t,r){var n=M({},e.attrs);r!=null&&r.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=r.colorChannel1),e.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(i){var c=i[0],C=i[1];c==="mask"&&typeof C=="string"&&(n[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var o=t.defIds;return!o||o.length===0||(e.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(i){var c=i[0],C=i[1];typeof C=="string"&&(n[c]=C.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Pe(e,t){var r,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((r=e.children)===null||r===void 0)&&r.length)?M(M({},e),{children:e.children.map(function(o){return typeof o.attrs.id=="string"&&n&&n.indexOf(o.attrs.id)>-1?M(M({},o),{attrs:M(M({},o.attrs),{id:o.attrs.id+t.idSuffix})}):o})}):e}function xe(){return Math.random().toString(36).substring(2,8)}x.displayName="UniverIcon";var Te={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"}}]},q=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"ascending- single",ref:t,icon:Te}))});q.displayName="AscendingSingle";var Ee={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"}}]},ae=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"check-mark-single",ref:t,icon:Ee}))});ae.displayName="CheckMarkSingle";var be={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"}}]},ce=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:be}))});ce.displayName="CustomSortSingle";var Re={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"}}]},le=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:Re}))});le.displayName="DeleteEmptySingle";var ke={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"}}]},Y=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"descending-single",ref:t,icon:ke}))});Y.displayName="DescendingSingle";var we={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"}}]},de=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:we}))});de.displayName="ExpandAscendingSingle";var Oe={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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Oe}))});ue.displayName="ExpandDescendingSingle";var De={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(x,Object.assign({},e,{id:"increase-single",ref:t,icon:De}))});X.displayName="IncreaseSingle";var Ne={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"}}]},me=l.forwardRef(function(e,t){return l.createElement(x,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ne}))});me.displayName="MoreDownSingle";var Le={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(x,Object.assign({},e,{id:"sequence-single",ref:t,icon:Le}))});Se.displayName="SequenceSingle";const d={extendConfirmContent:"univer-extend-confirm-content",extendConfirmRadioGroup:"univer-extend-confirm-radio-group",customSortPanelContainer:"univer-custom-sort-panel-container",customSortPanelExt:"univer-custom-sort-panel-ext",addCondition:"univer-add-condition",addConditionText:"univer-add-condition-text",addConditionDisable:"univer-add-condition-disable",customSortPanelFooter:"univer-custom-sort-panel-footer",customSortPanelFooterBtn:"univer-custom-sort-panel-footer-btn",customSortPanelItem:"univer-custom-sort-panel-item",customSortPanelItemHead:"univer-custom-sort-panel-item-head",customSortPanelItemHandler:"univer-custom-sort-panel-item-handler",customSortPanelItemRemove:"univer-custom-sort-panel-item-remove",customSortPanelItemColumnInput:"univer-custom-sort-panel-item-column-input",customSortPanelItemColumnInputDropdown:"univer-custom-sort-panel-item-column-input-dropdown",customSortPanelItemColumnInputText:"univer-custom-sort-panel-item-column-input-text",customSortPanelItemOrderRadio:"univer-custom-sort-panel-item-order-radio",customSortPanelItemOrderRadioCn:"univer-custom-sort-panel-item-order-radio-cn",conditionList:"univer-condition-list",embedSortBtnContainer:"univer-embed-sort-btn-container",embedSortBtn:"univer-embed-sort-btn",embedSortBtnAsc:"univer-embed-sort-btn-asc",embedSortBtnDesc:"univer-embed-sort-btn-desc",embedSortBtnIcon:"univer-embed-sort-btn-icon",customSortColMenu:"univer-custom-sort-col-menu",customSortColMenuItem:"univer-custom-sort-col-menu-item",customSortColMenuItemDesc:"univer-custom-sort-col-menu-item-desc"},He=e=>{const[t,r]=l.useState("0"),n=S.useDependency(s.LocaleService);return a.jsxs("div",{className:d.extendConfirmContent,children:[a.jsx("div",{className:"extend-confirm-desc",children:n.t("sheets-sort.dialog.sort-reminder-desc")}),a.jsxs(P.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:o=>{r(o),e.onChange(o)},children:[a.jsx(P.Radio,{value:"0",children:n.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(P.Radio,{value:"1",children:n.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ue=Object.getOwnPropertyDescriptor,je=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ue(t,r):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(o=c(o)||o);return o},w=(e,t)=>(r,n)=>t(r,n,e);const L={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(t,r,n,o,i,c,C){super();re(this,"_customSortState$",new oe.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=r,this._logService=n,this._selectionManagerService=o,this._sheetsSortService=i,this._localeService=c,this._commandService=C}async triggerSortDirectly(t,r,n){const o=n||await this._detectSortLocation(r);if(!o||!this._check(o))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.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 h,f;const r=(h=this.customSortState())==null?void 0:h.location;if(!r)return[];const{unitId:n,subUnitId:o,range:i}=r,c=(f=this._univerInstanceService.getUnit(n))==null?void 0:f.getSheetBySheetId(o);if(!c)return[];const C=Ae(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(R,_)=>{var y;const k=(y=c.getCell(i.startRow,_+i.startColumn))==null?void 0:y.v;return{index:_+i.startColumn,label:t?`${k!=null?k:C(_+i.startColumn)}`:C(_+i.startColumn)}})}setSelection(t,r,n){var c;const o=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(r);if(!o)return;const i={unitId:t,subUnitId:r,selections:[{range:n,primary:m.getPrimaryForRange(n,o),style:null}]};this._commandService.executeCommand(m.SetSelectionsOperation.id,i)}async showCheckError(t){return await this._confirmService.confirm({id:"sort-range-check-error",title:{title:this._localeService.t("info.tooltip")},children:{title:a.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:a.jsx(He,{onChange:n=>{t=n==="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(L.EMPTY_ERROR),!1):(this.showCheckError(L.FORMULA_ARRAY),!1):(this.showCheckError(L.MERGE_ERROR),!1):(this.showCheckError(L.SINGLE_ERROR),!1)}async _detectSortLocation(t){const r=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),n=r.getActiveSheet(),o=r.getUnitId(),i=n.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let C;if(t===!0)C=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(o,i,C);else if(t===!1)C=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?C=c.range:(C=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(o,i,C))}return{range:C,unitId:o,subUnitId:i,colIndex:c.primary.actualColumn}}};p=je([w(0,s.IUniverInstanceService),w(1,S.IConfirmService),w(2,s.ILogService),w(3,s.Inject(m.SheetsSelectionsService)),w(4,s.Inject(I.SheetsSortService)),w(5,s.Inject(s.LocaleService)),w(6,s.ICommandService)],p);function Ae(e){return t=>{const r=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${r}"列`;case s.LocaleType.EN_US:return`Column "${r}"`;default:return`Column "${r}"`}}}const H={id:"sheet.command.sort-range-asc",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},U={id:"sheet.command.sort-range-asc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},j={id:"sheet.command.sort-range-desc",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},A={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},$={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},B={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},F={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},W={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},V={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},z={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function $e(){const e=S.useDependency(p),t=S.useDependency(I.SheetsSortService),r=S.useDependency(s.LocaleService),[n,o]=l.useState(!1),[i,c]=l.useState(0),C=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:R,subUnitId:_}=h.location,k=e.getTitles(n),[y,D]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),te=l.useCallback((g,T)=>{const N=[...y];T===null?N.splice(g,1):N[g]=T,D(N)},[y]),G=l.useCallback(s.throttle(()=>{const g=[...y],T=Fe(f,y);T!==null&&(g.push({type:I.SortType.ASC,colIndex:T}),D(g))},200),[y,f]),v=l.useCallback((g,T)=>{t.applySort({range:f,orderRules:g,hasTitle:T}),e.closeCustomSortPanel()},[t,e,f]),ne=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),mt=l.useCallback(g=>{o(g),g?e.setSelection(R,_,{...f,startRow:f.startRow+1}):e.setSelection(R,_,f)},[e,f,_,R]);l.useEffect(()=>{C.current&&y.length>5&&(C.current.scrollTop=C.current.scrollHeight)},[y]);const St=y.length<k.length,pe=y.map(g=>({...g,id:`${g.colIndex}`}));return a.jsxs("div",{className:d.customSortPanelContainer,children:[a.jsxs("div",{className:d.customSortPanelContent,onMouseDown:g=>{g.stopPropagation()},children:[a.jsxs("div",{className:d.customSortPanelExt,children:[a.jsx("div",{className:d.firstRowCheck,children:a.jsx(P.Checkbox,{checked:n,onChange:g=>mt(!!g),children:r.t("sheets-sort.dialog.first-row-check")})}),St?a.jsxs("div",{className:d.addCondition,onClick:G,children:[a.jsx(X,{}),a.jsx("span",{className:d.addConditionText,children:r.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`
2
2
  ${d.addCondition}
3
3
  ${d.addConditionDisable}
4
- `,children:[a.jsx(X,{}),a.jsx("span",{className:d.addConditionText,children:n.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const x=g.currentTarget.scrollTop;c(x)},ref:C,children:a.jsx(P.DraggableList,{list:pe,onListChange:D,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx(Be,{titles:k,list:pe,item:g,onChange:(x,N)=>te(N,x),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(P.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>ne(),children:n.t("sheets-sort.dialog.cancel")}),a.jsx(P.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,r),children:n.t("sheets-sort.dialog.confirm")})]})]})}function Be(e){var G;const{list:t,item:n,titles:r,onChange:o,scrollPosition:i}=e,c=S.useDependency(s.LocaleService),C=r.filter(v=>!t.some(ne=>ne.colIndex===v.index)||v.index===n.colIndex),h=t.findIndex(v=>v.colIndex===n.colIndex),f=l.useCallback(v=>{o({...n,colIndex:v.index},h),_(!1)},[h,n,o]),[R,_]=l.useState(!1),k=v=>{_(v)};l.useEffect(()=>{_(!1)},[i]);const y=t.length>1,D=(G=r.find(v=>v.index===n.colIndex))==null?void 0:G.label,te=c.getCurrentLocale()===s.LocaleType.ZH_CN?d.customSortPanelItemOrderRadioCn:d.customSortPanelItemOrderRadio;return a.jsxs("div",{className:d.customSortPanelItem,children:[a.jsxs("div",{className:d.customSortPanelItemHead,children:[a.jsx("div",{className:d.customSortPanelItemHandler,children:a.jsx(Se,{})}),a.jsx("div",{className:d.customSortPanelItemColumn,children:a.jsx(P.DropdownLegacy,{placement:"bottomLeft",trigger:["click"],visible:R,onVisibleChange:k,overlay:a.jsx("ul",{className:d.customSortColMenu,children:C.map(v=>a.jsxs("li",{onClick:()=>f(v),className:d.customSortColMenuItem,children:[a.jsx("span",{className:d.customSortColMenuItemDesc,children:v.label}),a.jsx("span",{className:d.customSortColMenuItemCheck,children:v.index===n.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:D}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(P.RadioGroup,{className:te,value:n.type,onChange:v=>{o({...n,type:v},h)},children:[a.jsx(P.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(P.Radio,{value:I.SortType.DESC,children:c.t("sheets-sort.general.sort-desc")})]})}),a.jsx("div",{className:d.customSortPanelItemRemove,children:y&&a.jsx(le,{onClick:()=>o(null,h)})})]})}function Fe(e,t){const{startColumn:n,endColumn:r}=e,o=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=n;i<=r;i++)if(!o.has(i))return i;return null}function We(e){const{range:t,colIndex:n,onClose:r}=e,o=S.useDependency(p),i=S.useDependency(s.IUniverInstanceService),c=S.useDependency(s.LocaleService),C=l.useCallback(h=>{const{unitId:f,subUnitId:R}=m.getSheetCommandTarget(i)||{};if(t&&f&&R){const _={...t,startRow:t.startRow+1};o.triggerSortDirectly(h,!1,{unitId:f,subUnitId:R,range:_,colIndex:n})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${R}, range: ${t}, colIndex: ${n}`);r()},[t,n,o,i,r]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`
4
+ `,children:[a.jsx(X,{}),a.jsx("span",{className:d.addConditionText,children:r.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const T=g.currentTarget.scrollTop;c(T)},ref:C,children:a.jsx(P.DraggableList,{list:pe,onListChange:D,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx(Be,{titles:k,list:pe,item:g,onChange:(T,N)=>te(N,T),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(P.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>ne(),children:r.t("sheets-sort.dialog.cancel")}),a.jsx(P.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,n),children:r.t("sheets-sort.dialog.confirm")})]})]})}function Be(e){var G;const{list:t,item:r,titles:n,onChange:o,scrollPosition:i}=e,c=S.useDependency(s.LocaleService),C=n.filter(v=>!t.some(ne=>ne.colIndex===v.index)||v.index===r.colIndex),h=t.findIndex(v=>v.colIndex===r.colIndex),f=l.useCallback(v=>{o({...r,colIndex:v.index},h),_(!1)},[h,r,o]),[R,_]=l.useState(!1),k=v=>{_(v)};l.useEffect(()=>{_(!1)},[i]);const y=t.length>1,D=(G=n.find(v=>v.index===r.colIndex))==null?void 0:G.label,te=c.getCurrentLocale()===s.LocaleType.ZH_CN?d.customSortPanelItemOrderRadioCn:d.customSortPanelItemOrderRadio;return a.jsxs("div",{className:d.customSortPanelItem,children:[a.jsxs("div",{className:d.customSortPanelItemHead,children:[a.jsx("div",{className:d.customSortPanelItemHandler,children:a.jsx(Se,{})}),a.jsx("div",{className:d.customSortPanelItemColumn,children:a.jsx(P.DropdownLegacy,{placement:"bottomLeft",trigger:["click"],visible:R,onVisibleChange:k,overlay:a.jsx("ul",{className:d.customSortColMenu,children:C.map(v=>a.jsxs("li",{onClick:()=>f(v),className:d.customSortColMenuItem,children:[a.jsx("span",{className:d.customSortColMenuItemDesc,children:v.label}),a.jsx("span",{className:d.customSortColMenuItemCheck,children:v.index===r.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:D}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(P.RadioGroup,{className:te,value:r.type,onChange:v=>{o({...r,type:v},h)},children:[a.jsx(P.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(P.Radio,{value:I.SortType.DESC,children:c.t("sheets-sort.general.sort-desc")})]})}),a.jsx("div",{className:d.customSortPanelItemRemove,children:y&&a.jsx(le,{onClick:()=>o(null,h)})})]})}function Fe(e,t){const{startColumn:r,endColumn:n}=e,o=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=r;i<=n;i++)if(!o.has(i))return i;return null}function We(e){const{range:t,colIndex:r,onClose:n}=e,o=S.useDependency(p),i=S.useDependency(s.IUniverInstanceService),c=S.useDependency(s.LocaleService),C=l.useCallback(h=>{const{unitId:f,subUnitId:R}=m.getSheetCommandTarget(i)||{};if(t&&f&&R){const _={...t,startRow:t.startRow+1};o.triggerSortDirectly(h,!1,{unitId:f,subUnitId:R,range:_,colIndex:r})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${R}, range: ${t}, colIndex: ${r}`);n()},[t,r,o,i,n]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`
5
5
  ${d.embedSortBtn}
6
6
  ${d.embedSortBtnAsc}
7
7
  `,onClick:()=>C(!0),children:[a.jsx(q,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),a.jsxs("div",{className:`
8
8
  ${d.embedSortBtn}
9
9
  ${d.embedSortBtnDesc}
10
- `,onClick:()=>C(!1),children:[a.jsx(Y,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const Ce="sheet.menu.sheets-sort",ge="sheet.menu.sheets-sort-ctx",O="AscendingSingle",K="ExpandAscendingSingle",J="DescendingSingle",Q="ExpandDescendingSingle",ee="CustomSortSingle";function Ve(e){return{id:Ce,type:S.MenuItemType.SUBITEMS,icon:O,tooltip:"sheets-sort.general.sort",hidden$:S.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ze(e){return{id:H.id,icon:O,title:"sheets-sort.general.sort-asc-cur",type:S.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function Ze(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:K,type:S.MenuItemType.BUTTON}}function Ge(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:J,type:S.MenuItemType.BUTTON}}function qe(e){return{id:j.id,title:"sheets-sort.general.sort-desc-ext",icon:Q,type:S.MenuItemType.BUTTON}}function Ye(e){return{id:$.id,title:"sheets-sort.general.sort-custom",type:S.MenuItemType.BUTTON,icon:ee}}function Xe(e){return{id:ge,title:"sheets-sort.general.sort",type:S.MenuItemType.SUBITEMS,icon:O,hidden$:S.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function Ke(e){return{id:B.id,title:"sheets-sort.general.sort-asc-cur",type:S.MenuItemType.BUTTON,icon:O,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function Je(e){return{id:F.id,title:"sheets-sort.general.sort-asc-ext",type:S.MenuItemType.BUTTON,icon:K,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function Qe(e){return{id:W.id,title:"sheets-sort.general.sort-desc-cur",type:S.MenuItemType.BUTTON,icon:J,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function et(e){return{id:V.id,title:"sheets-sort.general.sort-desc-ext",type:S.MenuItemType.BUTTON,icon:Q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function tt(e){return{id:z.id,title:"sheets-sort.general.sort-custom",type:S.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const nt={[S.RibbonStartGroup.FORMULAS_INSERT]:{[Ce]:{order:2,menuItemFactory:Ve,[H.id]:{order:0,menuItemFactory:ze},[U.id]:{order:1,menuItemFactory:Ze},[A.id]:{order:2,menuItemFactory:Ge},[j.id]:{order:3,menuItemFactory:qe},[$.id]:{order:4,menuItemFactory:Ye}}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.DATA]:{[ge]:{order:0,menuItemFactory:Xe,[B.id]:{order:0,menuItemFactory:Ke},[F.id]:{order:1,menuItemFactory:Je},[W.id]:{order:2,menuItemFactory:Qe},[V.id]:{order:3,menuItemFactory:et},[z.id]:{order:4,menuItemFactory:tt}}}}};var rt=Object.getOwnPropertyDescriptor,ot=(e,t,n,r)=>{for(var o=r>1?void 0:r?rt(t,n):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(o=c(o)||o);return o},b=(e,t)=>(n,r)=>t(n,r,e);const he="custom-sort-dialog",st=560;let Z=class extends s.RxDisposable{constructor(e,t,n,r,o,i,c,C,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=n,this._layoutService=r,this._uiPartsService=o,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=C,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(nt)}_initCommands(){[H,U,A,j,$,B,F,W,V,z].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",$e)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>S.connectInjector(We,this._injector))),this.disposeWithMe(this._componentManager.register(O,q)),this.disposeWithMe(this._componentManager.register(K,de)),this.disposeWithMe(this._componentManager.register(J,Y)),this.disposeWithMe(this._componentManager.register(Q,ue)),this.disposeWithMe(this._componentManager.register(ee,ce)),this._sheetsSortUIService.customSortState$.pipe(oe.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:he,draggable:!0,width:st,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${Ie.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:it(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(he),queueMicrotask(()=>this._layoutService.focus())}};Z=ot([b(0,s.ICommandService),b(1,S.IMenuManagerService),b(2,S.IDialogService),b(3,S.ILayoutService),b(4,S.IUIPartsService),b(5,s.Inject(E.SheetsRenderService)),b(6,s.Inject(s.LocaleService)),b(7,s.Inject(p)),b(8,s.Inject(s.Injector)),b(9,s.Inject(S.ComponentManager))],Z);function it(){return{x:0,y:0}}var at=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,lt=(e,t,n)=>t in e?at(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dt=(e,t,n,r)=>{for(var o=r>1?void 0:r?ct(t,n):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(o=c(o)||o);return o},fe=(e,t)=>(n,r)=>t(n,r,e),ve=(e,t,n)=>lt(e,typeof t!="symbol"?t+"":t,n);const ut="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=se,n,r){super(),this._config=t,this._injector=n,this._configService=r;const{...o}=s.merge({},se,this._config);this._configService.setConfig(ye,o)}onStarting(){[[p],[Z]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Z)}},ve(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ve(u.UniverSheetsSortUIPlugin,"pluginName",ut),u.UniverSheetsSortUIPlugin=dt([s.DependentOn(I.UniverSheetsSortPlugin),fe(1,s.Inject(s.Injector)),fe(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=F,u.SortRangeAscInCtxMenuCommand=B,u.SortRangeCustomCommand=$,u.SortRangeCustomInCtxMenuCommand=z,u.SortRangeDescCommand=A,u.SortRangeDescExtCommand=j,u.SortRangeDescExtInCtxMenuCommand=V,u.SortRangeDescInCtxMenuCommand=W,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
10
+ `,onClick:()=>C(!1),children:[a.jsx(Y,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const Ce="sheet.menu.sheets-sort",ge="sheet.menu.sheets-sort-ctx",O="AscendingSingle",K="ExpandAscendingSingle",J="DescendingSingle",Q="ExpandDescendingSingle",ee="CustomSortSingle";function Ve(e){return{id:Ce,type:S.MenuItemType.SUBITEMS,icon:O,tooltip:"sheets-sort.general.sort",hidden$:S.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ze(e){return{id:H.id,icon:O,title:"sheets-sort.general.sort-asc-cur",type:S.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function Ze(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:K,type:S.MenuItemType.BUTTON}}function Ge(e){return{id:j.id,title:"sheets-sort.general.sort-desc-cur",icon:J,type:S.MenuItemType.BUTTON}}function qe(e){return{id:A.id,title:"sheets-sort.general.sort-desc-ext",icon:Q,type:S.MenuItemType.BUTTON}}function Ye(e){return{id:$.id,title:"sheets-sort.general.sort-custom",type:S.MenuItemType.BUTTON,icon:ee}}function Xe(e){return{id:ge,title:"sheets-sort.general.sort",type:S.MenuItemType.SUBITEMS,icon:O,hidden$:S.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function Ke(e){return{id:B.id,title:"sheets-sort.general.sort-asc-cur",type:S.MenuItemType.BUTTON,icon:O,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function Je(e){return{id:F.id,title:"sheets-sort.general.sort-asc-ext",type:S.MenuItemType.BUTTON,icon:K,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function Qe(e){return{id:W.id,title:"sheets-sort.general.sort-desc-cur",type:S.MenuItemType.BUTTON,icon:J,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function et(e){return{id:V.id,title:"sheets-sort.general.sort-desc-ext",type:S.MenuItemType.BUTTON,icon:Q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function tt(e){return{id:z.id,title:"sheets-sort.general.sort-custom",type:S.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const nt={[S.RibbonStartGroup.FORMULAS_INSERT]:{[Ce]:{order:2,menuItemFactory:Ve,[H.id]:{order:0,menuItemFactory:ze},[U.id]:{order:1,menuItemFactory:Ze},[j.id]:{order:2,menuItemFactory:Ge},[A.id]:{order:3,menuItemFactory:qe},[$.id]:{order:4,menuItemFactory:Ye}}},[S.ContextMenuPosition.MAIN_AREA]:{[S.ContextMenuGroup.DATA]:{[ge]:{order:0,menuItemFactory:Xe,[B.id]:{order:0,menuItemFactory:Ke},[F.id]:{order:1,menuItemFactory:Je},[W.id]:{order:2,menuItemFactory:Qe},[V.id]:{order:3,menuItemFactory:et},[z.id]:{order:4,menuItemFactory:tt}}}}};var rt=Object.getOwnPropertyDescriptor,ot=(e,t,r,n)=>{for(var o=n>1?void 0:n?rt(t,r):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(o=c(o)||o);return o},b=(e,t)=>(r,n)=>t(r,n,e);const he="custom-sort-dialog",st=560;let Z=class extends s.RxDisposable{constructor(e,t,r,n,o,i,c,C,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=r,this._layoutService=n,this._uiPartsService=o,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=C,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(nt)}_initCommands(){[H,U,j,A,$,B,F,W,V,z].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",$e)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>S.connectInjector(We,this._injector))),this.disposeWithMe(this._componentManager.register(O,q)),this.disposeWithMe(this._componentManager.register(K,de)),this.disposeWithMe(this._componentManager.register(J,Y)),this.disposeWithMe(this._componentManager.register(Q,ue)),this.disposeWithMe(this._componentManager.register(ee,ce)),this._sheetsSortUIService.customSortState$.pipe(oe.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:he,draggable:!0,width:st,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${Ie.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:it(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(he),queueMicrotask(()=>this._layoutService.focus())}};Z=ot([b(0,s.ICommandService),b(1,S.IMenuManagerService),b(2,S.IDialogService),b(3,S.ILayoutService),b(4,S.IUIPartsService),b(5,s.Inject(E.SheetsRenderService)),b(6,s.Inject(s.LocaleService)),b(7,s.Inject(p)),b(8,s.Inject(s.Injector)),b(9,s.Inject(S.ComponentManager))],Z);function it(){return{x:0,y:0}}var at=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,lt=(e,t,r)=>t in e?at(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dt=(e,t,r,n)=>{for(var o=n>1?void 0:n?ct(t,r):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(o=c(o)||o);return o},fe=(e,t)=>(r,n)=>t(r,n,e),ve=(e,t,r)=>lt(e,typeof t!="symbol"?t+"":t,r);const ut="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=se,r,n){super(),this._config=t,this._injector=r,this._configService=n;const{...o}=s.merge({},se,this._config);this._configService.setConfig(ye,o)}onStarting(){[[p],[Z]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Z)}},ve(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ve(u.UniverSheetsSortUIPlugin,"pluginName",ut),u.UniverSheetsSortUIPlugin=dt([s.DependentOn(I.UniverSheetsSortPlugin),fe(1,s.Inject(s.Injector)),fe(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=F,u.SortRangeAscInCtxMenuCommand=B,u.SortRangeCustomCommand=$,u.SortRangeCustomInCtxMenuCommand=z,u.SortRangeDescCommand=j,u.SortRangeDescExtCommand=A,u.SortRangeDescExtInCtxMenuCommand=V,u.SortRangeDescInCtxMenuCommand=W,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/sheets-sort-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.1-nightly.202502221605",
4
4
  "private": false,
5
5
  "description": "Univer Sheets Sort UI",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -52,27 +52,27 @@
52
52
  "rxjs": ">=7.0.0"
53
53
  },
54
54
  "dependencies": {
55
- "@univerjs/icons": "^0.2.15",
55
+ "@univerjs/icons": "^0.2.20",
56
56
  "clsx": "^2.1.1",
57
57
  "rc-virtual-list": "^3.15.0",
58
- "@univerjs/core": "0.6.0",
59
- "@univerjs/design": "0.6.0",
60
- "@univerjs/engine-formula": "0.6.0",
61
- "@univerjs/sheets": "0.6.0",
62
- "@univerjs/sheets-sort": "0.6.0",
63
- "@univerjs/ui": "0.6.0",
64
- "@univerjs/sheets-ui": "0.6.0"
58
+ "@univerjs/engine-formula": "0.6.1-nightly.202502221605",
59
+ "@univerjs/core": "0.6.1-nightly.202502221605",
60
+ "@univerjs/sheets": "0.6.1-nightly.202502221605",
61
+ "@univerjs/sheets-sort": "0.6.1-nightly.202502221605",
62
+ "@univerjs/sheets-ui": "0.6.1-nightly.202502221605",
63
+ "@univerjs/design": "0.6.1-nightly.202502221605",
64
+ "@univerjs/ui": "0.6.1-nightly.202502221605"
65
65
  },
66
66
  "devDependencies": {
67
67
  "less": "^4.2.2",
68
- "postcss": "^8.5.2",
68
+ "postcss": "^8.5.3",
69
69
  "react": "18.3.1",
70
70
  "rxjs": "^7.8.1",
71
71
  "tailwindcss": "^3.4.17",
72
72
  "typescript": "^5.7.3",
73
- "vite": "^6.1.0",
74
- "vitest": "^3.0.5",
75
- "@univerjs-infra/shared": "0.6.0"
73
+ "vite": "^6.1.1",
74
+ "vitest": "^3.0.6",
75
+ "@univerjs-infra/shared": "0.6.1"
76
76
  },
77
77
  "scripts": {
78
78
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS