@univerjs/preset-sheets-node-core 0.6.10-nightly.202504231607 → 0.6.10-nightly.202504251607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/umd/index.js +1 -1
- package/package.json +16 -16
package/lib/umd/index.js
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
// @univerjs/sheets-sort/index
|
|
64
|
-
(function(l,
|
|
64
|
+
(function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@univerjs/core"),require("@univerjs/engine-formula"),require("@univerjs/sheets")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/engine-formula","@univerjs/sheets"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.UniverSheetsSort={},l.UniverCore,l.UniverEngineFormula,l.UniverSheets))})(this,function(l,o,S,h){"use strict";var te=Object.defineProperty;var ne=(l,o,S)=>o in l?te(l,o,{enumerable:!0,configurable:!0,writable:!0,value:S}):l[o]=S;var N=(l,o,S)=>ne(l,typeof o!="symbol"?o+"":o,S);const T="sheets-sort.config",w={};var g=(e=>(e.DESC="desc",e.ASC="asc",e))(g||{});const b=e=>e.replace(/-/gi,"").replace(/'/gi,""),E=(e,n)=>{const t=e===null||e==="",r=n===null||n==="";return t&&r?0:t?1:r?-1:null},O=(e,n,t)=>{const r=typeof e=="number",s=typeof n=="number";return r&&s?e<n?t===g.ASC?-1:1:e>n?t===g.ASC?1:-1:0:r?t===g.ASC?1:-1:s?t===g.ASC?-1:1:null},j=(e,n,t)=>{const r=typeof e=="string",s=typeof n=="string";if(r&&(e=b(e.toLocaleLowerCase())),s&&(n=b(n.toLocaleLowerCase())),!r&&!s)return null;if(r&&s){const i=e,u=n;return i<u?t===g.ASC?-1:1:i>u?t===g.ASC?1:-1:0}return r?t===g.ASC?1:-1:s?t===g.ASC?-1:1:null},U=e=>!e||Object.keys(e).length===0||(e==null?void 0:e.v)==null&&(e==null?void 0:e.p)==null;var M=Object.getOwnPropertyDescriptor,V=(e,n,t,r)=>{for(var s=r>1?void 0:r?M(n,t):n,i=e.length-1,u;i>=0;i--)(u=e[i])&&(s=u(s)||s);return s},_=(e,n)=>(t,r)=>n(t,r,e);l.SheetsSortService=class extends o.Disposable{constructor(t,r,s){super();N(this,"_compareFns",[]);this._univerInstanceService=t,this._commandService=r,this._formulaDataModel=s}mergeCheck(t){var a;const{unitId:r,subUnitId:s,range:i}=t,u=(a=this._univerInstanceService.getUnit(r))==null?void 0:a.getSheetBySheetId(s);if(!u)return!1;const c=u.getMergeData().filter(f=>o.Rectangle.contains(i,f));return c.length===0?!0:$(i,c)}emptyCheck(t){var c;const{unitId:r,subUnitId:s,range:i}=t,u=(c=this._univerInstanceService.getUnit(r))==null?void 0:c.getSheetBySheetId(s);if(!u)return!1;for(let a=i.startRow;a<=i.endRow;a++)for(let f=i.startColumn;f<=i.endColumn;f++)if(!U(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:s,range:i}=t,u=(a=(c=this._formulaDataModel.getArrayFormulaRange())==null?void 0:c[r])==null?void 0:a[s];for(const f in u){const d=u[Number(f)];for(const R in d){const v=d[Number(R)];if(v&&o.Rectangle.intersects(i,v))return!1}}return!0}registerCompareFn(t){this._compareFns.unshift(t)}getAllCompareFns(){return this._compareFns}applySort(t,r,s){var c;const{unitId:i,subUnitId:u}=h.getSheetCommandTarget(this._univerInstanceService)||{};this._commandService.executeCommand(p.id,{orderRules:t.orderRules,range:t.range,hasTitle:(c=t.hasTitle)!=null?c:!1,unitId:r||i,subUnitId:s||u})}},l.SheetsSortService=V([_(0,o.IUniverInstanceService),_(1,o.ICommandService),_(2,o.Inject(S.FormulaDataModel))],l.SheetsSortService);function $(e,n){const t=e.endRow-e.startRow+1,r=e.endColumn-e.startColumn+1;let s=null,i=null;const u=t*r;let c=0;for(const a of n)if(a.startRow>=e.startRow&&a.endRow<=e.endRow&&a.startColumn>=e.startColumn&&a.endColumn<=e.endColumn){const f=a.endRow-a.startRow+1,d=a.endColumn-a.startColumn+1;if(s===null&&i===null)s=f,i=d;else if(f!==s||d!==i)return!1;c+=f*d}return c===u}const p={id:"sheet.command.sort-range",type:o.CommandType.COMMAND,handler:(e,n)=>{const{range:t,orderRules:r,hasTitle:s,unitId:i,subUnitId:u}=n,c=e.get(l.SheetsSortService),a=e.get(o.IUniverInstanceService),{worksheet:f}=h.getSheetCommandTarget(a,n)||{};if(!f)return!1;const d=f.getMergeData().filter(m=>o.Rectangle.contains(t,m)),R=d.map(m=>m.startRow),{startRow:v,endRow:J}=t,Q=s?v+1:v,I=[],F=[];for(let m=Q;m<=J;m++)f.getRowFiltered(m)||f.getRowRawVisible(m)!==!1&&(d.length&&!R.includes(m)||(I.push({index:m,value:L(f,m,r)}),F.push(m)));const X=c.getAllCompareFns();I.sort(q(r,G(X)));const D={};I.forEach(({index:m,value:se},ee)=>{D[F[ee]]=m});const Z={id:h.ReorderRangeCommand.id,params:{unitId:i,subUnitId:u,range:t,order:D}},k=e.get(o.ICommandService);return o.sequenceExecute([Z],k).result}};function L(e,n,t){const r=[];return t.forEach(({colIndex:s})=>{r.push(e.getCellRaw(n,s))}),r}function G(e){return(n,t,r)=>{for(let s=0;s<e.length;s++){const i=e[s](n,t,r);if(i!=null)return i}return 0}}function q(e,n){return function(t,r){let s=null;for(let i=0;i<e.length;i++){const u=t.value[i],c=r.value[i];if(s=n(e[i].type,u,c),s!==0&&s!==null&&s!==void 0)return s}return 0}}var B=Object.getOwnPropertyDescriptor,H=(e,n,t,r)=>{for(var s=r>1?void 0:r?B(n,t):n,i=e.length-1,u;i>=0;i--)(u=e[i])&&(s=u(s)||s);return s},y=(e,n)=>(t,r)=>n(t,r,e);let C=class extends o.Disposable{constructor(e,n){super(),this._commandService=e,this._sortService=n,this._initCommands(),this._registerCompareFns()}_initCommands(){[p].forEach(e=>this.disposeWithMe(this._commandService.registerCommand(e)))}_registerCompareFns(){const e=(n,t,r)=>{const s=this._getCommonValue(t),i=this._getCommonValue(r),u=[E,j,O];for(let c=0;c<u.length;c++){const a=u[c](s,i,n);if(a!==null)return a}return null};this._sortService.registerCompareFn(e)}_getCommonValue(e){var t,r;if(U(e))return null;const n=(r=(t=e==null?void 0:e.p)==null?void 0:t.body)==null?void 0:r.dataStream;return n||((e==null?void 0:e.t)===o.CellValueType.NUMBER?Number.parseFloat(`${e.v}`):(e==null?void 0:e.t)===o.CellValueType.STRING?typeof e.v=="number"?e.v:`${e.v}`:(e==null?void 0:e.t)===o.CellValueType.BOOLEAN?`${e.v}`:(e==null?void 0:e.t)===o.CellValueType.FORCE_STRING?Number.parseFloat(`${e.v}`):`${e==null?void 0:e.v}`)}};C=H([y(0,o.ICommandService),y(1,o.Inject(l.SheetsSortService))],C);var K=Object.defineProperty,W=Object.getOwnPropertyDescriptor,Y=(e,n,t)=>n in e?K(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,x=(e,n,t,r)=>{for(var s=r>1?void 0:r?W(n,t):n,i=e.length-1,u;i>=0;i--)(u=e[i])&&(s=u(s)||s);return s},A=(e,n)=>(t,r)=>n(t,r,e),P=(e,n,t)=>Y(e,typeof n!="symbol"?n+"":n,t);const z="SHEET_SORT_PLUGIN";l.UniverSheetsSortPlugin=class extends o.Plugin{constructor(n=w,t,r){super(),this._config=n,this._injector=t,this._configService=r;const{...s}=o.merge({},w,this._config);this._configService.setConfig(T,s)}onStarting(){[[C],[l.SheetsSortService]].forEach(n=>this._injector.add(n))}onReady(){this._injector.get(C)}},P(l.UniverSheetsSortPlugin,"type",o.UniverInstanceType.UNIVER_SHEET),P(l.UniverSheetsSortPlugin,"pluginName",z),l.UniverSheetsSortPlugin=x([o.DependentOn(h.UniverSheetsPlugin,S.UniverFormulaEnginePlugin),A(1,o.Inject(o.Injector)),A(2,o.IConfigService)],l.UniverSheetsSortPlugin),l.SortRangeCommand=p,l.SortType=g,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
// @univerjs/sheets-sort/facade
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/preset-sheets-node-core",
|
|
3
|
-
"version": "0.6.10-nightly.
|
|
3
|
+
"version": "0.6.10-nightly.202504251607",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -60,23 +60,23 @@
|
|
|
60
60
|
"rxjs": ">=7.0.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@univerjs/docs": "0.6.10-nightly.
|
|
64
|
-
"@univerjs/engine-formula": "0.6.10-nightly.
|
|
65
|
-
"@univerjs/engine-render": "0.6.10-nightly.
|
|
66
|
-
"@univerjs/rpc-node": "0.6.10-nightly.
|
|
67
|
-
"@univerjs/sheets": "0.6.10-nightly.
|
|
68
|
-
"@univerjs/sheets-data-validation": "0.6.10-nightly.
|
|
69
|
-
"@univerjs/sheets-drawing": "0.6.10-nightly.
|
|
70
|
-
"@univerjs/sheets-filter": "0.6.10-nightly.
|
|
71
|
-
"@univerjs/sheets-formula": "0.6.10-nightly.
|
|
72
|
-
"@univerjs/sheets-hyper-link": "0.6.10-nightly.
|
|
73
|
-
"@univerjs/sheets-numfmt": "0.6.10-nightly.
|
|
74
|
-
"@univerjs/sheets-sort": "0.6.10-nightly.
|
|
75
|
-
"@univerjs/sheets-thread-comment": "0.6.10-nightly.
|
|
76
|
-
"@univerjs/thread-comment": "0.6.10-nightly.
|
|
63
|
+
"@univerjs/docs": "0.6.10-nightly.202504251607",
|
|
64
|
+
"@univerjs/engine-formula": "0.6.10-nightly.202504251607",
|
|
65
|
+
"@univerjs/engine-render": "0.6.10-nightly.202504251607",
|
|
66
|
+
"@univerjs/rpc-node": "0.6.10-nightly.202504251607",
|
|
67
|
+
"@univerjs/sheets": "0.6.10-nightly.202504251607",
|
|
68
|
+
"@univerjs/sheets-data-validation": "0.6.10-nightly.202504251607",
|
|
69
|
+
"@univerjs/sheets-drawing": "0.6.10-nightly.202504251607",
|
|
70
|
+
"@univerjs/sheets-filter": "0.6.10-nightly.202504251607",
|
|
71
|
+
"@univerjs/sheets-formula": "0.6.10-nightly.202504251607",
|
|
72
|
+
"@univerjs/sheets-hyper-link": "0.6.10-nightly.202504251607",
|
|
73
|
+
"@univerjs/sheets-numfmt": "0.6.10-nightly.202504251607",
|
|
74
|
+
"@univerjs/sheets-sort": "0.6.10-nightly.202504251607",
|
|
75
|
+
"@univerjs/sheets-thread-comment": "0.6.10-nightly.202504251607",
|
|
76
|
+
"@univerjs/thread-comment": "0.6.10-nightly.202504251607"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@univerjs/core": "0.6.10-nightly.
|
|
79
|
+
"@univerjs/core": "0.6.10-nightly.202504251607",
|
|
80
80
|
"typescript": "^5.8.2",
|
|
81
81
|
"@univerjs-infra/shared": "0.6.10"
|
|
82
82
|
},
|