@univerjs-pro/sheets-mcp 0.15.0-insiders.20251227-c108ce3 → 0.15.0-insiders.20260106-79b11f9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/facade/f-range.d.ts +73 -1
- package/lib/types/facade/f-worksheet.d.ts +69 -1
- package/lib/types/index.d.ts +4 -1
- package/lib/types/services/cell-usage-analyzer.service.d.ts +68 -0
- package/lib/types/services/size-analysis.service.d.ts +118 -0
- package/lib/types/services/style-analysis.service.d.ts +93 -0
- package/lib/types/tools/common.d.ts +1 -1
- package/lib/types/tools/conditional-format-tools.d.ts +1 -2
- package/lib/types/tools/data-validation-tools.d.ts +1 -2
- package/lib/types/tools/range-operations.d.ts +1 -2
- package/lib/types/tools/row-column-operations.d.ts +1 -2
- package/lib/types/tools/sheet-management.d.ts +1 -2
- package/lib/types/tools/utility-tools.d.ts +1 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +11 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFormulaUsage, IFormulaUsageAsA1 } from '@univerjs-pro/sheets-mcp';
|
|
1
|
+
import { IFormulaUsage, IFormulaUsageAsA1, IGetSizeUsagesOptions, IGetStyleUsagesOptions, ISizeUsageGrouped, ISizeUsageGroupedAsA1, IStyleUsage, IStyleUsageAsA1 } from '@univerjs-pro/sheets-mcp';
|
|
2
2
|
import { FRange } from '@univerjs/sheets/facade';
|
|
3
3
|
/**
|
|
4
4
|
* @ignore
|
|
@@ -30,10 +30,82 @@ export interface IFRangeSheetsMCP {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
getFormulaUsagesAsA1(): Promise<IFormulaUsageAsA1[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Get all style usages in the range
|
|
35
|
+
* @param options options for filtering style properties and max count
|
|
36
|
+
* @returns An array of style usages
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
41
|
+
* const sheet = workbook.getActiveSheet()
|
|
42
|
+
* const range = sheet.getRangeByA1('A1:C10')
|
|
43
|
+
* const usages = range.getStyleUsages();
|
|
44
|
+
* // or filter by specific properties
|
|
45
|
+
* const usagesFiltered = range.getStyleUsages({ properties: ['fontSize', 'fontFamily', 'width'] });
|
|
46
|
+
* // or limit results
|
|
47
|
+
* const usagesLimited = range.getStyleUsages({ maxCount: 100 });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
getStyleUsages(options?: IGetStyleUsagesOptions): IStyleUsage[];
|
|
51
|
+
/**
|
|
52
|
+
* Get all style usages in the range in A1 notation
|
|
53
|
+
* @param options options for filtering style properties and max count
|
|
54
|
+
* @returns An array of style usages in A1 notation
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
59
|
+
* const sheet = workbook.getActiveSheet()
|
|
60
|
+
* const range = sheet.getRangeByA1('A1:C10')
|
|
61
|
+
* const usagesA1 = range.getStyleUsagesAsA1();
|
|
62
|
+
* // or filter by specific properties
|
|
63
|
+
* const usagesA1Filtered = range.getStyleUsagesAsA1({ properties: ['fontSize', 'fontFamily', 'height'] });
|
|
64
|
+
* // or limit results
|
|
65
|
+
* const usagesA1Limited = range.getStyleUsagesAsA1({ maxCount: 100 });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
getStyleUsagesAsA1(options?: IGetStyleUsagesOptions): IStyleUsageAsA1[];
|
|
69
|
+
/**
|
|
70
|
+
* Get all row height and column width usages in the range
|
|
71
|
+
* @param options options for max count
|
|
72
|
+
* @returns Grouped size usages with widths and heights
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
77
|
+
* const sheet = workbook.getActiveSheet()
|
|
78
|
+
* const range = sheet.getRangeByA1('A1:C10')
|
|
79
|
+
* const usages = range.getSizeUsages();
|
|
80
|
+
* // or limit results
|
|
81
|
+
* const usagesLimited = range.getSizeUsages({ maxCount: 100 });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
getSizeUsages(options?: IGetSizeUsagesOptions): ISizeUsageGrouped;
|
|
85
|
+
/**
|
|
86
|
+
* Get all row height and column width usages in the range in A1 notation
|
|
87
|
+
* @param options options for max count
|
|
88
|
+
* @returns Grouped size usages in A1 notation with widths and heights
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
93
|
+
* const sheet = workbook.getActiveSheet()
|
|
94
|
+
* const range = sheet.getRangeByA1('A1:C10')
|
|
95
|
+
* const usagesA1 = range.getSizeUsagesAsA1();
|
|
96
|
+
* // or limit results
|
|
97
|
+
* const usagesA1Limited = range.getSizeUsagesAsA1({ maxCount: 100 });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
getSizeUsagesAsA1(options?: IGetSizeUsagesOptions): ISizeUsageGroupedAsA1;
|
|
33
101
|
}
|
|
34
102
|
export declare class FRangeSheetsMCP extends FRange implements IFRangeSheetsMCP {
|
|
35
103
|
getFormulaUsages(): Promise<IFormulaUsage[]>;
|
|
36
104
|
getFormulaUsagesAsA1(): Promise<IFormulaUsageAsA1[]>;
|
|
105
|
+
getStyleUsages(options?: IGetStyleUsagesOptions): IStyleUsage[];
|
|
106
|
+
getStyleUsagesAsA1(options?: IGetStyleUsagesOptions): IStyleUsageAsA1[];
|
|
107
|
+
getSizeUsages(options?: IGetSizeUsagesOptions): ISizeUsageGrouped;
|
|
108
|
+
getSizeUsagesAsA1(options?: IGetSizeUsagesOptions): ISizeUsageGroupedAsA1;
|
|
37
109
|
}
|
|
38
110
|
declare module '@univerjs/sheets/facade' {
|
|
39
111
|
interface FRange extends IFRangeSheetsMCP {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFormulaUsage, IFormulaUsageAsA1 } from '@univerjs-pro/sheets-mcp';
|
|
1
|
+
import { IFormulaUsage, IFormulaUsageAsA1, IGetSizeUsagesOptions, IGetStyleUsagesOptions, ISizeUsageGrouped, ISizeUsageGroupedAsA1, IStyleUsage, IStyleUsageAsA1 } from '@univerjs-pro/sheets-mcp';
|
|
2
2
|
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
3
3
|
/**
|
|
4
4
|
* @ignore
|
|
@@ -28,10 +28,78 @@ export interface IFWorksheetSheetsMCP {
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
getFormulaUsagesAsA1(): Promise<IFormulaUsageAsA1[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Get all style usages in the worksheet
|
|
33
|
+
* @param options options for filtering style properties and max count
|
|
34
|
+
* @returns An array of style usages
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
39
|
+
* const sheet = workbook.getActiveSheet()
|
|
40
|
+
* const usages = sheet.getStyleUsages();
|
|
41
|
+
* // or filter by specific properties
|
|
42
|
+
* const usagesFiltered = sheet.getStyleUsages({ properties: ['fontSize', 'fontFamily', 'width'] });
|
|
43
|
+
* // or limit results
|
|
44
|
+
* const usagesLimited = sheet.getStyleUsages({ maxCount: 100 });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
getStyleUsages(options?: IGetStyleUsagesOptions): IStyleUsage[];
|
|
48
|
+
/**
|
|
49
|
+
* Get all style usages in the worksheet in A1 notation
|
|
50
|
+
* @param options options for filtering style properties and max count
|
|
51
|
+
* @returns An array of style usages in A1 notation
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
56
|
+
* const sheet = workbook.getActiveSheet()
|
|
57
|
+
* const usagesA1 = sheet.getStyleUsagesAsA1();
|
|
58
|
+
* // or filter by specific properties
|
|
59
|
+
* const usagesA1Filtered = sheet.getStyleUsagesAsA1({ properties: ['fontSize', 'fontFamily', 'height'] });
|
|
60
|
+
* // or limit results
|
|
61
|
+
* const usagesA1Limited = sheet.getStyleUsagesAsA1({ maxCount: 100 });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
getStyleUsagesAsA1(options?: IGetStyleUsagesOptions): IStyleUsageAsA1[];
|
|
65
|
+
/**
|
|
66
|
+
* Get all row height and column width usages in the worksheet
|
|
67
|
+
* @param options options for max count
|
|
68
|
+
* @returns Grouped size usages with widths and heights
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
73
|
+
* const sheet = workbook.getActiveSheet()
|
|
74
|
+
* const usages = sheet.getSizeUsages();
|
|
75
|
+
* // or limit results
|
|
76
|
+
* const usagesLimited = sheet.getSizeUsages({ maxCount: 100 });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
getSizeUsages(options?: IGetSizeUsagesOptions): ISizeUsageGrouped;
|
|
80
|
+
/**
|
|
81
|
+
* Get all row height and column width usages in the worksheet in A1 notation
|
|
82
|
+
* @param options options for max count
|
|
83
|
+
* @returns Grouped size usages in A1 notation with widths and heights
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const workbook = univerAPI.getActiveWorkbook()
|
|
88
|
+
* const sheet = workbook.getActiveSheet()
|
|
89
|
+
* const usagesA1 = sheet.getSizeUsagesAsA1();
|
|
90
|
+
* // or limit results
|
|
91
|
+
* const usagesA1Limited = sheet.getSizeUsagesAsA1({ maxCount: 100 });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
getSizeUsagesAsA1(options?: IGetSizeUsagesOptions): ISizeUsageGroupedAsA1;
|
|
31
95
|
}
|
|
32
96
|
export declare class FWorksheetSheetsMCP extends FWorksheet implements IFWorksheetSheetsMCP {
|
|
33
97
|
getFormulaUsages(): Promise<IFormulaUsage[]>;
|
|
34
98
|
getFormulaUsagesAsA1(): Promise<IFormulaUsageAsA1[]>;
|
|
99
|
+
getStyleUsages(options?: IGetStyleUsagesOptions): IStyleUsage[];
|
|
100
|
+
getStyleUsagesAsA1(options?: IGetStyleUsagesOptions): IStyleUsageAsA1[];
|
|
101
|
+
getSizeUsages(options?: IGetSizeUsagesOptions): ISizeUsageGrouped;
|
|
102
|
+
getSizeUsagesAsA1(options?: IGetSizeUsagesOptions): ISizeUsageGroupedAsA1;
|
|
35
103
|
}
|
|
36
104
|
declare module '@univerjs/sheets/facade' {
|
|
37
105
|
interface FWorksheet extends IFWorksheetSheetsMCP {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { UniverSheetMCPPlugin } from './plugin';
|
|
2
|
-
export { type
|
|
2
|
+
export { CellUsageAnalyzer, getA1Notation, type ICellUsage, ICellUsageAnalyzer, type ICellUsageAsA1, type IDataExtractorCondition, } from './services/cell-usage-analyzer.service';
|
|
3
|
+
export { toA1 as formulaToA1, type IFormulaUsage, IFormulaUsageAnalyzer, type IFormulaUsageAsA1 } from './services/formula-analysis.service';
|
|
4
|
+
export { type IGetSizeUsagesOptions, ISizeUsageAnalyzer, type ISizeUsageColumn, type ISizeUsageColumnAsA1, type ISizeUsageGrouped, type ISizeUsageGroupedAsA1, type ISizeUsageRow, type ISizeUsageRowAsA1, SizeUsageAnalyzer, } from './services/size-analysis.service';
|
|
5
|
+
export { type IGetStyleUsagesOptions, type IStyleConfig, type IStyleUsage, IStyleUsageAnalyzer, type IStyleUsageAsA1, toA1 as styleToA1, StyleUsageAnalyzer, } from './services/style-analysis.service';
|
|
3
6
|
export * from './tools';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ICellData, IRange, Nullable } from '@univerjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* Generic cell usage data interface
|
|
4
|
+
*/
|
|
5
|
+
export interface ICellUsage {
|
|
6
|
+
/**
|
|
7
|
+
* Hash of the data for identifying identical data
|
|
8
|
+
*/
|
|
9
|
+
dataHash: string;
|
|
10
|
+
/**
|
|
11
|
+
* First occurrence location of the data
|
|
12
|
+
*/
|
|
13
|
+
firstOccurrence: IRange;
|
|
14
|
+
/**
|
|
15
|
+
* All cell ranges containing this data
|
|
16
|
+
*/
|
|
17
|
+
filledRanges: IRange[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A1 format cell usage data
|
|
21
|
+
*/
|
|
22
|
+
export interface ICellUsageAsA1 {
|
|
23
|
+
/**
|
|
24
|
+
* Hash of the data for identifying identical data
|
|
25
|
+
*/
|
|
26
|
+
dataHash: string;
|
|
27
|
+
/**
|
|
28
|
+
* First occurrence location in A1 notation
|
|
29
|
+
*/
|
|
30
|
+
firstOccurrence: string;
|
|
31
|
+
/**
|
|
32
|
+
* All cell ranges in A1 notation (comma separated)
|
|
33
|
+
*/
|
|
34
|
+
filledRanges: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Data extractor condition - defines how to extract and identify data from cells
|
|
38
|
+
*/
|
|
39
|
+
export interface IDataExtractorCondition {
|
|
40
|
+
/**
|
|
41
|
+
* Extract data from a cell
|
|
42
|
+
* @param cell cell data
|
|
43
|
+
* @returns extracted data, null if no relevant data
|
|
44
|
+
*/
|
|
45
|
+
getData(cell: Nullable<ICellData>): ICellData | null;
|
|
46
|
+
/**
|
|
47
|
+
* Generate hash for extracted data (used for data grouping)
|
|
48
|
+
* @param data extracted data
|
|
49
|
+
* @param rowIndex optional row index for position-dependent hashing
|
|
50
|
+
* @param columnIndex optional column index for position-dependent hashing
|
|
51
|
+
* @returns hash string, empty string means ignore this cell
|
|
52
|
+
*/
|
|
53
|
+
getHash(data: Nullable<ICellData>, rowIndex?: number, columnIndex?: number): string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Convert rectangle coordinates to A1 notation
|
|
57
|
+
*/
|
|
58
|
+
export declare function getA1Notation([r1, r2, c1, c2]: [number, number, number, number]): string;
|
|
59
|
+
export declare const ICellUsageAnalyzer: import('@wendellhu/redi').IdentifierDecorator<CellUsageAnalyzer>;
|
|
60
|
+
export declare class CellUsageAnalyzer {
|
|
61
|
+
/**
|
|
62
|
+
* Analyze cell data matrix to find all data usage patterns
|
|
63
|
+
* @param data cell data matrix
|
|
64
|
+
* @param condition data extraction condition
|
|
65
|
+
* @returns array of cell usage data
|
|
66
|
+
*/
|
|
67
|
+
getAllCellUsages(data: Nullable<ICellData>[][], condition: IDataExtractorCondition): ICellUsage[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { IColumnRange, IRowRange, Worksheet } from '@univerjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* Options for getSizeUsages methods
|
|
4
|
+
*/
|
|
5
|
+
export interface IGetSizeUsagesOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Maximum number of results to return for both widths and heights. Default is 200.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* { maxCount: 100 }
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
maxCount?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Single column width usage item
|
|
17
|
+
*/
|
|
18
|
+
export interface ISizeUsageColumn {
|
|
19
|
+
/**
|
|
20
|
+
* The width value in pixels
|
|
21
|
+
*/
|
|
22
|
+
value: number;
|
|
23
|
+
/**
|
|
24
|
+
* The column ranges with this width
|
|
25
|
+
*/
|
|
26
|
+
ranges: IColumnRange[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Single row height usage item
|
|
30
|
+
*/
|
|
31
|
+
export interface ISizeUsageRow {
|
|
32
|
+
/**
|
|
33
|
+
* The height value in pixels
|
|
34
|
+
*/
|
|
35
|
+
value: number;
|
|
36
|
+
/**
|
|
37
|
+
* The row ranges with this height
|
|
38
|
+
*/
|
|
39
|
+
ranges: IRowRange[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A1 format column width usage item
|
|
43
|
+
*/
|
|
44
|
+
export interface ISizeUsageColumnAsA1 {
|
|
45
|
+
/**
|
|
46
|
+
* The width value in pixels
|
|
47
|
+
*/
|
|
48
|
+
value: number;
|
|
49
|
+
/**
|
|
50
|
+
* The column ranges in A1 notation (comma separated)
|
|
51
|
+
* @example "A:C, E:T"
|
|
52
|
+
*/
|
|
53
|
+
ranges: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A1 format row height usage item
|
|
57
|
+
*/
|
|
58
|
+
export interface ISizeUsageRowAsA1 {
|
|
59
|
+
/**
|
|
60
|
+
* The height value in pixels
|
|
61
|
+
*/
|
|
62
|
+
value: number;
|
|
63
|
+
/**
|
|
64
|
+
* The row ranges in A1 notation (comma separated)
|
|
65
|
+
* @example "1:1, 3:5000"
|
|
66
|
+
*/
|
|
67
|
+
ranges: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Grouped size usage results
|
|
71
|
+
*/
|
|
72
|
+
export interface ISizeUsageGrouped {
|
|
73
|
+
/**
|
|
74
|
+
* Column width usages grouped by width value
|
|
75
|
+
*/
|
|
76
|
+
widths: ISizeUsageColumn[];
|
|
77
|
+
/**
|
|
78
|
+
* Row height usages grouped by height value
|
|
79
|
+
*/
|
|
80
|
+
heights: ISizeUsageRow[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A1 format grouped size usage results
|
|
84
|
+
*/
|
|
85
|
+
export interface ISizeUsageGroupedAsA1 {
|
|
86
|
+
/**
|
|
87
|
+
* Column width usages in A1 notation
|
|
88
|
+
*/
|
|
89
|
+
widths: ISizeUsageColumnAsA1[];
|
|
90
|
+
/**
|
|
91
|
+
* Row height usages in A1 notation
|
|
92
|
+
*/
|
|
93
|
+
heights: ISizeUsageRowAsA1[];
|
|
94
|
+
}
|
|
95
|
+
export declare const ISizeUsageAnalyzer: import('@wendellhu/redi').IdentifierDecorator<SizeUsageAnalyzer>;
|
|
96
|
+
/**
|
|
97
|
+
* Size usage analyzer - aggregates row heights and column widths
|
|
98
|
+
*/
|
|
99
|
+
export declare class SizeUsageAnalyzer {
|
|
100
|
+
private _maxCount?;
|
|
101
|
+
/**
|
|
102
|
+
* Update config based on options
|
|
103
|
+
*/
|
|
104
|
+
updateConfig(options?: IGetSizeUsagesOptions): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get all size usages from a worksheet
|
|
107
|
+
* @param worksheet The worksheet to analyze
|
|
108
|
+
* @param startRow Start row index (inclusive)
|
|
109
|
+
* @param endRow End row index (inclusive)
|
|
110
|
+
* @param startColumn Start column index (inclusive)
|
|
111
|
+
* @param endColumn End column index (inclusive)
|
|
112
|
+
*/
|
|
113
|
+
getAllSizeUsages(worksheet: Worksheet, startRow?: number, endRow?: number, startColumn?: number, endColumn?: number): ISizeUsageGrouped;
|
|
114
|
+
/**
|
|
115
|
+
* Convert ISizeUsageGrouped to A1 format
|
|
116
|
+
*/
|
|
117
|
+
toA1(grouped: ISizeUsageGrouped): ISizeUsageGroupedAsA1;
|
|
118
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ICellData, IRange, Nullable, Workbook, Worksheet } from '@univerjs/core';
|
|
2
|
+
import { CellUsageAnalyzer } from './cell-usage-analyzer.service';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for style usage information
|
|
5
|
+
*/
|
|
6
|
+
export interface IStyleUsage {
|
|
7
|
+
/**
|
|
8
|
+
* The style hash - a compact string representation of the style
|
|
9
|
+
*/
|
|
10
|
+
styleHash: string;
|
|
11
|
+
/**
|
|
12
|
+
* The filled ranges of cells with this style, including the first occurrence
|
|
13
|
+
*/
|
|
14
|
+
filledRanges: IRange[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Interface for style usage information in A1 notation
|
|
18
|
+
*/
|
|
19
|
+
export interface IStyleUsageAsA1 {
|
|
20
|
+
/**
|
|
21
|
+
* The style hash - a compact string representation of the style
|
|
22
|
+
*/
|
|
23
|
+
styleHash: string;
|
|
24
|
+
/**
|
|
25
|
+
* The filled ranges of cells with this style in A1 notation, including the first occurrence
|
|
26
|
+
*/
|
|
27
|
+
filledRanges: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Style extractor configuration
|
|
31
|
+
*/
|
|
32
|
+
export interface IStyleConfig {
|
|
33
|
+
fontFamily?: boolean;
|
|
34
|
+
fontSize?: boolean;
|
|
35
|
+
bold?: boolean;
|
|
36
|
+
italic?: boolean;
|
|
37
|
+
fontColor?: boolean;
|
|
38
|
+
backgroundColor?: boolean;
|
|
39
|
+
width?: boolean;
|
|
40
|
+
height?: boolean;
|
|
41
|
+
horizontalAlign?: boolean;
|
|
42
|
+
verticalAlign?: boolean;
|
|
43
|
+
underline?: boolean;
|
|
44
|
+
strikethrough?: boolean;
|
|
45
|
+
numberFormat?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Options for getStyleUsages methods
|
|
49
|
+
*/
|
|
50
|
+
export interface IGetStyleUsagesOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Filter which style properties to include.
|
|
53
|
+
* When specified, only these properties will be analyzed (whitelist mode).
|
|
54
|
+
* Unsupported properties are ignored.
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* { properties: ['fontSize', 'fontFamily', 'width'] }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
properties?: Array<keyof IStyleConfig>;
|
|
61
|
+
/**
|
|
62
|
+
* Maximum number of results to return. Default is 200.
|
|
63
|
+
* When specified, the return value will include a `hasMore` property indicating if more results exist.
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* { maxCount: 100 }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
maxCount?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Convert IStyleUsage to A1 format
|
|
73
|
+
*/
|
|
74
|
+
export declare function toA1(usage: IStyleUsage): IStyleUsageAsA1;
|
|
75
|
+
export declare const IStyleUsageAnalyzer: import('@wendellhu/redi').IdentifierDecorator<StyleUsageAnalyzer>;
|
|
76
|
+
/**
|
|
77
|
+
* Style usage analyzer - based on generic CellUsageAnalyzer
|
|
78
|
+
*/
|
|
79
|
+
export declare class StyleUsageAnalyzer extends CellUsageAnalyzer {
|
|
80
|
+
private _config;
|
|
81
|
+
private _maxCount?;
|
|
82
|
+
constructor(config?: IStyleConfig);
|
|
83
|
+
/**
|
|
84
|
+
* Update config based on options
|
|
85
|
+
* @param options options for getStyleUsages
|
|
86
|
+
*/
|
|
87
|
+
updateConfig(options?: IGetStyleUsagesOptions): void;
|
|
88
|
+
/**
|
|
89
|
+
* Get all style usages from cell data matrix
|
|
90
|
+
* @returns array of style usages with omitted count on last item if truncated
|
|
91
|
+
*/
|
|
92
|
+
getAllStyleUsages(data: Nullable<ICellData>[][], workbook: Workbook, worksheet?: Worksheet): IStyleUsage[];
|
|
93
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injector, ICommandService } from '@univerjs/core';
|
|
2
|
+
import { z } from '@univerjs-pro/mcp';
|
|
2
3
|
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
-
import { z } from 'zod';
|
|
4
4
|
/**
|
|
5
5
|
* Get UniverAPI instance from globalThis (temporary implementation)
|
|
6
6
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IMCPTool } from '@univerjs-pro/mcp';
|
|
1
|
+
import { IMCPTool, z } from '@univerjs-pro/mcp';
|
|
2
2
|
import { DataValidationOperator } from '@univerjs/core';
|
|
3
|
-
import { z } from 'zod';
|
|
4
3
|
export declare const dataValidationRuleSchema: z.ZodObject<{
|
|
5
4
|
rule_id: z.ZodOptional<z.ZodString>;
|
|
6
5
|
range_a1: z.ZodString;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IMCPTool } from '@univerjs-pro/mcp';
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { IMCPTool, z } from '@univerjs-pro/mcp';
|
|
3
2
|
export declare const batchRangeDataItemSchema: z.ZodObject<{
|
|
4
3
|
range: z.ZodString;
|
|
5
4
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IMCPTool } from '@univerjs-pro/mcp';
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { IMCPTool, z } from '@univerjs-pro/mcp';
|
|
3
2
|
export declare const cellDimensionRequestSchema: z.ZodObject<{
|
|
4
3
|
range: z.ZodString;
|
|
5
4
|
width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x3188(_0x5cd2ad,_0x43defb){_0x5cd2ad=_0x5cd2ad-0x94;const _0x25ed1a=_0x25ed();let _0x31887d=_0x25ed1a[_0x5cd2ad];return _0x31887d;}function _0x25ed(){const _0x1b2fb3=['530598kEzVeH','2539092pkPYnS','updateConfig','getIntersectRange','getLintErrors','642190bPQILf','getActiveWorkbook','getSizeUsages','getSizeUsagesAsA1','formulaToA1','object','@univerjs-pro/sheets-mcp','FWorkbook','235632bkNYrZ','@univerjs/core/facade','get','_injector','getCellDataGrid','extend','endRow','length','styleToA1','getAllFormulaError','getAllSizeUsages','getAllDataValidationErrorAsync','FWorksheet','function','105JQxraI','firstOccurrence','toA1','getMaxColumns','filledRanges','FRange','UniverSheetsDataValidationFacade','getMaxRows','376056ycdpnZ','getAllStyleUsages','endColumn','FUniver','getFormulaUsages','getRange','getStyleUsagesAsA1','_workbook','@univerjs/core','moveFormulaRefOffset','map','getAllFormulaUsages','formula','ISizeUsageAnalyzer','startColumn','IFormulaUsageAnalyzer','_worksheet','getCellRaw','push','@univerjs/sheets-formula/facade','@univerjs/sheets-data-validation/facade','getFormulaUsagesAsA1','startRow','125966exyMPH','92255WSEIfR','getStyleUsages','92wyjAam','UniverCore','IStyleUsageAnalyzer','amd'];_0x25ed=function(){return _0x1b2fb3;};return _0x25ed();}(function(_0x51fc1b,_0x5600fb){const _0x239f61=_0x3188,_0x1b4bf0=_0x51fc1b();while(!![]){try{const _0x4b963d=parseInt(_0x239f61(0xb2))/0x1+parseInt(_0x239f61(0xbe))/0x2+parseInt(_0x239f61(0xb9))/0x3+-parseInt(_0x239f61(0xb5))/0x4*(parseInt(_0x239f61(0xb3))/0x5)+parseInt(_0x239f61(0xba))/0x6+-parseInt(_0x239f61(0xd4))/0x7*(parseInt(_0x239f61(0xc6))/0x8)+parseInt(_0x239f61(0x9b))/0x9;if(_0x4b963d===_0x5600fb)break;else _0x1b4bf0['push'](_0x1b4bf0['shift']());}catch(_0x5e1448){_0x1b4bf0['push'](_0x1b4bf0['shift']());}}}(_0x25ed,0x365f6),function(_0x1e4cc3,_0x42ab3a){const _0x608b91=_0x3188;typeof exports==_0x608b91(0xc3)&&typeof module<'u'?_0x42ab3a(require('@univerjs/core/facade'),require('@univerjs/sheets-formula/facade'),require('@univerjs/sheets-data-validation/facade'),require('@univerjs/sheets/facade'),require('@univerjs-pro/sheets-mcp'),require('@univerjs/core')):typeof define==_0x608b91(0xd3)&&define[_0x608b91(0xb8)]?define([_0x608b91(0xc7),_0x608b91(0xae),_0x608b91(0xaf),'@univerjs/sheets/facade',_0x608b91(0xc4),_0x608b91(0xa3)],_0x42ab3a):(_0x1e4cc3=typeof globalThis<'u'?globalThis:_0x1e4cc3||self,_0x42ab3a(_0x1e4cc3['UniverCoreFacade'],_0x1e4cc3['UniverSheetsFormulaFacade'],_0x1e4cc3[_0x608b91(0x99)],_0x1e4cc3['UniverSheetsFacade'],_0x1e4cc3['UniverProSheetsMcp'],_0x1e4cc3[_0x608b91(0xb6)]));}(this,function(_0xf75ef5,_0x1f1620,_0x3e9414,_0xe8b44,_0x294392,_0x28e7c0){'use strict';const _0x48afa6=_0x3188;class _0x2b1521 extends _0xf75ef5['FUniver']{async[_0x48afa6(0xbd)](){const _0x143498=_0x48afa6;return this[_0x143498(0xbf)]()['getLintErrors']();}}_0xf75ef5[_0x48afa6(0x9e)][_0x48afa6(0xcb)](_0x2b1521);class _0x183531 extends _0xe8b44[_0x48afa6(0xc5)]{async['getLintErrors'](){const _0x408f9c=_0x48afa6,_0x1d359d=this[_0x408f9c(0xcf)](),_0x1d1a93=await this[_0x408f9c(0xd1)]();return{'formulaErrors':_0x1d359d,'dataValidationErrors':_0x1d1a93};}}_0xe8b44[_0x48afa6(0xc5)][_0x48afa6(0xcb)](_0x183531);class _0x136e8a extends _0xe8b44[_0x48afa6(0xd2)]{async[_0x48afa6(0x9f)](){const _0x43cdae=_0x48afa6,_0x5d27a3=this[_0x43cdae(0xc9)][_0x43cdae(0xc8)](_0x294392[_0x43cdae(0xaa)]),_0x3e57f8=this[_0x43cdae(0xa0)](0x0,0x0,this[_0x43cdae(0x9a)](),this[_0x43cdae(0x96)]())[_0x43cdae(0xca)]();return await _0x5d27a3[_0x43cdae(0xa6)](_0x3e57f8);}async[_0x48afa6(0xb0)](){const _0x2a5e8b=_0x48afa6;return(await this[_0x2a5e8b(0x9f)]())[_0x2a5e8b(0xa5)](_0x294392[_0x2a5e8b(0xc2)]);}[_0x48afa6(0xb4)](_0x26c231){const _0x20b2d1=_0x48afa6,_0x2996cf=this['_injector'][_0x20b2d1(0xc8)](_0x294392[_0x20b2d1(0xb7)]),_0x20ba54=this[_0x20b2d1(0xa0)](0x0,0x0,this[_0x20b2d1(0x9a)](),this[_0x20b2d1(0x96)]())[_0x20b2d1(0xca)]();return _0x2996cf[_0x20b2d1(0xbb)](_0x26c231),_0x2996cf[_0x20b2d1(0x9c)](_0x20ba54,this[_0x20b2d1(0xa2)],this['_worksheet']);}[_0x48afa6(0xa1)](_0x4aab43){const _0x43993a=_0x48afa6;return this[_0x43993a(0xb4)](_0x4aab43)[_0x43993a(0xa5)](_0x294392[_0x43993a(0xce)]);}[_0x48afa6(0xc0)](_0x5ebad6){const _0xddbd=_0x48afa6,_0x321772=this[_0xddbd(0xc9)][_0xddbd(0xc8)](_0x294392[_0xddbd(0xa8)]);return _0x321772['updateConfig'](_0x5ebad6),_0x321772[_0xddbd(0xd0)](this['_worksheet']);}[_0x48afa6(0xc1)](_0x36fb86){const _0x56d806=_0x48afa6,_0x21069e=this[_0x56d806(0xc9)]['get'](_0x294392[_0x56d806(0xa8)]);_0x21069e['updateConfig'](_0x36fb86);const _0x588cf=_0x21069e[_0x56d806(0xd0)](this[_0x56d806(0xab)]);return _0x21069e[_0x56d806(0x95)](_0x588cf);}}_0xe8b44[_0x48afa6(0xd2)][_0x48afa6(0xcb)](_0x136e8a);class _0x242a4d extends _0xe8b44[_0x48afa6(0x98)]{async[_0x48afa6(0x9f)](){const _0x5e1ed1=_0x48afa6,_0x378b61=this[_0x5e1ed1(0xc9)][_0x5e1ed1(0xc8)](_0x294392[_0x5e1ed1(0xaa)]),_0x5c6ab4=(({startRow:_0x4232da,endRow:_0x5b8428,startColumn:_0x1d0991,endColumn:_0x308b81})=>{const _0x547346=_0x5e1ed1,_0x5db98e=[];for(let _0x5e857e=_0x4232da;_0x5e857e<=_0x5b8428;_0x5e857e++){const _0x44eb99=[];for(let _0x4dfbed=_0x1d0991;_0x4dfbed<=_0x308b81;_0x4dfbed++)_0x44eb99[_0x547346(0xad)](this['_worksheet']['getCellRaw'](_0x5e857e,_0x4dfbed));_0x5db98e[_0x547346(0xad)](_0x44eb99);}return _0x5db98e;})({'startRow':0x0,'endRow':this[_0x5e1ed1(0xab)][_0x5e1ed1(0x9a)](),'startColumn':0x0,'endColumn':this[_0x5e1ed1(0xab)][_0x5e1ed1(0x96)]()}),_0x4b7187=await _0x378b61['getAllFormulaUsages'](_0x5c6ab4),_0x4581ec=this['getRange'](),_0x3dff4e=[];for(let _0x419d7c=0x0;_0x419d7c<_0x4b7187['length'];_0x419d7c++){const _0x231a1c=_0x4b7187[_0x419d7c],_0x3ce029=_0x231a1c[_0x5e1ed1(0x97)],_0x4f9fd5=[];for(let _0x2c0a5e=0x0;_0x2c0a5e<_0x3ce029[_0x5e1ed1(0xcd)];_0x2c0a5e++){const _0x46d515=_0x3ce029[_0x2c0a5e],_0x26789a=_0x28e7c0[_0x5e1ed1(0xbc)](_0x46d515,_0x4581ec);_0x26789a&&_0x4f9fd5[_0x5e1ed1(0xad)](_0x26789a);}if(_0x4f9fd5[_0x5e1ed1(0xcd)]>0x0){if(_0x231a1c[_0x5e1ed1(0x97)]=_0x4f9fd5,!(_0x231a1c[_0x5e1ed1(0x94)][_0x5e1ed1(0xb1)]>=_0x4581ec[_0x5e1ed1(0xb1)]&&_0x231a1c[_0x5e1ed1(0x94)][_0x5e1ed1(0xb1)]<=_0x4581ec[_0x5e1ed1(0xcc)]&&_0x231a1c[_0x5e1ed1(0x94)][_0x5e1ed1(0xa9)]>=_0x4581ec['startColumn']&&_0x231a1c['firstOccurrence'][_0x5e1ed1(0xa9)]<=_0x4581ec['endColumn'])){const _0x1bfb1f=_0x4f9fd5[0x0],_0x4e5d3a=_0x1bfb1f[_0x5e1ed1(0xb1)]-_0x231a1c[_0x5e1ed1(0x94)][_0x5e1ed1(0xb1)],_0x21bd1b=_0x1bfb1f['startColumn']-_0x231a1c[_0x5e1ed1(0x94)][_0x5e1ed1(0xa9)];_0x231a1c[_0x5e1ed1(0xa7)]=await _0x378b61[_0x5e1ed1(0xa4)](_0x231a1c['formula'],_0x21bd1b,_0x4e5d3a),_0x231a1c['firstOccurrence']={'startRow':_0x1bfb1f[_0x5e1ed1(0xb1)],'endRow':_0x1bfb1f[_0x5e1ed1(0xb1)],'startColumn':_0x1bfb1f['startColumn'],'endColumn':_0x1bfb1f[_0x5e1ed1(0xa9)]};}_0x3dff4e[_0x5e1ed1(0xad)](_0x231a1c);}}return _0x3dff4e;}async[_0x48afa6(0xb0)](){const _0x27629a=_0x48afa6;return(await this[_0x27629a(0x9f)]())[_0x27629a(0xa5)](_0x294392[_0x27629a(0xc2)]);}[_0x48afa6(0xb4)](_0x2826f1){const _0x448816=_0x48afa6,_0x2f77c1=this[_0x448816(0xc9)]['get'](_0x294392['IStyleUsageAnalyzer']),_0x320793=(({startRow:_0x158945,endRow:_0x2e4341,startColumn:_0xe0b5f1,endColumn:_0x3bfe54})=>{const _0x3dc937=_0x448816,_0x2a329b=[];for(let _0x1fe44c=_0x158945;_0x1fe44c<=_0x2e4341;_0x1fe44c++){const _0x29e34d=[];for(let _0x5a0b8e=_0xe0b5f1;_0x5a0b8e<=_0x3bfe54;_0x5a0b8e++)_0x29e34d['push'](this['_worksheet'][_0x3dc937(0xac)](_0x1fe44c,_0x5a0b8e));_0x2a329b['push'](_0x29e34d);}return _0x2a329b;})({'startRow':0x0,'endRow':this[_0x448816(0xab)][_0x448816(0x9a)](),'startColumn':0x0,'endColumn':this['_worksheet'][_0x448816(0x96)]()});_0x2f77c1[_0x448816(0xbb)](_0x2826f1);const _0x329f3b=_0x2f77c1[_0x448816(0x9c)](_0x320793,this[_0x448816(0xa2)],this[_0x448816(0xab)]),_0x4033a7=this[_0x448816(0xa0)](),_0x3c8666=[];for(let _0x4abb66=0x0;_0x4abb66<_0x329f3b[_0x448816(0xcd)];_0x4abb66++){const _0x3f1d69=_0x329f3b[_0x4abb66],_0x424686=_0x3f1d69[_0x448816(0x97)],_0x81b275=[];for(let _0x6b9f51=0x0;_0x6b9f51<_0x424686['length'];_0x6b9f51++){const _0x22d9d5=_0x424686[_0x6b9f51],_0x9e278d=_0x28e7c0['getIntersectRange'](_0x22d9d5,_0x4033a7);_0x9e278d&&_0x81b275[_0x448816(0xad)](_0x9e278d);}_0x81b275[_0x448816(0xcd)]>0x0&&(_0x3f1d69['filledRanges']=_0x81b275,_0x3c8666[_0x448816(0xad)](_0x3f1d69));}return _0x3c8666;}[_0x48afa6(0xa1)](_0x3d53ec){const _0x506647=_0x48afa6;return this[_0x506647(0xb4)](_0x3d53ec)[_0x506647(0xa5)](_0x294392[_0x506647(0xce)]);}[_0x48afa6(0xc0)](_0x54f54a){const _0x4c54fb=_0x48afa6,_0x3844b8=this[_0x4c54fb(0xc9)][_0x4c54fb(0xc8)](_0x294392[_0x4c54fb(0xa8)]),_0x34732a=this[_0x4c54fb(0xa0)]();return _0x3844b8[_0x4c54fb(0xbb)](_0x54f54a),_0x3844b8[_0x4c54fb(0xd0)](this[_0x4c54fb(0xab)],_0x34732a[_0x4c54fb(0xb1)],_0x34732a[_0x4c54fb(0xcc)],_0x34732a[_0x4c54fb(0xa9)],_0x34732a[_0x4c54fb(0x9d)]);}['getSizeUsagesAsA1'](_0x2ee6da){const _0x4f9454=_0x48afa6,_0x386fac=this[_0x4f9454(0xc0)](_0x2ee6da);return this['_injector']['get'](_0x294392[_0x4f9454(0xa8)])[_0x4f9454(0x95)](_0x386fac);}}_0xe8b44[_0x48afa6(0x98)][_0x48afa6(0xcb)](_0x242a4d);}));
|