@univerjs/sheets-sort 0.6.0 → 0.6.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.
|
@@ -6,29 +6,32 @@ import { FRange, FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
|
|
|
6
6
|
export interface IFSheetSortEventMixin {
|
|
7
7
|
/**
|
|
8
8
|
* This event will be emitted when a range on a worksheet is sorted.
|
|
9
|
-
*
|
|
9
|
+
* @see {@link ISheetRangeSortParams}
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
12
|
* const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetRangeSorted, (params) => {
|
|
13
|
-
*
|
|
14
|
-
* sortColumn
|
|
15
|
-
* console.log(col.column, col.ascending);
|
|
16
|
-
* });
|
|
13
|
+
* console.log(params);
|
|
14
|
+
* const { workbook, worksheet, range, sortColumn } = params;
|
|
17
15
|
* });
|
|
16
|
+
*
|
|
17
|
+
* // Remove the event listener, use `callbackDisposable.dispose()`
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
SheetRangeSorted: 'SheetRangeSorted';
|
|
21
21
|
/**
|
|
22
22
|
* This event will be emitted before sorting a range on a worksheet.
|
|
23
|
-
*
|
|
23
|
+
* @see {@link ISheetRangeSortParams}
|
|
24
24
|
* @example
|
|
25
25
|
* ```typescript
|
|
26
26
|
* const callbackDisposable = univerAPI.addEvent(univerAPI.Event.SheetBeforeRangeSort, (params) => {
|
|
27
|
-
*
|
|
28
|
-
* sortColumn
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* console.log(params);
|
|
28
|
+
* const { workbook, worksheet, range, sortColumn } = params;
|
|
29
|
+
*
|
|
30
|
+
* // Cancel the sorting operation.
|
|
31
|
+
* params.cancel = true;
|
|
31
32
|
* });
|
|
33
|
+
*
|
|
34
|
+
* // Remove the event listener, use `callbackDisposable.dispose()`
|
|
32
35
|
* ```
|
|
33
36
|
*/
|
|
34
37
|
SheetBeforeRangeSort: 'SheetBeforeRangeSort';
|
|
@@ -5,15 +5,19 @@ import { FWorksheet } from '@univerjs/sheets/facade';
|
|
|
5
5
|
export interface IFWorksheetSort {
|
|
6
6
|
/**
|
|
7
7
|
* Sort the worksheet by the specified column.
|
|
8
|
-
* @param {number} colIndex The column index to sort by.
|
|
8
|
+
* @param {number} colIndex The column index to sort by.
|
|
9
9
|
* @param {boolean} [asc=true] The sort order. `true` for ascending, `false` for descending.
|
|
10
|
-
* @returns The worksheet itself for chaining.
|
|
10
|
+
* @returns {FWorksheet} The worksheet itself for chaining.
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
|
-
* const
|
|
14
|
-
* const
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
14
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
15
|
+
*
|
|
16
|
+
* // Sorts the worksheet by the column A in ascending order.
|
|
17
|
+
* fWorksheet.sort(0);
|
|
18
|
+
*
|
|
19
|
+
* // Sorts the worksheet by the column A in descending order.
|
|
20
|
+
* fWorksheet.sort(0, false);
|
|
17
21
|
* ```
|
|
18
22
|
*/
|
|
19
23
|
sort(colIndex: number, asc?: boolean): FWorksheet;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-sort",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A library for sorting data in Univer Sheet",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"lib"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@univerjs/core": "0.6.
|
|
57
|
-
"@univerjs/
|
|
58
|
-
"@univerjs/
|
|
56
|
+
"@univerjs/core": "0.6.1",
|
|
57
|
+
"@univerjs/sheets": "0.6.1",
|
|
58
|
+
"@univerjs/engine-formula": "0.6.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"typescript": "^5.7.3",
|
|
62
|
-
"vite": "^6.1.
|
|
63
|
-
"vitest": "^3.0.
|
|
64
|
-
"@univerjs-infra/shared": "0.6.
|
|
62
|
+
"vite": "^6.1.1",
|
|
63
|
+
"vitest": "^3.0.6",
|
|
64
|
+
"@univerjs-infra/shared": "0.6.1"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"test": "vitest run",
|