@univerjs/preset-sheets-sort 0.5.0-beta.1
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/LICENSE +176 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/locales/en-US.js +1 -0
- package/lib/cjs/locales/fa-IR.js +1 -0
- package/lib/cjs/locales/ru-RU.js +1 -0
- package/lib/cjs/locales/vi-VN.js +1 -0
- package/lib/cjs/locales/zh-CN.js +1 -0
- package/lib/cjs/locales/zh-TW.js +1 -0
- package/lib/es/index.js +13 -0
- package/lib/es/locales/en-US.js +11 -0
- package/lib/es/locales/fa-IR.js +11 -0
- package/lib/es/locales/ru-RU.js +11 -0
- package/lib/es/locales/vi-VN.js +11 -0
- package/lib/es/locales/zh-CN.js +11 -0
- package/lib/es/locales/zh-TW.js +11 -0
- package/lib/index.css +1 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/locales/en-US.d.ts +2 -0
- package/lib/types/locales/fa-IR.d.ts +2 -0
- package/lib/types/locales/ru-RU.d.ts +2 -0
- package/lib/types/locales/vi-VN.d.ts +2 -0
- package/lib/types/locales/zh-CN.d.ts +2 -0
- package/lib/types/locales/zh-TW.d.ts +2 -0
- package/lib/types/types.d.ts +11 -0
- package/lib/umd/index.js +109 -0
- package/lib/umd/locales/en-US.js +4 -0
- package/lib/umd/locales/fa-IR.js +4 -0
- package/lib/umd/locales/ru-RU.js +4 -0
- package/lib/umd/locales/vi-VN.js +4 -0
- package/lib/umd/locales/zh-CN.js +4 -0
- package/lib/umd/locales/zh-TW.js +4 -0
- package/package.json +70 -0
package/lib/umd/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort
|
|
2
|
+
|
|
3
|
+
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.UniverSheetsSort={},l.UniverCore,l.UniverSheets,l.UniverEngineFormula))})(this,function(l,i,S,j){"use strict";var ne=Object.defineProperty;var re=(l,i,S)=>i in l?ne(l,i,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[i]=S;var _=(l,i,S)=>re(l,typeof i!="symbol"?i+"":i,S);var C;const D="sheets-sort.config",N={};var d=(e=>(e.DESC="desc",e.ASC="asc",e))(d||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),T=(e,s)=>{const t=e===null||e==="",r=s===null||s==="";return t&&r?0:t?1:r?-1:null},O=(e,s,t)=>{const r=typeof e=="number",n=typeof s=="number";return r&&n?e<s?t===d.ASC?-1:1:e>s?t===d.ASC?1:-1:0:r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},E=(e,s,t)=>{const r=typeof e=="string",n=typeof s=="string";if(r&&(e=b(e.toLocaleLowerCase())),n&&(s=b(s.toLocaleLowerCase())),!r&&!n)return null;if(r&&n){const o=e,u=s;return o<u?t===d.ASC?-1:1:o>u?t===d.ASC?1:-1:0}return r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},A=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,V=(e,s,t,r)=>{for(var n=r>1?void 0:r?$(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&M(s,t,n),n},p=(e,s)=>(t,r)=>s(t,r,e);l.SheetsSortService=class extends i.Disposable{constructor(t,r,n){super();_(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=n}mergeCheck(t){var a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(n);if(!u)return!1;const c=u.getMergeData().filter(f=>i.Rectangle.contains(o,f));return c.length===0?!0:L(o,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:n,range:o}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(n);if(!u)return!1;for(let a=o.startRow;a<=o.endRow;a++)for(let f=o.startColumn;f<=o.endColumn;f++)if(!A(u.getCellRaw(a,f)))return!0;return!1}singleCheck(t){return t.range.startRow!==t.range.endRow}formulaCheck(t){var c,a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[n];for(const f in u){const g=u[Number(f)];for(const I in g){const v=g[Number(I)];if(v&&i.Rectangle.intersects(o,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,n){var c;const{unitId:o,subUnitId:u}=S.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(R.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||o,subUnitId:n||u})}},l.SheetsSortService=V([p(0,i.IUniverInstanceService),p(1,i.ICommandService),p(2,i.Inject(j.FormulaDataModel))],l.SheetsSortService);function L(e,s){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let n=null,o=null;const u=t*r;let c=0;for(const a of s)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const f=a.endRow-a.startRow+1,g=a.endColumn-a.startColumn+1;if(n===null&&o===null)n=f,o=g;else if(f!==n||g!==o)return!1;c+=f*g}return c===u}const R={id:"sheet.command.sort-range",type:i.CommandType.COMMAND,handler:(e,s)=>{const{range:t,orderRules:r,hasTitle:n,unitId:o,subUnitId:u}=s,c=e.get(l.SheetsSortService),a=e.get(i.IUniverInstanceService),{worksheet:f}=S.getSheetCommandTarget(a,s)||{};if(!f)return!1;const g=f.getMergeData().filter(m=>i.Rectangle.contains(t,m)),I=g.map(m=>m.startRow),{startRow:v,endRow:Q}=t,X=n?v+1:v,w=[],U=[];for(let m=X;m<=Q;m++)f.getRowFiltered(m)||f.getRowRawVisible(m)!==!1&&(g.length&&!I.includes(m)||(w.push({index:m,value:G(f,m,r)}),U.push(m)));const Z=c.getAllCompareFns();w.sort(B(r,q(Z)));const F={};w.forEach(({index:m,value:oe},te)=>{F[U[te]]=m});const k={id:S.ReorderRangeCommand.id,params:{unitId:o,subUnitId:u,range:t,order:F}},ee=e.get(i.ICommandService);return i.sequenceExecute([k],ee).result}};function G(e,s,t){const r=[];return t.forEach(({colIndex:n})=>{r.push(e.getCellRaw(s,n))}),r}function q(e){return(s,t,r)=>{for(let n=0;n<e.length;n++){const o=e[n](s,t,r);if(o!=null)return o}return 0}}function B(e,s){return function(t,r){let n=null;for(let o=0;o<e.length;o++){const u=t.value[o],c=r.value[o];if(n=s(e[o].type,u,c),n!==0&&n!==null&&n!==void 0)return n}return 0}}var x=Object.defineProperty,H=Object.getOwnPropertyDescriptor,K=(e,s,t,r)=>{for(var n=r>1?void 0:r?H(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&x(s,t,n),n},y=(e,s)=>(t,r)=>s(t,r,e);let h=class extends i.Disposable{constructor(e,s){super(),this._commandService=e,this._sortService=s,this._initCommands(),this._registerCompareFns()}_initCommands(){[R].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(s,t,r)=>{const n=this._getCommonValue(t),o=this._getCommonValue(r),u=[T,E,O];for(let c=0;c<u.length;c++){const a=u[c](n,o,s);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(A(e))return null;const s=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return s||((e==null?void 0:e.t)===i.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===i.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};h=K([y(0,i.ICommandService),y(1,i.Inject(l.SheetsSortService))],h);var W=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,z=(e,s,t,r)=>{for(var n=r>1?void 0:r?Y(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&W(s,t,n),n},P=(e,s)=>(t,r)=>s(t,r,e);const J="SHEET_SORT_PLUGIN";l.UniverSheetsSortPlugin=(C=class extends i.Plugin{constructor(s=N,t,r){super(),this._config=s,this._injector=t,this._configService=r;const{...n}=this._config;this._configService.setConfig(D,n)}onStarting(){[[h],[l.SheetsSortService]].forEach(s=>this._injector.add(s))}onReady(){this._injector.get(h)}},_(C,"type",i.UniverInstanceType.UNIVER_SHEET),_(C,"pluginName",J),C),l.UniverSheetsSortPlugin=z([P(1,i.Inject(i.Injector)),P(2,i.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=R,l.SortType=d,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort-ui
|
|
7
|
+
|
|
8
|
+
(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"),require("@univerjs/sheets"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets","@univerjs/design"],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))})(this,function(u,s,I,_e,E,C,se,l,m,R){"use strict";var Pt=Object.defineProperty;var Mt=(u,s,I)=>s in u?Pt(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>Mt(u,typeof s!="symbol"?s+"":s,I);const Re="sheets-sort-ui.config",Pe={};var _=function(){return _=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)},Me=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o},P=l.forwardRef(function(e,t){var o=e.icon,n=e.id,r=e.className,i=e.extend,c=Me(e,["icon","id","className","extend"]),S="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),h=l.useRef("_".concat(be()));return ie(o,"".concat(n),{defIds:o.defIds,idSuffix:h.current},_({ref:t,className:S},c),i)});function ie(e,t,o,n,r){return l.createElement(e.tag,_(_({key:t},Ee(e,o,r)),n),(Te(e,o).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),o,void 0,r)}))}function Ee(e,t,o){var n=_({},e.attrs);o!=null&&o.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=o.colorChannel1);var r=t.defIds;return!r||r.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],S=i[1];typeof S=="string"&&(n[c]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(e,t){var o,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((o=e.children)===null||o===void 0)&&o.length)?_(_({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?_(_({},r),{attrs:_(_({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function be(){return Math.random().toString(36).substring(2,8)}P.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},K=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"ascending- single",ref:t,icon:Oe}))});K.displayName="AscendingSingle";var we={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(P,Object.assign({},e,{id:"check-mark-single",ref:t,icon:we}))});ae.displayName="CheckMarkSingle";var je={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(P,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:je}))});ce.displayName="CustomSortSingle";var ke={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(P,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:ke}))});le.displayName="DeleteEmptySingle";var De={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},J=l.forwardRef(function(e,t){return l.createElement(P,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"}}]},de=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});de.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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Le}))});ue.displayName="ExpandDescendingSingle";var He={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=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"increase-single",ref:t,icon:He}))});Q.displayName="IncreaseSingle";var Ue={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(P,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ue}))});me.displayName="MoreDownSingle";var Ae={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(P,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ae}))});Se.displayName="SequenceSingle";var Ce={exports:{}},N={};/**
|
|
9
|
+
* @license React
|
|
10
|
+
* react-jsx-runtime.production.min.js
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/var Be=l,Fe=Symbol.for("react.element"),We=Symbol.for("react.fragment"),Ve=Object.prototype.hasOwnProperty,ze=Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0};function ge(e,t,o){var n,r={},i=null,c=null;o!==void 0&&(i=""+o),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Ve.call(t,n)&&!Ze.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:Fe,type:e,key:i,ref:c,props:r,_owner:ze.current}}N.Fragment=We,N.jsx=ge,N.jsxs=ge,Ce.exports=N;var a=Ce.exports;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"},Ge=e=>{const[t,o]=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(R.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:r=>{o(r),e.onChange(r)},children:[a.jsx(R.Radio,{value:"0",children:n.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(R.Radio,{value:"1",children:n.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ye=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ke=(e,t,o,n)=>{for(var r=n>1?void 0:n?Xe(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ye(t,o,r),r},w=(e,t)=>(o,n)=>t(o,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,o,n,r,i,c,S){super();re(this,"_customSortState$",new se.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=o,this._logService=n,this._selectionManagerService=r,this._sheetsSortService=i,this._localeService=c,this._commandService=S}async triggerSortDirectly(t,o,n){const r=n||await this._detectSortLocation(o);if(!r||!this._check(r))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.SortType.DESC,colIndex:r.colIndex}],range:r.range};return this._sheetsSortService.applySort(c,r.unitId,r.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 o=(h=this.customSortState())==null?void 0:h.location;if(!o)return[];const{unitId:n,subUnitId:r,range:i}=o,c=(f=this._univerInstanceService.getUnit(n))==null?void 0:f.getSheetBySheetId(r);if(!c)return[];const S=Je(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(b,x)=>{var y;const O=(y=c.getCell(i.startRow,x+i.startColumn))==null?void 0:y.v;return{index:x+i.startColumn,label:t?`${O!=null?O:S(x+i.startColumn)}`:S(x+i.startColumn)}})}setSelection(t,o,n){var c;const r=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(o);if(!r)return;const i={unitId:t,subUnitId:o,selections:[{range:n,primary:m.getPrimaryForRange(n,r),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(Ge,{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 o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),n=o.getActiveSheet(),r=o.getUnitId(),i=n.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let S;if(t===!0)S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S);else if(t===!1)S=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?S=c.range:(S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S))}return{range:S,unitId:r,subUnitId:i,colIndex:c.primary.actualColumn}}};p=Ke([w(0,s.IUniverInstanceService),w(1,C.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 o=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${o}"列`;case s.LocaleType.EN_US:return`Column "${o}"`;default:return`Column "${o}"`}}}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)},B={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},W={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},V={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},Z={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},G={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function Qe(){const e=s.useDependency(p),t=s.useDependency(I.SheetsSortService),o=s.useDependency(s.LocaleService),[n,r]=l.useState(!1),[i,c]=l.useState(0),S=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:b,subUnitId:x}=h.location,O=e.getTitles(n),[y,k]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),ne=l.useCallback((g,M)=>{const D=[...y];M===null?D.splice(g,1):D[g]=M,k(D)},[y]),X=l.useCallback(s.throttle(()=>{const g=[...y],M=qe(f,y);M!==null&&(g.push({type:I.SortType.ASC,colIndex:M}),k(g))},200),[y,f]),v=l.useCallback((g,M)=>{t.applySort({range:f,orderRules:g,hasTitle:M}),e.closeCustomSortPanel()},[t,e,f]),oe=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),_t=l.useCallback(g=>{r(g),g?e.setSelection(b,x,{...f,startRow:f.startRow+1}):e.setSelection(b,x,f)},[e,f,x,b]);l.useEffect(()=>{S.current&&y.length>5&&(S.current.scrollTop=S.current.scrollHeight)},[y]);const Rt=y.length<O.length,xe=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(R.Checkbox,{checked:n,onChange:g=>_t(!!g),children:o.t("sheets-sort.dialog.first-row-check")})}),Rt?a.jsxs("div",{className:d.addCondition,onClick:X,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`${d.addCondition} ${d.addConditionDisable}`,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const M=g.currentTarget.scrollTop;c(M)},ref:S,children:a.jsx(R.DraggableList,{list:xe,onListChange:k,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx($e,{titles:O,list:xe,item:g,onChange:(M,D)=>ne(D,M),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>oe(),children:o.t("sheets-sort.dialog.cancel")}),a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,n),children:o.t("sheets-sort.dialog.confirm")})]})]})}function $e(e){var X;const{list:t,item:o,titles:n,onChange:r,scrollPosition:i}=e,c=s.useDependency(s.LocaleService),S=n.filter(v=>!t.some(oe=>oe.colIndex===v.index)||v.index===o.colIndex),h=t.findIndex(v=>v.colIndex===o.colIndex),f=l.useCallback(v=>{r({...o,colIndex:v.index},h),x(!1)},[h,o,r]),[b,x]=l.useState(!1),O=v=>{x(v)};l.useEffect(()=>{x(!1)},[i]);const y=t.length>1,k=(X=n.find(v=>v.index===o.colIndex))==null?void 0:X.label,ne=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(R.Dropdown,{placement:"bottomLeft",trigger:["click"],visible:b,onVisibleChange:O,overlay:a.jsx("ul",{className:d.customSortColMenu,children:S.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===o.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:k}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(R.RadioGroup,{className:ne,value:o.type,onChange:v=>{r({...o,type:v},h)},children:[a.jsx(R.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(R.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:()=>r(null,h)})})]})}function qe(e,t){const{startColumn:o,endColumn:n}=e,r=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=o;i<=n;i++)if(!r.has(i))return i;return null}function et(e){const{range:t,colIndex:o,onClose:n}=e,r=s.useDependency(p),i=s.useDependency(s.IUniverInstanceService),c=s.useDependency(s.LocaleService),S=l.useCallback(h=>{const{unitId:f,subUnitId:b}=m.getSheetCommandTarget(i)||{};if(t&&f&&b){const x={...t,startRow:t.startRow+1};r.triggerSortDirectly(h,!1,{unitId:f,subUnitId:b,range:x,colIndex:o})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${b}, range: ${t}, colIndex: ${o}`);n()},[t,o,r,i,n]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnAsc}`,onClick:()=>S(!0),children:[a.jsx(K,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnDesc}`,onClick:()=>S(!1),children:[a.jsx(J,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const he="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",j="AscendingSingle",$="ExpandAscendingSingle",q="DescendingSingle",ee="ExpandDescendingSingle",te="CustomSortSingle";function tt(e){return{id:he,type:C.MenuItemType.SUBITEMS,icon:j,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function nt(e){return{id:H.id,icon:j,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function ot(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:$,type:C.MenuItemType.BUTTON}}function rt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:q,type:C.MenuItemType.BUTTON}}function st(e){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",icon:ee,type:C.MenuItemType.BUTTON}}function it(e){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te}}function at(e){return{id:fe,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:j,hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ct(e){return{id:W.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:j,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function lt(e){return{id:V.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:$,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function dt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ut(e){return{id:Z.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function mt(e){return{id:G.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const St={[C.RibbonStartGroup.FORMULAS_INSERT]:{[he]:{order:2,menuItemFactory:tt,[H.id]:{order:0,menuItemFactory:nt},[U.id]:{order:1,menuItemFactory:ot},[A.id]:{order:2,menuItemFactory:rt},[B.id]:{order:3,menuItemFactory:st},[F.id]:{order:4,menuItemFactory:it}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:at,[W.id]:{order:0,menuItemFactory:ct},[V.id]:{order:1,menuItemFactory:lt},[z.id]:{order:2,menuItemFactory:dt},[Z.id]:{order:3,menuItemFactory:ut},[G.id]:{order:4,menuItemFactory:mt}}}}};var Ct=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=(e,t,o,n)=>{for(var r=n>1?void 0:n?gt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ct(t,o,r),r},T=(e,t)=>(o,n)=>t(o,n,e);const ve="custom-sort-dialog",ft=560;let Y=class extends s.RxDisposable{constructor(e,t,o,n,r,i,c,S,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=o,this._layoutService=n,this._uiPartsService=r,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=S,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(St)}_initCommands(){[H,U,A,B,F,W,V,z,Z,G].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",Qe)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>s.connectInjector(et,this._injector))),this.disposeWithMe(this._componentManager.register(j,K)),this.disposeWithMe(this._componentManager.register($,de)),this.disposeWithMe(this._componentManager.register(q,J)),this.disposeWithMe(this._componentManager.register(ee,ue)),this.disposeWithMe(this._componentManager.register(te,ce)),this._sheetsSortUIService.customSortState$.pipe(se.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:ve,draggable:!0,width:ft,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:vt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(ve),queueMicrotask(()=>this._layoutService.focus())}};Y=ht([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],Y);function vt(){return{x:0,y:0}}var pe=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,It=(e,t,o)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,yt=(e,t,o,n)=>{for(var r=n>1?void 0:n?pt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&pe(t,o,r),r},Ie=(e,t)=>(o,n)=>t(o,n,e),ye=(e,t,o)=>It(e,typeof t!="symbol"?t+"":t,o);const xt="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=Pe,o,n){super(),this._config=t,this._injector=o,this._configService=n;const{...r}=this._config;this._configService.setConfig(Re,r)}onStarting(){[[p],[Y]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Y)}},ye(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ye(u.UniverSheetsSortUIPlugin,"pluginName",xt),u.UniverSheetsSortUIPlugin=yt([s.DependentOn(I.UniverSheetsSortPlugin),Ie(1,s.Inject(s.Injector)),Ie(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=V,u.SortRangeAscInCtxMenuCommand=W,u.SortRangeCustomCommand=F,u.SortRangeCustomInCtxMenuCommand=G,u.SortRangeDescCommand=A,u.SortRangeDescExtCommand=B,u.SortRangeDescExtInCtxMenuCommand=Z,u.SortRangeDescInCtxMenuCommand=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort
|
|
20
|
+
|
|
21
|
+
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.UniverSheetsSort={},l.UniverCore,l.UniverSheets,l.UniverEngineFormula))})(this,function(l,i,S,j){"use strict";var ne=Object.defineProperty;var re=(l,i,S)=>i in l?ne(l,i,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[i]=S;var _=(l,i,S)=>re(l,typeof i!="symbol"?i+"":i,S);var C;const D="sheets-sort.config",N={};var d=(e=>(e.DESC="desc",e.ASC="asc",e))(d||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),T=(e,s)=>{const t=e===null||e==="",r=s===null||s==="";return t&&r?0:t?1:r?-1:null},O=(e,s,t)=>{const r=typeof e=="number",n=typeof s=="number";return r&&n?e<s?t===d.ASC?-1:1:e>s?t===d.ASC?1:-1:0:r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},E=(e,s,t)=>{const r=typeof e=="string",n=typeof s=="string";if(r&&(e=b(e.toLocaleLowerCase())),n&&(s=b(s.toLocaleLowerCase())),!r&&!n)return null;if(r&&n){const o=e,u=s;return o<u?t===d.ASC?-1:1:o>u?t===d.ASC?1:-1:0}return r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},A=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,V=(e,s,t,r)=>{for(var n=r>1?void 0:r?$(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&M(s,t,n),n},p=(e,s)=>(t,r)=>s(t,r,e);l.SheetsSortService=class extends i.Disposable{constructor(t,r,n){super();_(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=n}mergeCheck(t){var a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(n);if(!u)return!1;const c=u.getMergeData().filter(f=>i.Rectangle.contains(o,f));return c.length===0?!0:L(o,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:n,range:o}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(n);if(!u)return!1;for(let a=o.startRow;a<=o.endRow;a++)for(let f=o.startColumn;f<=o.endColumn;f++)if(!A(u.getCellRaw(a,f)))return!0;return!1}singleCheck(t){return t.range.startRow!==t.range.endRow}formulaCheck(t){var c,a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[n];for(const f in u){const g=u[Number(f)];for(const I in g){const v=g[Number(I)];if(v&&i.Rectangle.intersects(o,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,n){var c;const{unitId:o,subUnitId:u}=S.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(R.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||o,subUnitId:n||u})}},l.SheetsSortService=V([p(0,i.IUniverInstanceService),p(1,i.ICommandService),p(2,i.Inject(j.FormulaDataModel))],l.SheetsSortService);function L(e,s){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let n=null,o=null;const u=t*r;let c=0;for(const a of s)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const f=a.endRow-a.startRow+1,g=a.endColumn-a.startColumn+1;if(n===null&&o===null)n=f,o=g;else if(f!==n||g!==o)return!1;c+=f*g}return c===u}const R={id:"sheet.command.sort-range",type:i.CommandType.COMMAND,handler:(e,s)=>{const{range:t,orderRules:r,hasTitle:n,unitId:o,subUnitId:u}=s,c=e.get(l.SheetsSortService),a=e.get(i.IUniverInstanceService),{worksheet:f}=S.getSheetCommandTarget(a,s)||{};if(!f)return!1;const g=f.getMergeData().filter(m=>i.Rectangle.contains(t,m)),I=g.map(m=>m.startRow),{startRow:v,endRow:Q}=t,X=n?v+1:v,w=[],U=[];for(let m=X;m<=Q;m++)f.getRowFiltered(m)||f.getRowRawVisible(m)!==!1&&(g.length&&!I.includes(m)||(w.push({index:m,value:G(f,m,r)}),U.push(m)));const Z=c.getAllCompareFns();w.sort(B(r,q(Z)));const F={};w.forEach(({index:m,value:oe},te)=>{F[U[te]]=m});const k={id:S.ReorderRangeCommand.id,params:{unitId:o,subUnitId:u,range:t,order:F}},ee=e.get(i.ICommandService);return i.sequenceExecute([k],ee).result}};function G(e,s,t){const r=[];return t.forEach(({colIndex:n})=>{r.push(e.getCellRaw(s,n))}),r}function q(e){return(s,t,r)=>{for(let n=0;n<e.length;n++){const o=e[n](s,t,r);if(o!=null)return o}return 0}}function B(e,s){return function(t,r){let n=null;for(let o=0;o<e.length;o++){const u=t.value[o],c=r.value[o];if(n=s(e[o].type,u,c),n!==0&&n!==null&&n!==void 0)return n}return 0}}var x=Object.defineProperty,H=Object.getOwnPropertyDescriptor,K=(e,s,t,r)=>{for(var n=r>1?void 0:r?H(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&x(s,t,n),n},y=(e,s)=>(t,r)=>s(t,r,e);let h=class extends i.Disposable{constructor(e,s){super(),this._commandService=e,this._sortService=s,this._initCommands(),this._registerCompareFns()}_initCommands(){[R].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(s,t,r)=>{const n=this._getCommonValue(t),o=this._getCommonValue(r),u=[T,E,O];for(let c=0;c<u.length;c++){const a=u[c](n,o,s);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(A(e))return null;const s=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return s||((e==null?void 0:e.t)===i.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===i.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};h=K([y(0,i.ICommandService),y(1,i.Inject(l.SheetsSortService))],h);var W=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,z=(e,s,t,r)=>{for(var n=r>1?void 0:r?Y(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&W(s,t,n),n},P=(e,s)=>(t,r)=>s(t,r,e);const J="SHEET_SORT_PLUGIN";l.UniverSheetsSortPlugin=(C=class extends i.Plugin{constructor(s=N,t,r){super(),this._config=s,this._injector=t,this._configService=r;const{...n}=this._config;this._configService.setConfig(D,n)}onStarting(){[[h],[l.SheetsSortService]].forEach(s=>this._injector.add(s))}onReady(){this._injector.get(h)}},_(C,"type",i.UniverInstanceType.UNIVER_SHEET),_(C,"pluginName",J),C),l.UniverSheetsSortPlugin=z([P(1,i.Inject(i.Injector)),P(2,i.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=R,l.SortType=d,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort-ui
|
|
25
|
+
|
|
26
|
+
(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"),require("@univerjs/sheets"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets","@univerjs/design"],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))})(this,function(u,s,I,_e,E,C,se,l,m,R){"use strict";var Pt=Object.defineProperty;var Mt=(u,s,I)=>s in u?Pt(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>Mt(u,typeof s!="symbol"?s+"":s,I);const Re="sheets-sort-ui.config",Pe={};var _=function(){return _=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)},Me=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o},P=l.forwardRef(function(e,t){var o=e.icon,n=e.id,r=e.className,i=e.extend,c=Me(e,["icon","id","className","extend"]),S="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),h=l.useRef("_".concat(be()));return ie(o,"".concat(n),{defIds:o.defIds,idSuffix:h.current},_({ref:t,className:S},c),i)});function ie(e,t,o,n,r){return l.createElement(e.tag,_(_({key:t},Ee(e,o,r)),n),(Te(e,o).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),o,void 0,r)}))}function Ee(e,t,o){var n=_({},e.attrs);o!=null&&o.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=o.colorChannel1);var r=t.defIds;return!r||r.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],S=i[1];typeof S=="string"&&(n[c]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(e,t){var o,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((o=e.children)===null||o===void 0)&&o.length)?_(_({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?_(_({},r),{attrs:_(_({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function be(){return Math.random().toString(36).substring(2,8)}P.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},K=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"ascending- single",ref:t,icon:Oe}))});K.displayName="AscendingSingle";var we={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(P,Object.assign({},e,{id:"check-mark-single",ref:t,icon:we}))});ae.displayName="CheckMarkSingle";var je={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(P,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:je}))});ce.displayName="CustomSortSingle";var ke={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(P,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:ke}))});le.displayName="DeleteEmptySingle";var De={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},J=l.forwardRef(function(e,t){return l.createElement(P,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"}}]},de=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});de.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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Le}))});ue.displayName="ExpandDescendingSingle";var He={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=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"increase-single",ref:t,icon:He}))});Q.displayName="IncreaseSingle";var Ue={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(P,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ue}))});me.displayName="MoreDownSingle";var Ae={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(P,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ae}))});Se.displayName="SequenceSingle";var Ce={exports:{}},N={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-jsx-runtime.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var Be=l,Fe=Symbol.for("react.element"),We=Symbol.for("react.fragment"),Ve=Object.prototype.hasOwnProperty,ze=Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0};function ge(e,t,o){var n,r={},i=null,c=null;o!==void 0&&(i=""+o),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Ve.call(t,n)&&!Ze.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:Fe,type:e,key:i,ref:c,props:r,_owner:ze.current}}N.Fragment=We,N.jsx=ge,N.jsxs=ge,Ce.exports=N;var a=Ce.exports;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"},Ge=e=>{const[t,o]=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(R.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:r=>{o(r),e.onChange(r)},children:[a.jsx(R.Radio,{value:"0",children:n.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(R.Radio,{value:"1",children:n.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ye=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ke=(e,t,o,n)=>{for(var r=n>1?void 0:n?Xe(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ye(t,o,r),r},w=(e,t)=>(o,n)=>t(o,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,o,n,r,i,c,S){super();re(this,"_customSortState$",new se.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=o,this._logService=n,this._selectionManagerService=r,this._sheetsSortService=i,this._localeService=c,this._commandService=S}async triggerSortDirectly(t,o,n){const r=n||await this._detectSortLocation(o);if(!r||!this._check(r))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.SortType.DESC,colIndex:r.colIndex}],range:r.range};return this._sheetsSortService.applySort(c,r.unitId,r.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 o=(h=this.customSortState())==null?void 0:h.location;if(!o)return[];const{unitId:n,subUnitId:r,range:i}=o,c=(f=this._univerInstanceService.getUnit(n))==null?void 0:f.getSheetBySheetId(r);if(!c)return[];const S=Je(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(b,x)=>{var y;const O=(y=c.getCell(i.startRow,x+i.startColumn))==null?void 0:y.v;return{index:x+i.startColumn,label:t?`${O!=null?O:S(x+i.startColumn)}`:S(x+i.startColumn)}})}setSelection(t,o,n){var c;const r=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(o);if(!r)return;const i={unitId:t,subUnitId:o,selections:[{range:n,primary:m.getPrimaryForRange(n,r),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(Ge,{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 o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),n=o.getActiveSheet(),r=o.getUnitId(),i=n.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let S;if(t===!0)S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S);else if(t===!1)S=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?S=c.range:(S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S))}return{range:S,unitId:r,subUnitId:i,colIndex:c.primary.actualColumn}}};p=Ke([w(0,s.IUniverInstanceService),w(1,C.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 o=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${o}"列`;case s.LocaleType.EN_US:return`Column "${o}"`;default:return`Column "${o}"`}}}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)},B={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},W={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},V={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},Z={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},G={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function Qe(){const e=s.useDependency(p),t=s.useDependency(I.SheetsSortService),o=s.useDependency(s.LocaleService),[n,r]=l.useState(!1),[i,c]=l.useState(0),S=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:b,subUnitId:x}=h.location,O=e.getTitles(n),[y,k]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),ne=l.useCallback((g,M)=>{const D=[...y];M===null?D.splice(g,1):D[g]=M,k(D)},[y]),X=l.useCallback(s.throttle(()=>{const g=[...y],M=qe(f,y);M!==null&&(g.push({type:I.SortType.ASC,colIndex:M}),k(g))},200),[y,f]),v=l.useCallback((g,M)=>{t.applySort({range:f,orderRules:g,hasTitle:M}),e.closeCustomSortPanel()},[t,e,f]),oe=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),_t=l.useCallback(g=>{r(g),g?e.setSelection(b,x,{...f,startRow:f.startRow+1}):e.setSelection(b,x,f)},[e,f,x,b]);l.useEffect(()=>{S.current&&y.length>5&&(S.current.scrollTop=S.current.scrollHeight)},[y]);const Rt=y.length<O.length,xe=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(R.Checkbox,{checked:n,onChange:g=>_t(!!g),children:o.t("sheets-sort.dialog.first-row-check")})}),Rt?a.jsxs("div",{className:d.addCondition,onClick:X,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`${d.addCondition} ${d.addConditionDisable}`,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const M=g.currentTarget.scrollTop;c(M)},ref:S,children:a.jsx(R.DraggableList,{list:xe,onListChange:k,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx($e,{titles:O,list:xe,item:g,onChange:(M,D)=>ne(D,M),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>oe(),children:o.t("sheets-sort.dialog.cancel")}),a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,n),children:o.t("sheets-sort.dialog.confirm")})]})]})}function $e(e){var X;const{list:t,item:o,titles:n,onChange:r,scrollPosition:i}=e,c=s.useDependency(s.LocaleService),S=n.filter(v=>!t.some(oe=>oe.colIndex===v.index)||v.index===o.colIndex),h=t.findIndex(v=>v.colIndex===o.colIndex),f=l.useCallback(v=>{r({...o,colIndex:v.index},h),x(!1)},[h,o,r]),[b,x]=l.useState(!1),O=v=>{x(v)};l.useEffect(()=>{x(!1)},[i]);const y=t.length>1,k=(X=n.find(v=>v.index===o.colIndex))==null?void 0:X.label,ne=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(R.Dropdown,{placement:"bottomLeft",trigger:["click"],visible:b,onVisibleChange:O,overlay:a.jsx("ul",{className:d.customSortColMenu,children:S.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===o.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:k}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(R.RadioGroup,{className:ne,value:o.type,onChange:v=>{r({...o,type:v},h)},children:[a.jsx(R.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(R.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:()=>r(null,h)})})]})}function qe(e,t){const{startColumn:o,endColumn:n}=e,r=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=o;i<=n;i++)if(!r.has(i))return i;return null}function et(e){const{range:t,colIndex:o,onClose:n}=e,r=s.useDependency(p),i=s.useDependency(s.IUniverInstanceService),c=s.useDependency(s.LocaleService),S=l.useCallback(h=>{const{unitId:f,subUnitId:b}=m.getSheetCommandTarget(i)||{};if(t&&f&&b){const x={...t,startRow:t.startRow+1};r.triggerSortDirectly(h,!1,{unitId:f,subUnitId:b,range:x,colIndex:o})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${b}, range: ${t}, colIndex: ${o}`);n()},[t,o,r,i,n]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnAsc}`,onClick:()=>S(!0),children:[a.jsx(K,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnDesc}`,onClick:()=>S(!1),children:[a.jsx(J,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const he="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",j="AscendingSingle",$="ExpandAscendingSingle",q="DescendingSingle",ee="ExpandDescendingSingle",te="CustomSortSingle";function tt(e){return{id:he,type:C.MenuItemType.SUBITEMS,icon:j,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function nt(e){return{id:H.id,icon:j,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function ot(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:$,type:C.MenuItemType.BUTTON}}function rt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:q,type:C.MenuItemType.BUTTON}}function st(e){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",icon:ee,type:C.MenuItemType.BUTTON}}function it(e){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te}}function at(e){return{id:fe,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:j,hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ct(e){return{id:W.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:j,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function lt(e){return{id:V.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:$,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function dt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ut(e){return{id:Z.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function mt(e){return{id:G.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const St={[C.RibbonStartGroup.FORMULAS_INSERT]:{[he]:{order:2,menuItemFactory:tt,[H.id]:{order:0,menuItemFactory:nt},[U.id]:{order:1,menuItemFactory:ot},[A.id]:{order:2,menuItemFactory:rt},[B.id]:{order:3,menuItemFactory:st},[F.id]:{order:4,menuItemFactory:it}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:at,[W.id]:{order:0,menuItemFactory:ct},[V.id]:{order:1,menuItemFactory:lt},[z.id]:{order:2,menuItemFactory:dt},[Z.id]:{order:3,menuItemFactory:ut},[G.id]:{order:4,menuItemFactory:mt}}}}};var Ct=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=(e,t,o,n)=>{for(var r=n>1?void 0:n?gt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ct(t,o,r),r},T=(e,t)=>(o,n)=>t(o,n,e);const ve="custom-sort-dialog",ft=560;let Y=class extends s.RxDisposable{constructor(e,t,o,n,r,i,c,S,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=o,this._layoutService=n,this._uiPartsService=r,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=S,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(St)}_initCommands(){[H,U,A,B,F,W,V,z,Z,G].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",Qe)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>s.connectInjector(et,this._injector))),this.disposeWithMe(this._componentManager.register(j,K)),this.disposeWithMe(this._componentManager.register($,de)),this.disposeWithMe(this._componentManager.register(q,J)),this.disposeWithMe(this._componentManager.register(ee,ue)),this.disposeWithMe(this._componentManager.register(te,ce)),this._sheetsSortUIService.customSortState$.pipe(se.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:ve,draggable:!0,width:ft,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:vt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(ve),queueMicrotask(()=>this._layoutService.focus())}};Y=ht([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],Y);function vt(){return{x:0,y:0}}var pe=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,It=(e,t,o)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,yt=(e,t,o,n)=>{for(var r=n>1?void 0:n?pt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&pe(t,o,r),r},Ie=(e,t)=>(o,n)=>t(o,n,e),ye=(e,t,o)=>It(e,typeof t!="symbol"?t+"":t,o);const xt="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=Pe,o,n){super(),this._config=t,this._injector=o,this._configService=n;const{...r}=this._config;this._configService.setConfig(Re,r)}onStarting(){[[p],[Y]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Y)}},ye(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ye(u.UniverSheetsSortUIPlugin,"pluginName",xt),u.UniverSheetsSortUIPlugin=yt([s.DependentOn(I.UniverSheetsSortPlugin),Ie(1,s.Inject(s.Injector)),Ie(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=V,u.SortRangeAscInCtxMenuCommand=W,u.SortRangeCustomCommand=F,u.SortRangeCustomInCtxMenuCommand=G,u.SortRangeDescCommand=A,u.SortRangeDescExtCommand=B,u.SortRangeDescExtInCtxMenuCommand=Z,u.SortRangeDescInCtxMenuCommand=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort
|
|
38
|
+
|
|
39
|
+
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.UniverSheetsSort={},l.UniverCore,l.UniverSheets,l.UniverEngineFormula))})(this,function(l,i,S,j){"use strict";var ne=Object.defineProperty;var re=(l,i,S)=>i in l?ne(l,i,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[i]=S;var _=(l,i,S)=>re(l,typeof i!="symbol"?i+"":i,S);var C;const D="sheets-sort.config",N={};var d=(e=>(e.DESC="desc",e.ASC="asc",e))(d||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),T=(e,s)=>{const t=e===null||e==="",r=s===null||s==="";return t&&r?0:t?1:r?-1:null},O=(e,s,t)=>{const r=typeof e=="number",n=typeof s=="number";return r&&n?e<s?t===d.ASC?-1:1:e>s?t===d.ASC?1:-1:0:r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},E=(e,s,t)=>{const r=typeof e=="string",n=typeof s=="string";if(r&&(e=b(e.toLocaleLowerCase())),n&&(s=b(s.toLocaleLowerCase())),!r&&!n)return null;if(r&&n){const o=e,u=s;return o<u?t===d.ASC?-1:1:o>u?t===d.ASC?1:-1:0}return r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},A=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,V=(e,s,t,r)=>{for(var n=r>1?void 0:r?$(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&M(s,t,n),n},p=(e,s)=>(t,r)=>s(t,r,e);l.SheetsSortService=class extends i.Disposable{constructor(t,r,n){super();_(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=n}mergeCheck(t){var a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(n);if(!u)return!1;const c=u.getMergeData().filter(f=>i.Rectangle.contains(o,f));return c.length===0?!0:L(o,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:n,range:o}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(n);if(!u)return!1;for(let a=o.startRow;a<=o.endRow;a++)for(let f=o.startColumn;f<=o.endColumn;f++)if(!A(u.getCellRaw(a,f)))return!0;return!1}singleCheck(t){return t.range.startRow!==t.range.endRow}formulaCheck(t){var c,a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[n];for(const f in u){const g=u[Number(f)];for(const I in g){const v=g[Number(I)];if(v&&i.Rectangle.intersects(o,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,n){var c;const{unitId:o,subUnitId:u}=S.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(R.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||o,subUnitId:n||u})}},l.SheetsSortService=V([p(0,i.IUniverInstanceService),p(1,i.ICommandService),p(2,i.Inject(j.FormulaDataModel))],l.SheetsSortService);function L(e,s){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let n=null,o=null;const u=t*r;let c=0;for(const a of s)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const f=a.endRow-a.startRow+1,g=a.endColumn-a.startColumn+1;if(n===null&&o===null)n=f,o=g;else if(f!==n||g!==o)return!1;c+=f*g}return c===u}const R={id:"sheet.command.sort-range",type:i.CommandType.COMMAND,handler:(e,s)=>{const{range:t,orderRules:r,hasTitle:n,unitId:o,subUnitId:u}=s,c=e.get(l.SheetsSortService),a=e.get(i.IUniverInstanceService),{worksheet:f}=S.getSheetCommandTarget(a,s)||{};if(!f)return!1;const g=f.getMergeData().filter(m=>i.Rectangle.contains(t,m)),I=g.map(m=>m.startRow),{startRow:v,endRow:Q}=t,X=n?v+1:v,w=[],U=[];for(let m=X;m<=Q;m++)f.getRowFiltered(m)||f.getRowRawVisible(m)!==!1&&(g.length&&!I.includes(m)||(w.push({index:m,value:G(f,m,r)}),U.push(m)));const Z=c.getAllCompareFns();w.sort(B(r,q(Z)));const F={};w.forEach(({index:m,value:oe},te)=>{F[U[te]]=m});const k={id:S.ReorderRangeCommand.id,params:{unitId:o,subUnitId:u,range:t,order:F}},ee=e.get(i.ICommandService);return i.sequenceExecute([k],ee).result}};function G(e,s,t){const r=[];return t.forEach(({colIndex:n})=>{r.push(e.getCellRaw(s,n))}),r}function q(e){return(s,t,r)=>{for(let n=0;n<e.length;n++){const o=e[n](s,t,r);if(o!=null)return o}return 0}}function B(e,s){return function(t,r){let n=null;for(let o=0;o<e.length;o++){const u=t.value[o],c=r.value[o];if(n=s(e[o].type,u,c),n!==0&&n!==null&&n!==void 0)return n}return 0}}var x=Object.defineProperty,H=Object.getOwnPropertyDescriptor,K=(e,s,t,r)=>{for(var n=r>1?void 0:r?H(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&x(s,t,n),n},y=(e,s)=>(t,r)=>s(t,r,e);let h=class extends i.Disposable{constructor(e,s){super(),this._commandService=e,this._sortService=s,this._initCommands(),this._registerCompareFns()}_initCommands(){[R].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(s,t,r)=>{const n=this._getCommonValue(t),o=this._getCommonValue(r),u=[T,E,O];for(let c=0;c<u.length;c++){const a=u[c](n,o,s);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(A(e))return null;const s=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return s||((e==null?void 0:e.t)===i.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===i.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};h=K([y(0,i.ICommandService),y(1,i.Inject(l.SheetsSortService))],h);var W=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,z=(e,s,t,r)=>{for(var n=r>1?void 0:r?Y(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&W(s,t,n),n},P=(e,s)=>(t,r)=>s(t,r,e);const J="SHEET_SORT_PLUGIN";l.UniverSheetsSortPlugin=(C=class extends i.Plugin{constructor(s=N,t,r){super(),this._config=s,this._injector=t,this._configService=r;const{...n}=this._config;this._configService.setConfig(D,n)}onStarting(){[[h],[l.SheetsSortService]].forEach(s=>this._injector.add(s))}onReady(){this._injector.get(h)}},_(C,"type",i.UniverInstanceType.UNIVER_SHEET),_(C,"pluginName",J),C),l.UniverSheetsSortPlugin=z([P(1,i.Inject(i.Injector)),P(2,i.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=R,l.SortType=d,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort-ui
|
|
43
|
+
|
|
44
|
+
(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"),require("@univerjs/sheets"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets","@univerjs/design"],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))})(this,function(u,s,I,_e,E,C,se,l,m,R){"use strict";var Pt=Object.defineProperty;var Mt=(u,s,I)=>s in u?Pt(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>Mt(u,typeof s!="symbol"?s+"":s,I);const Re="sheets-sort-ui.config",Pe={};var _=function(){return _=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)},Me=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o},P=l.forwardRef(function(e,t){var o=e.icon,n=e.id,r=e.className,i=e.extend,c=Me(e,["icon","id","className","extend"]),S="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),h=l.useRef("_".concat(be()));return ie(o,"".concat(n),{defIds:o.defIds,idSuffix:h.current},_({ref:t,className:S},c),i)});function ie(e,t,o,n,r){return l.createElement(e.tag,_(_({key:t},Ee(e,o,r)),n),(Te(e,o).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),o,void 0,r)}))}function Ee(e,t,o){var n=_({},e.attrs);o!=null&&o.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=o.colorChannel1);var r=t.defIds;return!r||r.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],S=i[1];typeof S=="string"&&(n[c]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(e,t){var o,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((o=e.children)===null||o===void 0)&&o.length)?_(_({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?_(_({},r),{attrs:_(_({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function be(){return Math.random().toString(36).substring(2,8)}P.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},K=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"ascending- single",ref:t,icon:Oe}))});K.displayName="AscendingSingle";var we={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(P,Object.assign({},e,{id:"check-mark-single",ref:t,icon:we}))});ae.displayName="CheckMarkSingle";var je={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(P,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:je}))});ce.displayName="CustomSortSingle";var ke={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(P,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:ke}))});le.displayName="DeleteEmptySingle";var De={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},J=l.forwardRef(function(e,t){return l.createElement(P,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"}}]},de=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});de.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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Le}))});ue.displayName="ExpandDescendingSingle";var He={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=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"increase-single",ref:t,icon:He}))});Q.displayName="IncreaseSingle";var Ue={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(P,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ue}))});me.displayName="MoreDownSingle";var Ae={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(P,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ae}))});Se.displayName="SequenceSingle";var Ce={exports:{}},N={};/**
|
|
45
|
+
* @license React
|
|
46
|
+
* react-jsx-runtime.production.min.js
|
|
47
|
+
*
|
|
48
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the MIT license found in the
|
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/var Be=l,Fe=Symbol.for("react.element"),We=Symbol.for("react.fragment"),Ve=Object.prototype.hasOwnProperty,ze=Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0};function ge(e,t,o){var n,r={},i=null,c=null;o!==void 0&&(i=""+o),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Ve.call(t,n)&&!Ze.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:Fe,type:e,key:i,ref:c,props:r,_owner:ze.current}}N.Fragment=We,N.jsx=ge,N.jsxs=ge,Ce.exports=N;var a=Ce.exports;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"},Ge=e=>{const[t,o]=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(R.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:r=>{o(r),e.onChange(r)},children:[a.jsx(R.Radio,{value:"0",children:n.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(R.Radio,{value:"1",children:n.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ye=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ke=(e,t,o,n)=>{for(var r=n>1?void 0:n?Xe(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ye(t,o,r),r},w=(e,t)=>(o,n)=>t(o,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,o,n,r,i,c,S){super();re(this,"_customSortState$",new se.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=o,this._logService=n,this._selectionManagerService=r,this._sheetsSortService=i,this._localeService=c,this._commandService=S}async triggerSortDirectly(t,o,n){const r=n||await this._detectSortLocation(o);if(!r||!this._check(r))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.SortType.DESC,colIndex:r.colIndex}],range:r.range};return this._sheetsSortService.applySort(c,r.unitId,r.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 o=(h=this.customSortState())==null?void 0:h.location;if(!o)return[];const{unitId:n,subUnitId:r,range:i}=o,c=(f=this._univerInstanceService.getUnit(n))==null?void 0:f.getSheetBySheetId(r);if(!c)return[];const S=Je(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(b,x)=>{var y;const O=(y=c.getCell(i.startRow,x+i.startColumn))==null?void 0:y.v;return{index:x+i.startColumn,label:t?`${O!=null?O:S(x+i.startColumn)}`:S(x+i.startColumn)}})}setSelection(t,o,n){var c;const r=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(o);if(!r)return;const i={unitId:t,subUnitId:o,selections:[{range:n,primary:m.getPrimaryForRange(n,r),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(Ge,{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 o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),n=o.getActiveSheet(),r=o.getUnitId(),i=n.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let S;if(t===!0)S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S);else if(t===!1)S=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?S=c.range:(S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S))}return{range:S,unitId:r,subUnitId:i,colIndex:c.primary.actualColumn}}};p=Ke([w(0,s.IUniverInstanceService),w(1,C.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 o=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${o}"列`;case s.LocaleType.EN_US:return`Column "${o}"`;default:return`Column "${o}"`}}}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)},B={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},W={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},V={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},Z={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},G={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function Qe(){const e=s.useDependency(p),t=s.useDependency(I.SheetsSortService),o=s.useDependency(s.LocaleService),[n,r]=l.useState(!1),[i,c]=l.useState(0),S=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:b,subUnitId:x}=h.location,O=e.getTitles(n),[y,k]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),ne=l.useCallback((g,M)=>{const D=[...y];M===null?D.splice(g,1):D[g]=M,k(D)},[y]),X=l.useCallback(s.throttle(()=>{const g=[...y],M=qe(f,y);M!==null&&(g.push({type:I.SortType.ASC,colIndex:M}),k(g))},200),[y,f]),v=l.useCallback((g,M)=>{t.applySort({range:f,orderRules:g,hasTitle:M}),e.closeCustomSortPanel()},[t,e,f]),oe=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),_t=l.useCallback(g=>{r(g),g?e.setSelection(b,x,{...f,startRow:f.startRow+1}):e.setSelection(b,x,f)},[e,f,x,b]);l.useEffect(()=>{S.current&&y.length>5&&(S.current.scrollTop=S.current.scrollHeight)},[y]);const Rt=y.length<O.length,xe=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(R.Checkbox,{checked:n,onChange:g=>_t(!!g),children:o.t("sheets-sort.dialog.first-row-check")})}),Rt?a.jsxs("div",{className:d.addCondition,onClick:X,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`${d.addCondition} ${d.addConditionDisable}`,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const M=g.currentTarget.scrollTop;c(M)},ref:S,children:a.jsx(R.DraggableList,{list:xe,onListChange:k,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx($e,{titles:O,list:xe,item:g,onChange:(M,D)=>ne(D,M),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>oe(),children:o.t("sheets-sort.dialog.cancel")}),a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,n),children:o.t("sheets-sort.dialog.confirm")})]})]})}function $e(e){var X;const{list:t,item:o,titles:n,onChange:r,scrollPosition:i}=e,c=s.useDependency(s.LocaleService),S=n.filter(v=>!t.some(oe=>oe.colIndex===v.index)||v.index===o.colIndex),h=t.findIndex(v=>v.colIndex===o.colIndex),f=l.useCallback(v=>{r({...o,colIndex:v.index},h),x(!1)},[h,o,r]),[b,x]=l.useState(!1),O=v=>{x(v)};l.useEffect(()=>{x(!1)},[i]);const y=t.length>1,k=(X=n.find(v=>v.index===o.colIndex))==null?void 0:X.label,ne=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(R.Dropdown,{placement:"bottomLeft",trigger:["click"],visible:b,onVisibleChange:O,overlay:a.jsx("ul",{className:d.customSortColMenu,children:S.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===o.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:k}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(R.RadioGroup,{className:ne,value:o.type,onChange:v=>{r({...o,type:v},h)},children:[a.jsx(R.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(R.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:()=>r(null,h)})})]})}function qe(e,t){const{startColumn:o,endColumn:n}=e,r=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=o;i<=n;i++)if(!r.has(i))return i;return null}function et(e){const{range:t,colIndex:o,onClose:n}=e,r=s.useDependency(p),i=s.useDependency(s.IUniverInstanceService),c=s.useDependency(s.LocaleService),S=l.useCallback(h=>{const{unitId:f,subUnitId:b}=m.getSheetCommandTarget(i)||{};if(t&&f&&b){const x={...t,startRow:t.startRow+1};r.triggerSortDirectly(h,!1,{unitId:f,subUnitId:b,range:x,colIndex:o})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${b}, range: ${t}, colIndex: ${o}`);n()},[t,o,r,i,n]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnAsc}`,onClick:()=>S(!0),children:[a.jsx(K,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnDesc}`,onClick:()=>S(!1),children:[a.jsx(J,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const he="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",j="AscendingSingle",$="ExpandAscendingSingle",q="DescendingSingle",ee="ExpandDescendingSingle",te="CustomSortSingle";function tt(e){return{id:he,type:C.MenuItemType.SUBITEMS,icon:j,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function nt(e){return{id:H.id,icon:j,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function ot(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:$,type:C.MenuItemType.BUTTON}}function rt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:q,type:C.MenuItemType.BUTTON}}function st(e){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",icon:ee,type:C.MenuItemType.BUTTON}}function it(e){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te}}function at(e){return{id:fe,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:j,hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ct(e){return{id:W.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:j,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function lt(e){return{id:V.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:$,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function dt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ut(e){return{id:Z.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function mt(e){return{id:G.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const St={[C.RibbonStartGroup.FORMULAS_INSERT]:{[he]:{order:2,menuItemFactory:tt,[H.id]:{order:0,menuItemFactory:nt},[U.id]:{order:1,menuItemFactory:ot},[A.id]:{order:2,menuItemFactory:rt},[B.id]:{order:3,menuItemFactory:st},[F.id]:{order:4,menuItemFactory:it}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:at,[W.id]:{order:0,menuItemFactory:ct},[V.id]:{order:1,menuItemFactory:lt},[z.id]:{order:2,menuItemFactory:dt},[Z.id]:{order:3,menuItemFactory:ut},[G.id]:{order:4,menuItemFactory:mt}}}}};var Ct=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=(e,t,o,n)=>{for(var r=n>1?void 0:n?gt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ct(t,o,r),r},T=(e,t)=>(o,n)=>t(o,n,e);const ve="custom-sort-dialog",ft=560;let Y=class extends s.RxDisposable{constructor(e,t,o,n,r,i,c,S,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=o,this._layoutService=n,this._uiPartsService=r,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=S,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(St)}_initCommands(){[H,U,A,B,F,W,V,z,Z,G].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",Qe)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>s.connectInjector(et,this._injector))),this.disposeWithMe(this._componentManager.register(j,K)),this.disposeWithMe(this._componentManager.register($,de)),this.disposeWithMe(this._componentManager.register(q,J)),this.disposeWithMe(this._componentManager.register(ee,ue)),this.disposeWithMe(this._componentManager.register(te,ce)),this._sheetsSortUIService.customSortState$.pipe(se.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:ve,draggable:!0,width:ft,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:vt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(ve),queueMicrotask(()=>this._layoutService.focus())}};Y=ht([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],Y);function vt(){return{x:0,y:0}}var pe=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,It=(e,t,o)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,yt=(e,t,o,n)=>{for(var r=n>1?void 0:n?pt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&pe(t,o,r),r},Ie=(e,t)=>(o,n)=>t(o,n,e),ye=(e,t,o)=>It(e,typeof t!="symbol"?t+"":t,o);const xt="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=Pe,o,n){super(),this._config=t,this._injector=o,this._configService=n;const{...r}=this._config;this._configService.setConfig(Re,r)}onStarting(){[[p],[Y]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Y)}},ye(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ye(u.UniverSheetsSortUIPlugin,"pluginName",xt),u.UniverSheetsSortUIPlugin=yt([s.DependentOn(I.UniverSheetsSortPlugin),Ie(1,s.Inject(s.Injector)),Ie(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=V,u.SortRangeAscInCtxMenuCommand=W,u.SortRangeCustomCommand=F,u.SortRangeCustomInCtxMenuCommand=G,u.SortRangeDescCommand=A,u.SortRangeDescExtCommand=B,u.SortRangeDescExtInCtxMenuCommand=Z,u.SortRangeDescInCtxMenuCommand=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort
|
|
56
|
+
|
|
57
|
+
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.UniverSheetsSort={},l.UniverCore,l.UniverSheets,l.UniverEngineFormula))})(this,function(l,i,S,j){"use strict";var ne=Object.defineProperty;var re=(l,i,S)=>i in l?ne(l,i,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[i]=S;var _=(l,i,S)=>re(l,typeof i!="symbol"?i+"":i,S);var C;const D="sheets-sort.config",N={};var d=(e=>(e.DESC="desc",e.ASC="asc",e))(d||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),T=(e,s)=>{const t=e===null||e==="",r=s===null||s==="";return t&&r?0:t?1:r?-1:null},O=(e,s,t)=>{const r=typeof e=="number",n=typeof s=="number";return r&&n?e<s?t===d.ASC?-1:1:e>s?t===d.ASC?1:-1:0:r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},E=(e,s,t)=>{const r=typeof e=="string",n=typeof s=="string";if(r&&(e=b(e.toLocaleLowerCase())),n&&(s=b(s.toLocaleLowerCase())),!r&&!n)return null;if(r&&n){const o=e,u=s;return o<u?t===d.ASC?-1:1:o>u?t===d.ASC?1:-1:0}return r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},A=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,V=(e,s,t,r)=>{for(var n=r>1?void 0:r?$(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&M(s,t,n),n},p=(e,s)=>(t,r)=>s(t,r,e);l.SheetsSortService=class extends i.Disposable{constructor(t,r,n){super();_(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=n}mergeCheck(t){var a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(n);if(!u)return!1;const c=u.getMergeData().filter(f=>i.Rectangle.contains(o,f));return c.length===0?!0:L(o,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:n,range:o}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(n);if(!u)return!1;for(let a=o.startRow;a<=o.endRow;a++)for(let f=o.startColumn;f<=o.endColumn;f++)if(!A(u.getCellRaw(a,f)))return!0;return!1}singleCheck(t){return t.range.startRow!==t.range.endRow}formulaCheck(t){var c,a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[n];for(const f in u){const g=u[Number(f)];for(const I in g){const v=g[Number(I)];if(v&&i.Rectangle.intersects(o,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,n){var c;const{unitId:o,subUnitId:u}=S.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(R.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||o,subUnitId:n||u})}},l.SheetsSortService=V([p(0,i.IUniverInstanceService),p(1,i.ICommandService),p(2,i.Inject(j.FormulaDataModel))],l.SheetsSortService);function L(e,s){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let n=null,o=null;const u=t*r;let c=0;for(const a of s)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const f=a.endRow-a.startRow+1,g=a.endColumn-a.startColumn+1;if(n===null&&o===null)n=f,o=g;else if(f!==n||g!==o)return!1;c+=f*g}return c===u}const R={id:"sheet.command.sort-range",type:i.CommandType.COMMAND,handler:(e,s)=>{const{range:t,orderRules:r,hasTitle:n,unitId:o,subUnitId:u}=s,c=e.get(l.SheetsSortService),a=e.get(i.IUniverInstanceService),{worksheet:f}=S.getSheetCommandTarget(a,s)||{};if(!f)return!1;const g=f.getMergeData().filter(m=>i.Rectangle.contains(t,m)),I=g.map(m=>m.startRow),{startRow:v,endRow:Q}=t,X=n?v+1:v,w=[],U=[];for(let m=X;m<=Q;m++)f.getRowFiltered(m)||f.getRowRawVisible(m)!==!1&&(g.length&&!I.includes(m)||(w.push({index:m,value:G(f,m,r)}),U.push(m)));const Z=c.getAllCompareFns();w.sort(B(r,q(Z)));const F={};w.forEach(({index:m,value:oe},te)=>{F[U[te]]=m});const k={id:S.ReorderRangeCommand.id,params:{unitId:o,subUnitId:u,range:t,order:F}},ee=e.get(i.ICommandService);return i.sequenceExecute([k],ee).result}};function G(e,s,t){const r=[];return t.forEach(({colIndex:n})=>{r.push(e.getCellRaw(s,n))}),r}function q(e){return(s,t,r)=>{for(let n=0;n<e.length;n++){const o=e[n](s,t,r);if(o!=null)return o}return 0}}function B(e,s){return function(t,r){let n=null;for(let o=0;o<e.length;o++){const u=t.value[o],c=r.value[o];if(n=s(e[o].type,u,c),n!==0&&n!==null&&n!==void 0)return n}return 0}}var x=Object.defineProperty,H=Object.getOwnPropertyDescriptor,K=(e,s,t,r)=>{for(var n=r>1?void 0:r?H(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&x(s,t,n),n},y=(e,s)=>(t,r)=>s(t,r,e);let h=class extends i.Disposable{constructor(e,s){super(),this._commandService=e,this._sortService=s,this._initCommands(),this._registerCompareFns()}_initCommands(){[R].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(s,t,r)=>{const n=this._getCommonValue(t),o=this._getCommonValue(r),u=[T,E,O];for(let c=0;c<u.length;c++){const a=u[c](n,o,s);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(A(e))return null;const s=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return s||((e==null?void 0:e.t)===i.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===i.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};h=K([y(0,i.ICommandService),y(1,i.Inject(l.SheetsSortService))],h);var W=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,z=(e,s,t,r)=>{for(var n=r>1?void 0:r?Y(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&W(s,t,n),n},P=(e,s)=>(t,r)=>s(t,r,e);const J="SHEET_SORT_PLUGIN";l.UniverSheetsSortPlugin=(C=class extends i.Plugin{constructor(s=N,t,r){super(),this._config=s,this._injector=t,this._configService=r;const{...n}=this._config;this._configService.setConfig(D,n)}onStarting(){[[h],[l.SheetsSortService]].forEach(s=>this._injector.add(s))}onReady(){this._injector.get(h)}},_(C,"type",i.UniverInstanceType.UNIVER_SHEET),_(C,"pluginName",J),C),l.UniverSheetsSortPlugin=z([P(1,i.Inject(i.Injector)),P(2,i.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=R,l.SortType=d,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort-ui
|
|
61
|
+
|
|
62
|
+
(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"),require("@univerjs/sheets"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets","@univerjs/design"],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))})(this,function(u,s,I,_e,E,C,se,l,m,R){"use strict";var Pt=Object.defineProperty;var Mt=(u,s,I)=>s in u?Pt(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>Mt(u,typeof s!="symbol"?s+"":s,I);const Re="sheets-sort-ui.config",Pe={};var _=function(){return _=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)},Me=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o},P=l.forwardRef(function(e,t){var o=e.icon,n=e.id,r=e.className,i=e.extend,c=Me(e,["icon","id","className","extend"]),S="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),h=l.useRef("_".concat(be()));return ie(o,"".concat(n),{defIds:o.defIds,idSuffix:h.current},_({ref:t,className:S},c),i)});function ie(e,t,o,n,r){return l.createElement(e.tag,_(_({key:t},Ee(e,o,r)),n),(Te(e,o).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),o,void 0,r)}))}function Ee(e,t,o){var n=_({},e.attrs);o!=null&&o.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=o.colorChannel1);var r=t.defIds;return!r||r.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],S=i[1];typeof S=="string"&&(n[c]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(e,t){var o,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((o=e.children)===null||o===void 0)&&o.length)?_(_({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?_(_({},r),{attrs:_(_({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function be(){return Math.random().toString(36).substring(2,8)}P.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},K=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"ascending- single",ref:t,icon:Oe}))});K.displayName="AscendingSingle";var we={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(P,Object.assign({},e,{id:"check-mark-single",ref:t,icon:we}))});ae.displayName="CheckMarkSingle";var je={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(P,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:je}))});ce.displayName="CustomSortSingle";var ke={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(P,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:ke}))});le.displayName="DeleteEmptySingle";var De={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},J=l.forwardRef(function(e,t){return l.createElement(P,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"}}]},de=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});de.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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Le}))});ue.displayName="ExpandDescendingSingle";var He={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=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"increase-single",ref:t,icon:He}))});Q.displayName="IncreaseSingle";var Ue={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(P,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ue}))});me.displayName="MoreDownSingle";var Ae={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(P,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ae}))});Se.displayName="SequenceSingle";var Ce={exports:{}},N={};/**
|
|
63
|
+
* @license React
|
|
64
|
+
* react-jsx-runtime.production.min.js
|
|
65
|
+
*
|
|
66
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
67
|
+
*
|
|
68
|
+
* This source code is licensed under the MIT license found in the
|
|
69
|
+
* LICENSE file in the root directory of this source tree.
|
|
70
|
+
*/var Be=l,Fe=Symbol.for("react.element"),We=Symbol.for("react.fragment"),Ve=Object.prototype.hasOwnProperty,ze=Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0};function ge(e,t,o){var n,r={},i=null,c=null;o!==void 0&&(i=""+o),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Ve.call(t,n)&&!Ze.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:Fe,type:e,key:i,ref:c,props:r,_owner:ze.current}}N.Fragment=We,N.jsx=ge,N.jsxs=ge,Ce.exports=N;var a=Ce.exports;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"},Ge=e=>{const[t,o]=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(R.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:r=>{o(r),e.onChange(r)},children:[a.jsx(R.Radio,{value:"0",children:n.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(R.Radio,{value:"1",children:n.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ye=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ke=(e,t,o,n)=>{for(var r=n>1?void 0:n?Xe(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ye(t,o,r),r},w=(e,t)=>(o,n)=>t(o,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,o,n,r,i,c,S){super();re(this,"_customSortState$",new se.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=o,this._logService=n,this._selectionManagerService=r,this._sheetsSortService=i,this._localeService=c,this._commandService=S}async triggerSortDirectly(t,o,n){const r=n||await this._detectSortLocation(o);if(!r||!this._check(r))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.SortType.DESC,colIndex:r.colIndex}],range:r.range};return this._sheetsSortService.applySort(c,r.unitId,r.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 o=(h=this.customSortState())==null?void 0:h.location;if(!o)return[];const{unitId:n,subUnitId:r,range:i}=o,c=(f=this._univerInstanceService.getUnit(n))==null?void 0:f.getSheetBySheetId(r);if(!c)return[];const S=Je(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(b,x)=>{var y;const O=(y=c.getCell(i.startRow,x+i.startColumn))==null?void 0:y.v;return{index:x+i.startColumn,label:t?`${O!=null?O:S(x+i.startColumn)}`:S(x+i.startColumn)}})}setSelection(t,o,n){var c;const r=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(o);if(!r)return;const i={unitId:t,subUnitId:o,selections:[{range:n,primary:m.getPrimaryForRange(n,r),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(Ge,{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 o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),n=o.getActiveSheet(),r=o.getUnitId(),i=n.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let S;if(t===!0)S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S);else if(t===!1)S=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?S=c.range:(S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S))}return{range:S,unitId:r,subUnitId:i,colIndex:c.primary.actualColumn}}};p=Ke([w(0,s.IUniverInstanceService),w(1,C.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 o=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${o}"列`;case s.LocaleType.EN_US:return`Column "${o}"`;default:return`Column "${o}"`}}}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)},B={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},W={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},V={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},Z={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},G={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function Qe(){const e=s.useDependency(p),t=s.useDependency(I.SheetsSortService),o=s.useDependency(s.LocaleService),[n,r]=l.useState(!1),[i,c]=l.useState(0),S=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:b,subUnitId:x}=h.location,O=e.getTitles(n),[y,k]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),ne=l.useCallback((g,M)=>{const D=[...y];M===null?D.splice(g,1):D[g]=M,k(D)},[y]),X=l.useCallback(s.throttle(()=>{const g=[...y],M=qe(f,y);M!==null&&(g.push({type:I.SortType.ASC,colIndex:M}),k(g))},200),[y,f]),v=l.useCallback((g,M)=>{t.applySort({range:f,orderRules:g,hasTitle:M}),e.closeCustomSortPanel()},[t,e,f]),oe=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),_t=l.useCallback(g=>{r(g),g?e.setSelection(b,x,{...f,startRow:f.startRow+1}):e.setSelection(b,x,f)},[e,f,x,b]);l.useEffect(()=>{S.current&&y.length>5&&(S.current.scrollTop=S.current.scrollHeight)},[y]);const Rt=y.length<O.length,xe=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(R.Checkbox,{checked:n,onChange:g=>_t(!!g),children:o.t("sheets-sort.dialog.first-row-check")})}),Rt?a.jsxs("div",{className:d.addCondition,onClick:X,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`${d.addCondition} ${d.addConditionDisable}`,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const M=g.currentTarget.scrollTop;c(M)},ref:S,children:a.jsx(R.DraggableList,{list:xe,onListChange:k,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx($e,{titles:O,list:xe,item:g,onChange:(M,D)=>ne(D,M),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>oe(),children:o.t("sheets-sort.dialog.cancel")}),a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,n),children:o.t("sheets-sort.dialog.confirm")})]})]})}function $e(e){var X;const{list:t,item:o,titles:n,onChange:r,scrollPosition:i}=e,c=s.useDependency(s.LocaleService),S=n.filter(v=>!t.some(oe=>oe.colIndex===v.index)||v.index===o.colIndex),h=t.findIndex(v=>v.colIndex===o.colIndex),f=l.useCallback(v=>{r({...o,colIndex:v.index},h),x(!1)},[h,o,r]),[b,x]=l.useState(!1),O=v=>{x(v)};l.useEffect(()=>{x(!1)},[i]);const y=t.length>1,k=(X=n.find(v=>v.index===o.colIndex))==null?void 0:X.label,ne=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(R.Dropdown,{placement:"bottomLeft",trigger:["click"],visible:b,onVisibleChange:O,overlay:a.jsx("ul",{className:d.customSortColMenu,children:S.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===o.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:k}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(R.RadioGroup,{className:ne,value:o.type,onChange:v=>{r({...o,type:v},h)},children:[a.jsx(R.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(R.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:()=>r(null,h)})})]})}function qe(e,t){const{startColumn:o,endColumn:n}=e,r=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=o;i<=n;i++)if(!r.has(i))return i;return null}function et(e){const{range:t,colIndex:o,onClose:n}=e,r=s.useDependency(p),i=s.useDependency(s.IUniverInstanceService),c=s.useDependency(s.LocaleService),S=l.useCallback(h=>{const{unitId:f,subUnitId:b}=m.getSheetCommandTarget(i)||{};if(t&&f&&b){const x={...t,startRow:t.startRow+1};r.triggerSortDirectly(h,!1,{unitId:f,subUnitId:b,range:x,colIndex:o})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${b}, range: ${t}, colIndex: ${o}`);n()},[t,o,r,i,n]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnAsc}`,onClick:()=>S(!0),children:[a.jsx(K,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnDesc}`,onClick:()=>S(!1),children:[a.jsx(J,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const he="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",j="AscendingSingle",$="ExpandAscendingSingle",q="DescendingSingle",ee="ExpandDescendingSingle",te="CustomSortSingle";function tt(e){return{id:he,type:C.MenuItemType.SUBITEMS,icon:j,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function nt(e){return{id:H.id,icon:j,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function ot(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:$,type:C.MenuItemType.BUTTON}}function rt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:q,type:C.MenuItemType.BUTTON}}function st(e){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",icon:ee,type:C.MenuItemType.BUTTON}}function it(e){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te}}function at(e){return{id:fe,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:j,hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ct(e){return{id:W.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:j,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function lt(e){return{id:V.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:$,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function dt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ut(e){return{id:Z.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function mt(e){return{id:G.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const St={[C.RibbonStartGroup.FORMULAS_INSERT]:{[he]:{order:2,menuItemFactory:tt,[H.id]:{order:0,menuItemFactory:nt},[U.id]:{order:1,menuItemFactory:ot},[A.id]:{order:2,menuItemFactory:rt},[B.id]:{order:3,menuItemFactory:st},[F.id]:{order:4,menuItemFactory:it}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:at,[W.id]:{order:0,menuItemFactory:ct},[V.id]:{order:1,menuItemFactory:lt},[z.id]:{order:2,menuItemFactory:dt},[Z.id]:{order:3,menuItemFactory:ut},[G.id]:{order:4,menuItemFactory:mt}}}}};var Ct=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=(e,t,o,n)=>{for(var r=n>1?void 0:n?gt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ct(t,o,r),r},T=(e,t)=>(o,n)=>t(o,n,e);const ve="custom-sort-dialog",ft=560;let Y=class extends s.RxDisposable{constructor(e,t,o,n,r,i,c,S,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=o,this._layoutService=n,this._uiPartsService=r,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=S,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(St)}_initCommands(){[H,U,A,B,F,W,V,z,Z,G].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",Qe)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>s.connectInjector(et,this._injector))),this.disposeWithMe(this._componentManager.register(j,K)),this.disposeWithMe(this._componentManager.register($,de)),this.disposeWithMe(this._componentManager.register(q,J)),this.disposeWithMe(this._componentManager.register(ee,ue)),this.disposeWithMe(this._componentManager.register(te,ce)),this._sheetsSortUIService.customSortState$.pipe(se.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:ve,draggable:!0,width:ft,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:vt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(ve),queueMicrotask(()=>this._layoutService.focus())}};Y=ht([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],Y);function vt(){return{x:0,y:0}}var pe=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,It=(e,t,o)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,yt=(e,t,o,n)=>{for(var r=n>1?void 0:n?pt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&pe(t,o,r),r},Ie=(e,t)=>(o,n)=>t(o,n,e),ye=(e,t,o)=>It(e,typeof t!="symbol"?t+"":t,o);const xt="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=Pe,o,n){super(),this._config=t,this._injector=o,this._configService=n;const{...r}=this._config;this._configService.setConfig(Re,r)}onStarting(){[[p],[Y]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Y)}},ye(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ye(u.UniverSheetsSortUIPlugin,"pluginName",xt),u.UniverSheetsSortUIPlugin=yt([s.DependentOn(I.UniverSheetsSortPlugin),Ie(1,s.Inject(s.Injector)),Ie(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=V,u.SortRangeAscInCtxMenuCommand=W,u.SortRangeCustomCommand=F,u.SortRangeCustomInCtxMenuCommand=G,u.SortRangeDescCommand=A,u.SortRangeDescExtCommand=B,u.SortRangeDescExtInCtxMenuCommand=Z,u.SortRangeDescInCtxMenuCommand=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort
|
|
74
|
+
|
|
75
|
+
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.UniverSheetsSort={},l.UniverCore,l.UniverSheets,l.UniverEngineFormula))})(this,function(l,i,S,j){"use strict";var ne=Object.defineProperty;var re=(l,i,S)=>i in l?ne(l,i,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[i]=S;var _=(l,i,S)=>re(l,typeof i!="symbol"?i+"":i,S);var C;const D="sheets-sort.config",N={};var d=(e=>(e.DESC="desc",e.ASC="asc",e))(d||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),T=(e,s)=>{const t=e===null||e==="",r=s===null||s==="";return t&&r?0:t?1:r?-1:null},O=(e,s,t)=>{const r=typeof e=="number",n=typeof s=="number";return r&&n?e<s?t===d.ASC?-1:1:e>s?t===d.ASC?1:-1:0:r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},E=(e,s,t)=>{const r=typeof e=="string",n=typeof s=="string";if(r&&(e=b(e.toLocaleLowerCase())),n&&(s=b(s.toLocaleLowerCase())),!r&&!n)return null;if(r&&n){const o=e,u=s;return o<u?t===d.ASC?-1:1:o>u?t===d.ASC?1:-1:0}return r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},A=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,V=(e,s,t,r)=>{for(var n=r>1?void 0:r?$(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&M(s,t,n),n},p=(e,s)=>(t,r)=>s(t,r,e);l.SheetsSortService=class extends i.Disposable{constructor(t,r,n){super();_(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=n}mergeCheck(t){var a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(n);if(!u)return!1;const c=u.getMergeData().filter(f=>i.Rectangle.contains(o,f));return c.length===0?!0:L(o,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:n,range:o}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(n);if(!u)return!1;for(let a=o.startRow;a<=o.endRow;a++)for(let f=o.startColumn;f<=o.endColumn;f++)if(!A(u.getCellRaw(a,f)))return!0;return!1}singleCheck(t){return t.range.startRow!==t.range.endRow}formulaCheck(t){var c,a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[n];for(const f in u){const g=u[Number(f)];for(const I in g){const v=g[Number(I)];if(v&&i.Rectangle.intersects(o,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,n){var c;const{unitId:o,subUnitId:u}=S.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(R.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||o,subUnitId:n||u})}},l.SheetsSortService=V([p(0,i.IUniverInstanceService),p(1,i.ICommandService),p(2,i.Inject(j.FormulaDataModel))],l.SheetsSortService);function L(e,s){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let n=null,o=null;const u=t*r;let c=0;for(const a of s)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const f=a.endRow-a.startRow+1,g=a.endColumn-a.startColumn+1;if(n===null&&o===null)n=f,o=g;else if(f!==n||g!==o)return!1;c+=f*g}return c===u}const R={id:"sheet.command.sort-range",type:i.CommandType.COMMAND,handler:(e,s)=>{const{range:t,orderRules:r,hasTitle:n,unitId:o,subUnitId:u}=s,c=e.get(l.SheetsSortService),a=e.get(i.IUniverInstanceService),{worksheet:f}=S.getSheetCommandTarget(a,s)||{};if(!f)return!1;const g=f.getMergeData().filter(m=>i.Rectangle.contains(t,m)),I=g.map(m=>m.startRow),{startRow:v,endRow:Q}=t,X=n?v+1:v,w=[],U=[];for(let m=X;m<=Q;m++)f.getRowFiltered(m)||f.getRowRawVisible(m)!==!1&&(g.length&&!I.includes(m)||(w.push({index:m,value:G(f,m,r)}),U.push(m)));const Z=c.getAllCompareFns();w.sort(B(r,q(Z)));const F={};w.forEach(({index:m,value:oe},te)=>{F[U[te]]=m});const k={id:S.ReorderRangeCommand.id,params:{unitId:o,subUnitId:u,range:t,order:F}},ee=e.get(i.ICommandService);return i.sequenceExecute([k],ee).result}};function G(e,s,t){const r=[];return t.forEach(({colIndex:n})=>{r.push(e.getCellRaw(s,n))}),r}function q(e){return(s,t,r)=>{for(let n=0;n<e.length;n++){const o=e[n](s,t,r);if(o!=null)return o}return 0}}function B(e,s){return function(t,r){let n=null;for(let o=0;o<e.length;o++){const u=t.value[o],c=r.value[o];if(n=s(e[o].type,u,c),n!==0&&n!==null&&n!==void 0)return n}return 0}}var x=Object.defineProperty,H=Object.getOwnPropertyDescriptor,K=(e,s,t,r)=>{for(var n=r>1?void 0:r?H(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&x(s,t,n),n},y=(e,s)=>(t,r)=>s(t,r,e);let h=class extends i.Disposable{constructor(e,s){super(),this._commandService=e,this._sortService=s,this._initCommands(),this._registerCompareFns()}_initCommands(){[R].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(s,t,r)=>{const n=this._getCommonValue(t),o=this._getCommonValue(r),u=[T,E,O];for(let c=0;c<u.length;c++){const a=u[c](n,o,s);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(A(e))return null;const s=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return s||((e==null?void 0:e.t)===i.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===i.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};h=K([y(0,i.ICommandService),y(1,i.Inject(l.SheetsSortService))],h);var W=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,z=(e,s,t,r)=>{for(var n=r>1?void 0:r?Y(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&W(s,t,n),n},P=(e,s)=>(t,r)=>s(t,r,e);const J="SHEET_SORT_PLUGIN";l.UniverSheetsSortPlugin=(C=class extends i.Plugin{constructor(s=N,t,r){super(),this._config=s,this._injector=t,this._configService=r;const{...n}=this._config;this._configService.setConfig(D,n)}onStarting(){[[h],[l.SheetsSortService]].forEach(s=>this._injector.add(s))}onReady(){this._injector.get(h)}},_(C,"type",i.UniverInstanceType.UNIVER_SHEET),_(C,"pluginName",J),C),l.UniverSheetsSortPlugin=z([P(1,i.Inject(i.Injector)),P(2,i.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=R,l.SortType=d,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort-ui
|
|
79
|
+
|
|
80
|
+
(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"),require("@univerjs/sheets"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets","@univerjs/design"],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))})(this,function(u,s,I,_e,E,C,se,l,m,R){"use strict";var Pt=Object.defineProperty;var Mt=(u,s,I)=>s in u?Pt(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>Mt(u,typeof s!="symbol"?s+"":s,I);const Re="sheets-sort-ui.config",Pe={};var _=function(){return _=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)},Me=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o},P=l.forwardRef(function(e,t){var o=e.icon,n=e.id,r=e.className,i=e.extend,c=Me(e,["icon","id","className","extend"]),S="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),h=l.useRef("_".concat(be()));return ie(o,"".concat(n),{defIds:o.defIds,idSuffix:h.current},_({ref:t,className:S},c),i)});function ie(e,t,o,n,r){return l.createElement(e.tag,_(_({key:t},Ee(e,o,r)),n),(Te(e,o).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),o,void 0,r)}))}function Ee(e,t,o){var n=_({},e.attrs);o!=null&&o.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=o.colorChannel1);var r=t.defIds;return!r||r.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],S=i[1];typeof S=="string"&&(n[c]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(e,t){var o,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((o=e.children)===null||o===void 0)&&o.length)?_(_({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?_(_({},r),{attrs:_(_({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function be(){return Math.random().toString(36).substring(2,8)}P.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},K=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"ascending- single",ref:t,icon:Oe}))});K.displayName="AscendingSingle";var we={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(P,Object.assign({},e,{id:"check-mark-single",ref:t,icon:we}))});ae.displayName="CheckMarkSingle";var je={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(P,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:je}))});ce.displayName="CustomSortSingle";var ke={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(P,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:ke}))});le.displayName="DeleteEmptySingle";var De={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},J=l.forwardRef(function(e,t){return l.createElement(P,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"}}]},de=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});de.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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Le}))});ue.displayName="ExpandDescendingSingle";var He={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=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"increase-single",ref:t,icon:He}))});Q.displayName="IncreaseSingle";var Ue={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(P,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ue}))});me.displayName="MoreDownSingle";var Ae={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(P,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ae}))});Se.displayName="SequenceSingle";var Ce={exports:{}},N={};/**
|
|
81
|
+
* @license React
|
|
82
|
+
* react-jsx-runtime.production.min.js
|
|
83
|
+
*
|
|
84
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
85
|
+
*
|
|
86
|
+
* This source code is licensed under the MIT license found in the
|
|
87
|
+
* LICENSE file in the root directory of this source tree.
|
|
88
|
+
*/var Be=l,Fe=Symbol.for("react.element"),We=Symbol.for("react.fragment"),Ve=Object.prototype.hasOwnProperty,ze=Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0};function ge(e,t,o){var n,r={},i=null,c=null;o!==void 0&&(i=""+o),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Ve.call(t,n)&&!Ze.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:Fe,type:e,key:i,ref:c,props:r,_owner:ze.current}}N.Fragment=We,N.jsx=ge,N.jsxs=ge,Ce.exports=N;var a=Ce.exports;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"},Ge=e=>{const[t,o]=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(R.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:r=>{o(r),e.onChange(r)},children:[a.jsx(R.Radio,{value:"0",children:n.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(R.Radio,{value:"1",children:n.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ye=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ke=(e,t,o,n)=>{for(var r=n>1?void 0:n?Xe(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ye(t,o,r),r},w=(e,t)=>(o,n)=>t(o,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,o,n,r,i,c,S){super();re(this,"_customSortState$",new se.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=o,this._logService=n,this._selectionManagerService=r,this._sheetsSortService=i,this._localeService=c,this._commandService=S}async triggerSortDirectly(t,o,n){const r=n||await this._detectSortLocation(o);if(!r||!this._check(r))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.SortType.DESC,colIndex:r.colIndex}],range:r.range};return this._sheetsSortService.applySort(c,r.unitId,r.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 o=(h=this.customSortState())==null?void 0:h.location;if(!o)return[];const{unitId:n,subUnitId:r,range:i}=o,c=(f=this._univerInstanceService.getUnit(n))==null?void 0:f.getSheetBySheetId(r);if(!c)return[];const S=Je(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(b,x)=>{var y;const O=(y=c.getCell(i.startRow,x+i.startColumn))==null?void 0:y.v;return{index:x+i.startColumn,label:t?`${O!=null?O:S(x+i.startColumn)}`:S(x+i.startColumn)}})}setSelection(t,o,n){var c;const r=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(o);if(!r)return;const i={unitId:t,subUnitId:o,selections:[{range:n,primary:m.getPrimaryForRange(n,r),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(Ge,{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 o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),n=o.getActiveSheet(),r=o.getUnitId(),i=n.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let S;if(t===!0)S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S);else if(t===!1)S=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?S=c.range:(S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S))}return{range:S,unitId:r,subUnitId:i,colIndex:c.primary.actualColumn}}};p=Ke([w(0,s.IUniverInstanceService),w(1,C.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 o=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${o}"列`;case s.LocaleType.EN_US:return`Column "${o}"`;default:return`Column "${o}"`}}}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)},B={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},W={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},V={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},Z={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},G={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function Qe(){const e=s.useDependency(p),t=s.useDependency(I.SheetsSortService),o=s.useDependency(s.LocaleService),[n,r]=l.useState(!1),[i,c]=l.useState(0),S=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:b,subUnitId:x}=h.location,O=e.getTitles(n),[y,k]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),ne=l.useCallback((g,M)=>{const D=[...y];M===null?D.splice(g,1):D[g]=M,k(D)},[y]),X=l.useCallback(s.throttle(()=>{const g=[...y],M=qe(f,y);M!==null&&(g.push({type:I.SortType.ASC,colIndex:M}),k(g))},200),[y,f]),v=l.useCallback((g,M)=>{t.applySort({range:f,orderRules:g,hasTitle:M}),e.closeCustomSortPanel()},[t,e,f]),oe=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),_t=l.useCallback(g=>{r(g),g?e.setSelection(b,x,{...f,startRow:f.startRow+1}):e.setSelection(b,x,f)},[e,f,x,b]);l.useEffect(()=>{S.current&&y.length>5&&(S.current.scrollTop=S.current.scrollHeight)},[y]);const Rt=y.length<O.length,xe=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(R.Checkbox,{checked:n,onChange:g=>_t(!!g),children:o.t("sheets-sort.dialog.first-row-check")})}),Rt?a.jsxs("div",{className:d.addCondition,onClick:X,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`${d.addCondition} ${d.addConditionDisable}`,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const M=g.currentTarget.scrollTop;c(M)},ref:S,children:a.jsx(R.DraggableList,{list:xe,onListChange:k,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx($e,{titles:O,list:xe,item:g,onChange:(M,D)=>ne(D,M),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>oe(),children:o.t("sheets-sort.dialog.cancel")}),a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,n),children:o.t("sheets-sort.dialog.confirm")})]})]})}function $e(e){var X;const{list:t,item:o,titles:n,onChange:r,scrollPosition:i}=e,c=s.useDependency(s.LocaleService),S=n.filter(v=>!t.some(oe=>oe.colIndex===v.index)||v.index===o.colIndex),h=t.findIndex(v=>v.colIndex===o.colIndex),f=l.useCallback(v=>{r({...o,colIndex:v.index},h),x(!1)},[h,o,r]),[b,x]=l.useState(!1),O=v=>{x(v)};l.useEffect(()=>{x(!1)},[i]);const y=t.length>1,k=(X=n.find(v=>v.index===o.colIndex))==null?void 0:X.label,ne=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(R.Dropdown,{placement:"bottomLeft",trigger:["click"],visible:b,onVisibleChange:O,overlay:a.jsx("ul",{className:d.customSortColMenu,children:S.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===o.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:k}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(R.RadioGroup,{className:ne,value:o.type,onChange:v=>{r({...o,type:v},h)},children:[a.jsx(R.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(R.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:()=>r(null,h)})})]})}function qe(e,t){const{startColumn:o,endColumn:n}=e,r=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=o;i<=n;i++)if(!r.has(i))return i;return null}function et(e){const{range:t,colIndex:o,onClose:n}=e,r=s.useDependency(p),i=s.useDependency(s.IUniverInstanceService),c=s.useDependency(s.LocaleService),S=l.useCallback(h=>{const{unitId:f,subUnitId:b}=m.getSheetCommandTarget(i)||{};if(t&&f&&b){const x={...t,startRow:t.startRow+1};r.triggerSortDirectly(h,!1,{unitId:f,subUnitId:b,range:x,colIndex:o})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${b}, range: ${t}, colIndex: ${o}`);n()},[t,o,r,i,n]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnAsc}`,onClick:()=>S(!0),children:[a.jsx(K,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnDesc}`,onClick:()=>S(!1),children:[a.jsx(J,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const he="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",j="AscendingSingle",$="ExpandAscendingSingle",q="DescendingSingle",ee="ExpandDescendingSingle",te="CustomSortSingle";function tt(e){return{id:he,type:C.MenuItemType.SUBITEMS,icon:j,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function nt(e){return{id:H.id,icon:j,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function ot(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:$,type:C.MenuItemType.BUTTON}}function rt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:q,type:C.MenuItemType.BUTTON}}function st(e){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",icon:ee,type:C.MenuItemType.BUTTON}}function it(e){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te}}function at(e){return{id:fe,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:j,hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ct(e){return{id:W.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:j,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function lt(e){return{id:V.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:$,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function dt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ut(e){return{id:Z.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function mt(e){return{id:G.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const St={[C.RibbonStartGroup.FORMULAS_INSERT]:{[he]:{order:2,menuItemFactory:tt,[H.id]:{order:0,menuItemFactory:nt},[U.id]:{order:1,menuItemFactory:ot},[A.id]:{order:2,menuItemFactory:rt},[B.id]:{order:3,menuItemFactory:st},[F.id]:{order:4,menuItemFactory:it}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:at,[W.id]:{order:0,menuItemFactory:ct},[V.id]:{order:1,menuItemFactory:lt},[z.id]:{order:2,menuItemFactory:dt},[Z.id]:{order:3,menuItemFactory:ut},[G.id]:{order:4,menuItemFactory:mt}}}}};var Ct=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=(e,t,o,n)=>{for(var r=n>1?void 0:n?gt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ct(t,o,r),r},T=(e,t)=>(o,n)=>t(o,n,e);const ve="custom-sort-dialog",ft=560;let Y=class extends s.RxDisposable{constructor(e,t,o,n,r,i,c,S,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=o,this._layoutService=n,this._uiPartsService=r,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=S,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(St)}_initCommands(){[H,U,A,B,F,W,V,z,Z,G].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",Qe)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>s.connectInjector(et,this._injector))),this.disposeWithMe(this._componentManager.register(j,K)),this.disposeWithMe(this._componentManager.register($,de)),this.disposeWithMe(this._componentManager.register(q,J)),this.disposeWithMe(this._componentManager.register(ee,ue)),this.disposeWithMe(this._componentManager.register(te,ce)),this._sheetsSortUIService.customSortState$.pipe(se.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:ve,draggable:!0,width:ft,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:vt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(ve),queueMicrotask(()=>this._layoutService.focus())}};Y=ht([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],Y);function vt(){return{x:0,y:0}}var pe=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,It=(e,t,o)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,yt=(e,t,o,n)=>{for(var r=n>1?void 0:n?pt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&pe(t,o,r),r},Ie=(e,t)=>(o,n)=>t(o,n,e),ye=(e,t,o)=>It(e,typeof t!="symbol"?t+"":t,o);const xt="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=Pe,o,n){super(),this._config=t,this._injector=o,this._configService=n;const{...r}=this._config;this._configService.setConfig(Re,r)}onStarting(){[[p],[Y]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Y)}},ye(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ye(u.UniverSheetsSortUIPlugin,"pluginName",xt),u.UniverSheetsSortUIPlugin=yt([s.DependentOn(I.UniverSheetsSortPlugin),Ie(1,s.Inject(s.Injector)),Ie(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=V,u.SortRangeAscInCtxMenuCommand=W,u.SortRangeCustomCommand=F,u.SortRangeCustomInCtxMenuCommand=G,u.SortRangeDescCommand=A,u.SortRangeDescExtCommand=B,u.SortRangeDescExtInCtxMenuCommand=Z,u.SortRangeDescInCtxMenuCommand=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort
|
|
92
|
+
|
|
93
|
+
(function(l,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@univerjs/core"),require("@univerjs/sheets"),require("@univerjs/engine-formula")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets","@univerjs/engine-formula"],i):(l=typeof globalThis<"u"?globalThis:l||self,i(l.UniverSheetsSort={},l.UniverCore,l.UniverSheets,l.UniverEngineFormula))})(this,function(l,i,S,j){"use strict";var ne=Object.defineProperty;var re=(l,i,S)=>i in l?ne(l,i,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[i]=S;var _=(l,i,S)=>re(l,typeof i!="symbol"?i+"":i,S);var C;const D="sheets-sort.config",N={};var d=(e=>(e.DESC="desc",e.ASC="asc",e))(d||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),T=(e,s)=>{const t=e===null||e==="",r=s===null||s==="";return t&&r?0:t?1:r?-1:null},O=(e,s,t)=>{const r=typeof e=="number",n=typeof s=="number";return r&&n?e<s?t===d.ASC?-1:1:e>s?t===d.ASC?1:-1:0:r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},E=(e,s,t)=>{const r=typeof e=="string",n=typeof s=="string";if(r&&(e=b(e.toLocaleLowerCase())),n&&(s=b(s.toLocaleLowerCase())),!r&&!n)return null;if(r&&n){const o=e,u=s;return o<u?t===d.ASC?-1:1:o>u?t===d.ASC?1:-1:0}return r?t===d.ASC?1:-1:n?t===d.ASC?-1:1:null},A=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.defineProperty,$=Object.getOwnPropertyDescriptor,V=(e,s,t,r)=>{for(var n=r>1?void 0:r?$(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&M(s,t,n),n},p=(e,s)=>(t,r)=>s(t,r,e);l.SheetsSortService=class extends i.Disposable{constructor(t,r,n){super();_(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=n}mergeCheck(t){var a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(n);if(!u)return!1;const c=u.getMergeData().filter(f=>i.Rectangle.contains(o,f));return c.length===0?!0:L(o,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:n,range:o}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(n);if(!u)return!1;for(let a=o.startRow;a<=o.endRow;a++)for(let f=o.startColumn;f<=o.endColumn;f++)if(!A(u.getCellRaw(a,f)))return!0;return!1}singleCheck(t){return t.range.startRow!==t.range.endRow}formulaCheck(t){var c,a;const{unitId:r,subUnitId:n,range:o}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[n];for(const f in u){const g=u[Number(f)];for(const I in g){const v=g[Number(I)];if(v&&i.Rectangle.intersects(o,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,n){var c;const{unitId:o,subUnitId:u}=S.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(R.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||o,subUnitId:n||u})}},l.SheetsSortService=V([p(0,i.IUniverInstanceService),p(1,i.ICommandService),p(2,i.Inject(j.FormulaDataModel))],l.SheetsSortService);function L(e,s){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let n=null,o=null;const u=t*r;let c=0;for(const a of s)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const f=a.endRow-a.startRow+1,g=a.endColumn-a.startColumn+1;if(n===null&&o===null)n=f,o=g;else if(f!==n||g!==o)return!1;c+=f*g}return c===u}const R={id:"sheet.command.sort-range",type:i.CommandType.COMMAND,handler:(e,s)=>{const{range:t,orderRules:r,hasTitle:n,unitId:o,subUnitId:u}=s,c=e.get(l.SheetsSortService),a=e.get(i.IUniverInstanceService),{worksheet:f}=S.getSheetCommandTarget(a,s)||{};if(!f)return!1;const g=f.getMergeData().filter(m=>i.Rectangle.contains(t,m)),I=g.map(m=>m.startRow),{startRow:v,endRow:Q}=t,X=n?v+1:v,w=[],U=[];for(let m=X;m<=Q;m++)f.getRowFiltered(m)||f.getRowRawVisible(m)!==!1&&(g.length&&!I.includes(m)||(w.push({index:m,value:G(f,m,r)}),U.push(m)));const Z=c.getAllCompareFns();w.sort(B(r,q(Z)));const F={};w.forEach(({index:m,value:oe},te)=>{F[U[te]]=m});const k={id:S.ReorderRangeCommand.id,params:{unitId:o,subUnitId:u,range:t,order:F}},ee=e.get(i.ICommandService);return i.sequenceExecute([k],ee).result}};function G(e,s,t){const r=[];return t.forEach(({colIndex:n})=>{r.push(e.getCellRaw(s,n))}),r}function q(e){return(s,t,r)=>{for(let n=0;n<e.length;n++){const o=e[n](s,t,r);if(o!=null)return o}return 0}}function B(e,s){return function(t,r){let n=null;for(let o=0;o<e.length;o++){const u=t.value[o],c=r.value[o];if(n=s(e[o].type,u,c),n!==0&&n!==null&&n!==void 0)return n}return 0}}var x=Object.defineProperty,H=Object.getOwnPropertyDescriptor,K=(e,s,t,r)=>{for(var n=r>1?void 0:r?H(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&x(s,t,n),n},y=(e,s)=>(t,r)=>s(t,r,e);let h=class extends i.Disposable{constructor(e,s){super(),this._commandService=e,this._sortService=s,this._initCommands(),this._registerCompareFns()}_initCommands(){[R].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(s,t,r)=>{const n=this._getCommonValue(t),o=this._getCommonValue(r),u=[T,E,O];for(let c=0;c<u.length;c++){const a=u[c](n,o,s);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(A(e))return null;const s=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return s||((e==null?void 0:e.t)===i.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===i.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===i.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};h=K([y(0,i.ICommandService),y(1,i.Inject(l.SheetsSortService))],h);var W=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,z=(e,s,t,r)=>{for(var n=r>1?void 0:r?Y(s,t):s,o=e.length-1,u;o>=0;o--)(u=e[o])&&(n=(r?u(s,t,n):u(n))||n);return r&&n&&W(s,t,n),n},P=(e,s)=>(t,r)=>s(t,r,e);const J="SHEET_SORT_PLUGIN";l.UniverSheetsSortPlugin=(C=class extends i.Plugin{constructor(s=N,t,r){super(),this._config=s,this._injector=t,this._configService=r;const{...n}=this._config;this._configService.setConfig(D,n)}onStarting(){[[h],[l.SheetsSortService]].forEach(s=>this._injector.add(s))}onReady(){this._injector.get(h)}},_(C,"type",i.UniverInstanceType.UNIVER_SHEET),_(C,"pluginName",J),C),l.UniverSheetsSortPlugin=z([P(1,i.Inject(i.Injector)),P(2,i.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=R,l.SortType=d,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
// /home/runner/work/univer-presets/univer-presets/packages/preset-sheets-sort/node_modules/@univerjs/sheets-sort-ui
|
|
97
|
+
|
|
98
|
+
(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"),require("@univerjs/sheets"),require("@univerjs/design")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-sort","@univerjs/engine-formula","@univerjs/sheets-ui","@univerjs/ui","rxjs","react","@univerjs/sheets","@univerjs/design"],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))})(this,function(u,s,I,_e,E,C,se,l,m,R){"use strict";var Pt=Object.defineProperty;var Mt=(u,s,I)=>s in u?Pt(u,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):u[s]=I;var re=(u,s,I)=>Mt(u,typeof s!="symbol"?s+"":s,I);const Re="sheets-sort-ui.config",Pe={};var _=function(){return _=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},_.apply(this,arguments)},Me=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o},P=l.forwardRef(function(e,t){var o=e.icon,n=e.id,r=e.className,i=e.extend,c=Me(e,["icon","id","className","extend"]),S="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),h=l.useRef("_".concat(be()));return ie(o,"".concat(n),{defIds:o.defIds,idSuffix:h.current},_({ref:t,className:S},c),i)});function ie(e,t,o,n,r){return l.createElement(e.tag,_(_({key:t},Ee(e,o,r)),n),(Te(e,o).children||[]).map(function(i,c){return ie(i,"".concat(t,"-").concat(e.tag,"-").concat(c),o,void 0,r)}))}function Ee(e,t,o){var n=_({},e.attrs);o!=null&&o.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=o.colorChannel1);var r=t.defIds;return!r||r.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],S=i[1];typeof S=="string"&&(n[c]=S.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Te(e,t){var o,n=t.defIds;return!n||n.length===0?e:e.tag==="defs"&&(!((o=e.children)===null||o===void 0)&&o.length)?_(_({},e),{children:e.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?_(_({},r),{attrs:_(_({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):e}function be(){return Math.random().toString(36).substring(2,8)}P.displayName="UniverIcon";var Oe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},K=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"ascending- single",ref:t,icon:Oe}))});K.displayName="AscendingSingle";var we={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(P,Object.assign({},e,{id:"check-mark-single",ref:t,icon:we}))});ae.displayName="CheckMarkSingle";var je={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(P,Object.assign({},e,{id:"custom-sort-single",ref:t,icon:je}))});ce.displayName="CustomSortSingle";var ke={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(P,Object.assign({},e,{id:"delete-empty-single",ref:t,icon:ke}))});le.displayName="DeleteEmptySingle";var De={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z"}},{tag:"path",attrs:{fill:"currentColor",d:"M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z",fillRule:"evenodd",clipRule:"evenodd"}}]},J=l.forwardRef(function(e,t){return l.createElement(P,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"}}]},de=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-ascending-single",ref:t,icon:Ne}))});de.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"}}]},ue=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"expand-descending-single",ref:t,icon:Le}))});ue.displayName="ExpandDescendingSingle";var He={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=l.forwardRef(function(e,t){return l.createElement(P,Object.assign({},e,{id:"increase-single",ref:t,icon:He}))});Q.displayName="IncreaseSingle";var Ue={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(P,Object.assign({},e,{id:"more-down-single",ref:t,icon:Ue}))});me.displayName="MoreDownSingle";var Ae={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(P,Object.assign({},e,{id:"sequence-single",ref:t,icon:Ae}))});Se.displayName="SequenceSingle";var Ce={exports:{}},N={};/**
|
|
99
|
+
* @license React
|
|
100
|
+
* react-jsx-runtime.production.min.js
|
|
101
|
+
*
|
|
102
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the MIT license found in the
|
|
105
|
+
* LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/var Be=l,Fe=Symbol.for("react.element"),We=Symbol.for("react.fragment"),Ve=Object.prototype.hasOwnProperty,ze=Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ze={key:!0,ref:!0,__self:!0,__source:!0};function ge(e,t,o){var n,r={},i=null,c=null;o!==void 0&&(i=""+o),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(c=t.ref);for(n in t)Ve.call(t,n)&&!Ze.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:Fe,type:e,key:i,ref:c,props:r,_owner:ze.current}}N.Fragment=We,N.jsx=ge,N.jsxs=ge,Ce.exports=N;var a=Ce.exports;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"},Ge=e=>{const[t,o]=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(R.RadioGroup,{className:d.extendConfirmRadioGroup,value:t,direction:"vertical",onChange:r=>{o(r),e.onChange(r)},children:[a.jsx(R.Radio,{value:"0",children:n.t("sheets-sort.dialog.sort-reminder-no")}),a.jsx(R.Radio,{value:"1",children:n.t("sheets-sort.dialog.sort-reminder-ext")})]})]})};var Ye=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ke=(e,t,o,n)=>{for(var r=n>1?void 0:n?Xe(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ye(t,o,r),r},w=(e,t)=>(o,n)=>t(o,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,o,n,r,i,c,S){super();re(this,"_customSortState$",new se.BehaviorSubject(null));re(this,"customSortState$",this._customSortState$.asObservable());this._univerInstanceService=t,this._confirmService=o,this._logService=n,this._selectionManagerService=r,this._sheetsSortService=i,this._localeService=c,this._commandService=S}async triggerSortDirectly(t,o,n){const r=n||await this._detectSortLocation(o);if(!r||!this._check(r))return!1;const c={orderRules:[{type:t?I.SortType.ASC:I.SortType.DESC,colIndex:r.colIndex}],range:r.range};return this._sheetsSortService.applySort(c,r.unitId,r.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 o=(h=this.customSortState())==null?void 0:h.location;if(!o)return[];const{unitId:n,subUnitId:r,range:i}=o,c=(f=this._univerInstanceService.getUnit(n))==null?void 0:f.getSheetBySheetId(r);if(!c)return[];const S=Je(this._localeService);return Array.from({length:i.endColumn-i.startColumn+1},(b,x)=>{var y;const O=(y=c.getCell(i.startRow,x+i.startColumn))==null?void 0:y.v;return{index:x+i.startColumn,label:t?`${O!=null?O:S(x+i.startColumn)}`:S(x+i.startColumn)}})}setSelection(t,o,n){var c;const r=(c=this._univerInstanceService.getUnit(t))==null?void 0:c.getSheetBySheetId(o);if(!r)return;const i={unitId:t,subUnitId:o,selections:[{range:n,primary:m.getPrimaryForRange(n,r),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(Ge,{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 o=this._univerInstanceService.getCurrentUnitForType(s.UniverInstanceType.UNIVER_SHEET),n=o.getActiveSheet(),r=o.getUnitId(),i=n.getSheetId(),c=this._selectionManagerService.getCurrentLastSelection();if(!c)return null;let S;if(t===!0)S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S);else if(t===!1)S=c.range;else{const h=await this.showExtendConfirm();if(h==="cancel")return null;h==="keep"?S=c.range:(S=m.expandToContinuousRange(c.range,{up:!0,down:!0,left:!0,right:!0},n),this.setSelection(r,i,S))}return{range:S,unitId:r,subUnitId:i,colIndex:c.primary.actualColumn}}};p=Ke([w(0,s.IUniverInstanceService),w(1,C.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 o=s.Tools.chatAtABC(t);switch(e.getCurrentLocale()){case s.LocaleType.ZH_CN:return`"${o}"列`;case s.LocaleType.EN_US:return`Column "${o}"`;default:return`Column "${o}"`}}}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)},B={id:"sheet.command.sort-range-desc-ext",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},F={id:"sheet.command.sort-range-custom",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()},W={id:"sheet.command.sort-range-asc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!1)},V={id:"sheet.command.sort-range-asc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!0,!0)},z={id:"sheet.command.sort-range-desc-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!1)},Z={id:"sheet.command.sort-range-desc-ext-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortDirectly(!1,!0)},G={id:"sheet.command.sort-range-custom-ctx",type:s.CommandType.COMMAND,handler:async e=>await e.get(p).triggerSortCustomize()};function Qe(){const e=s.useDependency(p),t=s.useDependency(I.SheetsSortService),o=s.useDependency(s.LocaleService),[n,r]=l.useState(!1),[i,c]=l.useState(0),S=l.useRef(null),h=e.customSortState();if(!h||!h.location)return null;const{range:f,unitId:b,subUnitId:x}=h.location,O=e.getTitles(n),[y,k]=l.useState([{type:I.SortType.ASC,colIndex:f.startColumn}]),ne=l.useCallback((g,M)=>{const D=[...y];M===null?D.splice(g,1):D[g]=M,k(D)},[y]),X=l.useCallback(s.throttle(()=>{const g=[...y],M=qe(f,y);M!==null&&(g.push({type:I.SortType.ASC,colIndex:M}),k(g))},200),[y,f]),v=l.useCallback((g,M)=>{t.applySort({range:f,orderRules:g,hasTitle:M}),e.closeCustomSortPanel()},[t,e,f]),oe=l.useCallback(()=>{e.closeCustomSortPanel()},[e]),_t=l.useCallback(g=>{r(g),g?e.setSelection(b,x,{...f,startRow:f.startRow+1}):e.setSelection(b,x,f)},[e,f,x,b]);l.useEffect(()=>{S.current&&y.length>5&&(S.current.scrollTop=S.current.scrollHeight)},[y]);const Rt=y.length<O.length,xe=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(R.Checkbox,{checked:n,onChange:g=>_t(!!g),children:o.t("sheets-sort.dialog.first-row-check")})}),Rt?a.jsxs("div",{className:d.addCondition,onClick:X,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]}):a.jsxs("div",{className:`${d.addCondition} ${d.addConditionDisable}`,children:[a.jsx(Q,{}),a.jsx("span",{className:d.addConditionText,children:o.t("sheets-sort.dialog.add-condition")})]})]}),a.jsx("div",{className:d.conditionList,onScroll:g=>{const M=g.currentTarget.scrollTop;c(M)},ref:S,children:a.jsx(R.DraggableList,{list:xe,onListChange:k,idKey:"id",draggableHandle:`.${d.customSortPanelItemHandler}`,itemRender:g=>a.jsx($e,{titles:O,list:xe,item:g,onChange:(M,D)=>ne(D,M),scrollPosition:i}),rowHeight:32,margin:[0,12]})})]}),a.jsxs("div",{className:d.customSortPanelFooter,children:[a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"default",onClick:()=>oe(),children:o.t("sheets-sort.dialog.cancel")}),a.jsx(R.Button,{className:d.customSortPanelFooterBtn,type:"primary",onClick:()=>v(y,n),children:o.t("sheets-sort.dialog.confirm")})]})]})}function $e(e){var X;const{list:t,item:o,titles:n,onChange:r,scrollPosition:i}=e,c=s.useDependency(s.LocaleService),S=n.filter(v=>!t.some(oe=>oe.colIndex===v.index)||v.index===o.colIndex),h=t.findIndex(v=>v.colIndex===o.colIndex),f=l.useCallback(v=>{r({...o,colIndex:v.index},h),x(!1)},[h,o,r]),[b,x]=l.useState(!1),O=v=>{x(v)};l.useEffect(()=>{x(!1)},[i]);const y=t.length>1,k=(X=n.find(v=>v.index===o.colIndex))==null?void 0:X.label,ne=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(R.Dropdown,{placement:"bottomLeft",trigger:["click"],visible:b,onVisibleChange:O,overlay:a.jsx("ul",{className:d.customSortColMenu,children:S.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===o.colIndex&&a.jsx(ae,{})})]},v.index))}),children:a.jsxs("div",{className:d.customSortPanelItemColumnInput,children:[a.jsx("span",{className:d.customSortPanelItemColumnInputText,children:k}),a.jsx(me,{className:d.customSortPanelItemColumnInputDropdown})]})})})]}),a.jsx("div",{className:d.customSortPanelItemOrder,children:a.jsxs(R.RadioGroup,{className:ne,value:o.type,onChange:v=>{r({...o,type:v},h)},children:[a.jsx(R.Radio,{value:I.SortType.ASC,children:c.t("sheets-sort.general.sort-asc")}),a.jsx(R.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:()=>r(null,h)})})]})}function qe(e,t){const{startColumn:o,endColumn:n}=e,r=new Set(t.map(i=>i==null?void 0:i.colIndex));for(let i=o;i<=n;i++)if(!r.has(i))return i;return null}function et(e){const{range:t,colIndex:o,onClose:n}=e,r=s.useDependency(p),i=s.useDependency(s.IUniverInstanceService),c=s.useDependency(s.LocaleService),S=l.useCallback(h=>{const{unitId:f,subUnitId:b}=m.getSheetCommandTarget(i)||{};if(t&&f&&b){const x={...t,startRow:t.startRow+1};r.triggerSortDirectly(h,!1,{unitId:f,subUnitId:b,range:x,colIndex:o})}else console.warn(`Cannot find the target to sort. unitId: ${f}, subUnitId: ${b}, range: ${t}, colIndex: ${o}`);n()},[t,o,r,i,n]);return a.jsxs("div",{className:d.embedSortBtnContainer,children:[a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnAsc}`,onClick:()=>S(!0),children:[a.jsx(K,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-asc")]}),a.jsxs("div",{className:`${d.embedSortBtn} ${d.embedSortBtnDesc}`,onClick:()=>S(!1),children:[a.jsx(J,{className:d.embedSortBtnIcon}),c.t("sheets-sort.general.sort-desc")]})]})}const he="sheet.menu.sheets-sort",fe="sheet.menu.sheets-sort-ctx",j="AscendingSingle",$="ExpandAscendingSingle",q="DescendingSingle",ee="ExpandDescendingSingle",te="CustomSortSingle";function tt(e){return{id:he,type:C.MenuItemType.SUBITEMS,icon:j,tooltip:"sheets-sort.general.sort",hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function nt(e){return{id:H.id,icon:j,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,hidden$:E.getCurrentExclusiveRangeInterest$(e)}}function ot(e){return{id:U.id,title:"sheets-sort.general.sort-asc-ext",icon:$,type:C.MenuItemType.BUTTON}}function rt(e){return{id:A.id,title:"sheets-sort.general.sort-desc-cur",icon:q,type:C.MenuItemType.BUTTON}}function st(e){return{id:B.id,title:"sheets-sort.general.sort-desc-ext",icon:ee,type:C.MenuItemType.BUTTON}}function it(e){return{id:F.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te}}function at(e){return{id:fe,title:"sheets-sort.general.sort",type:C.MenuItemType.SUBITEMS,icon:j,hidden$:C.getMenuHiddenObservable(e,s.UniverInstanceType.UNIVER_SHEET),disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ct(e){return{id:W.id,title:"sheets-sort.general.sort-asc-cur",type:C.MenuItemType.BUTTON,icon:j,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function lt(e){return{id:V.id,title:"sheets-sort.general.sort-asc-ext",type:C.MenuItemType.BUTTON,icon:$,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function dt(e){return{id:z.id,title:"sheets-sort.general.sort-desc-cur",type:C.MenuItemType.BUTTON,icon:q,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function ut(e){return{id:Z.id,title:"sheets-sort.general.sort-desc-ext",type:C.MenuItemType.BUTTON,icon:ee,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}function mt(e){return{id:G.id,title:"sheets-sort.general.sort-custom",type:C.MenuItemType.BUTTON,icon:te,disabled$:E.getCurrentRangeDisable$(e,{workbookTypes:[m.WorkbookEditablePermission],worksheetTypes:[m.WorksheetSortPermission,m.WorksheetEditPermission],rangeTypes:[m.RangeProtectionPermissionEditPoint]})}}const St={[C.RibbonStartGroup.FORMULAS_INSERT]:{[he]:{order:2,menuItemFactory:tt,[H.id]:{order:0,menuItemFactory:nt},[U.id]:{order:1,menuItemFactory:ot},[A.id]:{order:2,menuItemFactory:rt},[B.id]:{order:3,menuItemFactory:st},[F.id]:{order:4,menuItemFactory:it}}},[C.ContextMenuPosition.MAIN_AREA]:{[C.ContextMenuGroup.DATA]:{[fe]:{order:0,menuItemFactory:at,[W.id]:{order:0,menuItemFactory:ct},[V.id]:{order:1,menuItemFactory:lt},[z.id]:{order:2,menuItemFactory:dt},[Z.id]:{order:3,menuItemFactory:ut},[G.id]:{order:4,menuItemFactory:mt}}}}};var Ct=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=(e,t,o,n)=>{for(var r=n>1?void 0:n?gt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&Ct(t,o,r),r},T=(e,t)=>(o,n)=>t(o,n,e);const ve="custom-sort-dialog",ft=560;let Y=class extends s.RxDisposable{constructor(e,t,o,n,r,i,c,S,h,f){super(),this._commandService=e,this._menuManagerService=t,this._dialogService=o,this._layoutService=n,this._uiPartsService=r,this._sheetRenderService=i,this._localeService=c,this._sheetsSortUIService=S,this._injector=h,this._componentManager=f,this._initCommands(),this._initMenu(),this._initUI()}_initMenu(){this._menuManagerService.mergeMenu(St)}_initCommands(){[H,U,A,B,F,W,V,z,Z,G].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e))),this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations(I.SortRangeCommand.id))}_initUI(){this.disposeWithMe(this._componentManager.register("CustomSortPanel",Qe)),this.disposeWithMe(this._uiPartsService.registerComponent(E.SheetsUIPart.FILTER_PANEL_EMBED_POINT,()=>s.connectInjector(et,this._injector))),this.disposeWithMe(this._componentManager.register(j,K)),this.disposeWithMe(this._componentManager.register($,de)),this.disposeWithMe(this._componentManager.register(q,J)),this.disposeWithMe(this._componentManager.register(ee,ue)),this.disposeWithMe(this._componentManager.register(te,ce)),this._sheetsSortUIService.customSortState$.pipe(se.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:ve,draggable:!0,width:ft,title:{title:`${this._localeService.t("sheets-sort.general.sort-custom")}: ${_e.serializeRange(e.range)}`},children:{label:"CustomSortPanel"},destroyOnClose:!0,defaultPosition:vt(),preservePositionOnDestroy:!1,onClose:()=>this._closePanel(),mask:!0})}_closePanel(){this._dialogService.close(ve),queueMicrotask(()=>this._layoutService.focus())}};Y=ht([T(0,s.ICommandService),T(1,C.IMenuManagerService),T(2,C.IDialogService),T(3,C.ILayoutService),T(4,C.IUIPartsService),T(5,s.Inject(E.SheetsRenderService)),T(6,s.Inject(s.LocaleService)),T(7,s.Inject(p)),T(8,s.Inject(s.Injector)),T(9,s.Inject(C.ComponentManager))],Y);function vt(){return{x:0,y:0}}var pe=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,It=(e,t,o)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,yt=(e,t,o,n)=>{for(var r=n>1?void 0:n?pt(t,o):t,i=e.length-1,c;i>=0;i--)(c=e[i])&&(r=(n?c(t,o,r):c(r))||r);return n&&r&&pe(t,o,r),r},Ie=(e,t)=>(o,n)=>t(o,n,e),ye=(e,t,o)=>It(e,typeof t!="symbol"?t+"":t,o);const xt="SHEET_SORT_UI_PLUGIN";u.UniverSheetsSortUIPlugin=class extends s.Plugin{constructor(t=Pe,o,n){super(),this._config=t,this._injector=o,this._configService=n;const{...r}=this._config;this._configService.setConfig(Re,r)}onStarting(){[[p],[Y]].forEach(t=>this._injector.add(t))}onRendered(){this._injector.get(Y)}},ye(u.UniverSheetsSortUIPlugin,"type",s.UniverInstanceType.UNIVER_SHEET),ye(u.UniverSheetsSortUIPlugin,"pluginName",xt),u.UniverSheetsSortUIPlugin=yt([s.DependentOn(I.UniverSheetsSortPlugin),Ie(1,s.Inject(s.Injector)),Ie(2,s.IConfigService)],u.UniverSheetsSortUIPlugin),u.SortRangeAscCommand=H,u.SortRangeAscExtCommand=U,u.SortRangeAscExtInCtxMenuCommand=V,u.SortRangeAscInCtxMenuCommand=W,u.SortRangeCustomCommand=F,u.SortRangeCustomInCtxMenuCommand=G,u.SortRangeDescCommand=A,u.SortRangeDescExtCommand=B,u.SortRangeDescExtInCtxMenuCommand=Z,u.SortRangeDescInCtxMenuCommand=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@univerjs/sheets-sort"),require("@univerjs/sheets-sort-ui")):typeof define=="function"&&define.amd?define(["exports","@univerjs/sheets-sort","@univerjs/sheets-sort-ui"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.UniverPresetSheetsSort={},e.UniverSheetsSort,e.UniverSheetsSortUi))})(this,function(e,t,r){"use strict";function i(){return{plugins:[t.UniverSheetsSortPlugin,r.UniverSheetsSortUIPlugin].filter(s=>!!s)}}e.UniverSheetsSortPreset=i,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|