@univerjs-pro/sheets-sparkline 0.5.1-nightly.202412231606
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/README.md +31 -0
- package/lib/cjs/facade.js +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/es/facade.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/types/commands/commands/add-sheet-sparkline.command.d.ts +9 -0
- package/lib/types/commands/commands/remove-sheet-sparkline.command.d.ts +6 -0
- package/lib/types/commands/commands/set-sheet-sparkline.command.d.ts +17 -0
- package/lib/types/commands/mutations/add-sheet-sparkline.mutation.d.ts +8 -0
- package/lib/types/commands/mutations/remove-sheet-sparkline.mutation.d.ts +10 -0
- package/lib/types/commands/mutations/set-sheet-sparkline.mutation.d.ts +9 -0
- package/lib/types/common/const.d.ts +4 -0
- package/lib/types/common/type.d.ts +111 -0
- package/lib/types/common/util.d.ts +2 -0
- package/lib/types/controllers/sparkline-clear-all.controller.d.ts +11 -0
- package/lib/types/controllers/sparkline-copy-sheet.controller.d.ts +9 -0
- package/lib/types/controllers/sparkline-data-change.controller.d.ts +11 -0
- package/lib/types/controllers/sparkline-hide-row-col.controller.d.ts +8 -0
- package/lib/types/controllers/sparkline-merge.controller.d.ts +10 -0
- package/lib/types/controllers/sparkline-ref-range.controller.d.ts +27 -0
- package/lib/types/facade/f-sparkline-group.d.ts +32 -0
- package/lib/types/facade/f-sparkline.d.ts +25 -0
- package/lib/types/facade/f-worksheet.d.ts +69 -0
- package/lib/types/facade/index.d.ts +4 -0
- package/lib/types/index.d.ts +14 -0
- package/lib/types/models/sparkline-data-source.model.d.ts +35 -0
- package/lib/types/plugin.d.ts +12 -0
- package/lib/types/services/sparkline.service.d.ts +8 -0
- package/lib/umd/facade.js +1 -0
- package/lib/umd/index.js +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { IObjectMatrixPrimitiveType, IRange, ObjectMatrix } from '@univerjs/core';
|
|
2
|
+
export type ISparklinesModel = Map<string, Map<string, Map<string, ISparklineGroup>>>;
|
|
3
|
+
export type ISparklineSnapshotJSON = Record<string, Record<string, Record<string, ISparklineSerializedGroup>>>;
|
|
4
|
+
export interface ISparklineAnchorData {
|
|
5
|
+
groupId: string;
|
|
6
|
+
data: Array<string | number | undefined>;
|
|
7
|
+
max: number;
|
|
8
|
+
min: number;
|
|
9
|
+
highIndex: number;
|
|
10
|
+
lowIndex: number;
|
|
11
|
+
negativeIndexes: number[];
|
|
12
|
+
}
|
|
13
|
+
export type ISparklineAnchorMap = Map<string, Map<string, {
|
|
14
|
+
matrix: ObjectMatrix<ISparklineAnchorData>;
|
|
15
|
+
extra: Record<string, ISparklineGroupExtra>;
|
|
16
|
+
}>>;
|
|
17
|
+
export interface ISparklineGroupExtra {
|
|
18
|
+
groupMax: number;
|
|
19
|
+
groupMin: number;
|
|
20
|
+
showMax: number;
|
|
21
|
+
showMin: number;
|
|
22
|
+
startGradient: string;
|
|
23
|
+
endGradient: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ISparklineDataSource {
|
|
26
|
+
}
|
|
27
|
+
export interface ISparklineGroupConfig {
|
|
28
|
+
type?: SparklineTypeEnum;
|
|
29
|
+
axis?: ISparklineAxisConfig;
|
|
30
|
+
extremumMax?: ISparklineExtremumConfig;
|
|
31
|
+
extremumMin?: ISparklineExtremumConfig;
|
|
32
|
+
themeType?: SparklineThemeTypeEnum;
|
|
33
|
+
nonNumShowAs?: SpacialShowAsEnum;
|
|
34
|
+
emptyShowAs?: SpacialShowAsEnum;
|
|
35
|
+
containHiddenCells?: boolean;
|
|
36
|
+
seriesColor?: string;
|
|
37
|
+
points?: ISparklinePoints;
|
|
38
|
+
lineWidth?: number;
|
|
39
|
+
showGradient?: boolean;
|
|
40
|
+
showRadius?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare enum SparklineThemeTypeEnum {
|
|
43
|
+
STANDARD = "standard",
|
|
44
|
+
SPECIALTY = "specialty",
|
|
45
|
+
DISTINCTIVE = "distinctive",
|
|
46
|
+
SOFT = "soft",
|
|
47
|
+
FRESH = "fresh",
|
|
48
|
+
CUSTOM = "custom"
|
|
49
|
+
}
|
|
50
|
+
export type IExcludeCustom = Exclude<SparklineThemeTypeEnum, SparklineThemeTypeEnum.CUSTOM>;
|
|
51
|
+
export declare enum SparklineTypeEnum {
|
|
52
|
+
LINE_CHART = 1,
|
|
53
|
+
BAR_CHART = 2,
|
|
54
|
+
PROFIT_AND_LOSS_CHART = 3,
|
|
55
|
+
PIE_CHART = 4
|
|
56
|
+
}
|
|
57
|
+
export declare enum SpacialShowAsEnum {
|
|
58
|
+
SPACING = "spacing",
|
|
59
|
+
ZERO_VALUE = "zero_value",
|
|
60
|
+
CONNECT_WITH_LINE = "connect_with_line"
|
|
61
|
+
}
|
|
62
|
+
export interface ISparklinePoints {
|
|
63
|
+
highPoint?: ISparklinePointConfig;
|
|
64
|
+
lowPoint?: ISparklinePointConfig;
|
|
65
|
+
firstPoint?: ISparklinePointConfig;
|
|
66
|
+
lastPoint?: ISparklinePointConfig;
|
|
67
|
+
negativePoint?: ISparklinePointConfig;
|
|
68
|
+
markersPoint?: ISparklinePointConfig;
|
|
69
|
+
}
|
|
70
|
+
export interface ISparklinePointConfig {
|
|
71
|
+
visible?: boolean;
|
|
72
|
+
color?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface ISparklineAxisConfig {
|
|
75
|
+
color?: string;
|
|
76
|
+
reverse?: boolean;
|
|
77
|
+
visible?: boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface ISparklineExtremumConfig {
|
|
80
|
+
type?: SparklineExtremumTypeEnum;
|
|
81
|
+
value?: number;
|
|
82
|
+
}
|
|
83
|
+
export declare enum SparklineExtremumTypeEnum {
|
|
84
|
+
SELF_EXTREMUM = 1,
|
|
85
|
+
GROUP_EXTREMUM = 2,
|
|
86
|
+
CUSTOM_EXTREMUM = 3
|
|
87
|
+
}
|
|
88
|
+
export interface ISparklineItem {
|
|
89
|
+
source: string;
|
|
90
|
+
position: ISparklinePosition;
|
|
91
|
+
}
|
|
92
|
+
export interface ISparklinePosition {
|
|
93
|
+
row: number;
|
|
94
|
+
col: number;
|
|
95
|
+
}
|
|
96
|
+
export interface ISparklineGroup {
|
|
97
|
+
config: ISparklineGroupConfig;
|
|
98
|
+
sparklines: ObjectMatrix<IRange>;
|
|
99
|
+
}
|
|
100
|
+
export interface ISparklineSerializedGroup {
|
|
101
|
+
config: ISparklineGroupConfig;
|
|
102
|
+
sparklines: IObjectMatrixPrimitiveType<IRange>;
|
|
103
|
+
}
|
|
104
|
+
export interface IPositionInfo {
|
|
105
|
+
sourceRange: IRange;
|
|
106
|
+
targetRanges: IRange[];
|
|
107
|
+
}
|
|
108
|
+
export interface IUnitInfo {
|
|
109
|
+
unitId: string;
|
|
110
|
+
subUnitId: string;
|
|
111
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { SheetInterceptorService, SheetsSelectionsService } from '@univerjs/sheets';
|
|
3
|
+
import { SparklineDataSourceModel } from '../models/sparkline-data-source.model';
|
|
4
|
+
export declare class SparklineClearAllController extends Disposable {
|
|
5
|
+
private _sparklineDataSourceModel;
|
|
6
|
+
private _sheetInterceptorService;
|
|
7
|
+
private _univerInstanceService;
|
|
8
|
+
private _sheetSelectionService;
|
|
9
|
+
constructor(_sparklineDataSourceModel: SparklineDataSourceModel, _sheetInterceptorService: SheetInterceptorService, _univerInstanceService: IUniverInstanceService, _sheetSelectionService: SheetsSelectionsService);
|
|
10
|
+
private _initClearWithSparkline;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
+
import { SparklineDataSourceModel } from '../models/sparkline-data-source.model';
|
|
4
|
+
export declare class SparklineCopySheetController extends Disposable {
|
|
5
|
+
private readonly _sheetInterceptorService;
|
|
6
|
+
private readonly _sparklineDataSourceModel;
|
|
7
|
+
constructor(_sheetInterceptorService: SheetInterceptorService, _sparklineDataSourceModel: SparklineDataSourceModel);
|
|
8
|
+
private _initCopySheetWithSparkline;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
2
|
+
import { IExclusiveRangeService } from '@univerjs/sheets';
|
|
3
|
+
import { SparklineDataSourceModel } from '../models/sparkline-data-source.model';
|
|
4
|
+
export declare class SparklineDataChangeController extends Disposable {
|
|
5
|
+
private readonly _commandService;
|
|
6
|
+
private readonly _sparklineDataSourceModel;
|
|
7
|
+
private readonly _exclusiveRangeService;
|
|
8
|
+
constructor(_commandService: ICommandService, _sparklineDataSourceModel: SparklineDataSourceModel, _exclusiveRangeService: IExclusiveRangeService);
|
|
9
|
+
private _initDataChangeListener;
|
|
10
|
+
private _initExclusiveRangeChange;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
2
|
+
import { SparklineDataSourceModel } from '../models/sparkline-data-source.model';
|
|
3
|
+
export declare class SparklineHideRowColController extends Disposable {
|
|
4
|
+
private _commandService;
|
|
5
|
+
private _sparklineDataSourceModel;
|
|
6
|
+
constructor(_commandService: ICommandService, _sparklineDataSourceModel: SparklineDataSourceModel);
|
|
7
|
+
private _initHideRowColWithSparkline;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
2
|
+
import { SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
+
import { SparklineDataSourceModel } from '../models/sparkline-data-source.model';
|
|
4
|
+
export declare class SparklineMergeController extends Disposable {
|
|
5
|
+
private readonly _commandService;
|
|
6
|
+
private readonly _sheetInterceptorService;
|
|
7
|
+
private readonly _sparklineDataSourceModel;
|
|
8
|
+
constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _sparklineDataSourceModel: SparklineDataSourceModel);
|
|
9
|
+
private _initMergeWithSparkline;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IMutationInfo, Disposable, DisposableCollection, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { EffectRefRangeParams, RefRangeService, SheetInterceptorService } from '@univerjs/sheets';
|
|
3
|
+
import { SparklineDataSourceModel } from '../models/sparkline-data-source.model';
|
|
4
|
+
export declare class SparklineRefRangeController extends Disposable {
|
|
5
|
+
private _commandService;
|
|
6
|
+
private _sheetInterceptorService;
|
|
7
|
+
private readonly _refRangeService;
|
|
8
|
+
private readonly _univerInstanceService;
|
|
9
|
+
private _sparklineDataSourceModel;
|
|
10
|
+
disposableCollection: DisposableCollection;
|
|
11
|
+
constructor(_commandService: ICommandService, _sheetInterceptorService: SheetInterceptorService, _refRangeService: RefRangeService, _univerInstanceService: IUniverInstanceService, _sparklineDataSourceModel: SparklineDataSourceModel);
|
|
12
|
+
private _onRefRangeChange;
|
|
13
|
+
refRangeHandle(config: EffectRefRangeParams, unitId: string, subUnitId: string): {
|
|
14
|
+
redos: IMutationInfo<object>[];
|
|
15
|
+
undos: IMutationInfo<object>[];
|
|
16
|
+
preRedos?: undefined;
|
|
17
|
+
preUndos?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
redos: IMutationInfo<object>[];
|
|
20
|
+
undos: IMutationInfo<object>[];
|
|
21
|
+
preRedos: IMutationInfo<object>[];
|
|
22
|
+
preUndos: IMutationInfo<object>[];
|
|
23
|
+
};
|
|
24
|
+
private _getRefRangeMutationsByDeleteRows;
|
|
25
|
+
private _getRefRangeMutationsByDeleteCols;
|
|
26
|
+
private _initCorrectRangeWithSparkline;
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IRange, Injector } from '@univerjs/core';
|
|
2
|
+
import { ISparklineGroup } from '@univerjs-pro/sheets-sparkline';
|
|
3
|
+
export declare class FSparklineGroup {
|
|
4
|
+
private _unitId;
|
|
5
|
+
private _subUnitId;
|
|
6
|
+
private _groupId;
|
|
7
|
+
protected readonly _injector: Injector;
|
|
8
|
+
constructor(_unitId: string, _subUnitId: string, _groupId: string, _injector: Injector);
|
|
9
|
+
/**
|
|
10
|
+
* @description Modify the data source of the sparkline group
|
|
11
|
+
*
|
|
12
|
+
* @param {IRange[]} sourceRanges Location of new data source
|
|
13
|
+
* @param {IRange[]} targetRanges New placement
|
|
14
|
+
*
|
|
15
|
+
* @returns {FSparklineGroup | undefined}
|
|
16
|
+
*/
|
|
17
|
+
changeDataSource(sourceRanges: IRange[], targetRanges: IRange[]): FSparklineGroup | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* @description Delete the sparkline group
|
|
20
|
+
*
|
|
21
|
+
* @returns {void}
|
|
22
|
+
*/
|
|
23
|
+
removeSparklineGroup(): void;
|
|
24
|
+
/**
|
|
25
|
+
* @description Modify the configuration of the current sparkline group
|
|
26
|
+
*
|
|
27
|
+
* @param {ISparklineGroup} config new sparkline group config
|
|
28
|
+
*
|
|
29
|
+
* @returns {FSparklineGroup}
|
|
30
|
+
*/
|
|
31
|
+
setConfig(config: ISparklineGroup): FSparklineGroup;
|
|
32
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Injector, IRange } from '@univerjs/core';
|
|
2
|
+
export declare class FSparkline {
|
|
3
|
+
private _unitId;
|
|
4
|
+
private _subUnitId;
|
|
5
|
+
private _groupId;
|
|
6
|
+
private _row;
|
|
7
|
+
private _col;
|
|
8
|
+
protected readonly _injector: Injector;
|
|
9
|
+
constructor(_unitId: string, _subUnitId: string, _groupId: string, _row: number, _col: number, _injector: Injector);
|
|
10
|
+
/**
|
|
11
|
+
* @description Modify the data source of the sparkline in the current cell
|
|
12
|
+
*
|
|
13
|
+
* @param {IRange} sourceRange Location of new data source
|
|
14
|
+
* @param {IRange} targetRange New placement
|
|
15
|
+
*
|
|
16
|
+
* @returns {FSparkline | undefined}
|
|
17
|
+
*/
|
|
18
|
+
changeDataSource(sourceRange: IRange, targetRange: IRange): FSparkline | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* @description Delete the sparkline in the current cell
|
|
21
|
+
*
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
24
|
+
removeSparkline(): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ISparklineGroup, SparklineTypeEnum } from '@univerjs-pro/sheets-sparkline';
|
|
2
|
+
import { IRange } from '@univerjs/core';
|
|
3
|
+
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
4
|
+
import { FSparkline } from './f-sparkline';
|
|
5
|
+
import { FSparklineGroup } from './f-sparkline-group';
|
|
6
|
+
export interface IFWorksheetSparklineMixin {
|
|
7
|
+
/**
|
|
8
|
+
* @description Add sparkline to the worksheet.
|
|
9
|
+
*
|
|
10
|
+
* @param {IRange[]} sourceRanges Source data location for sparklines
|
|
11
|
+
* @param {IRange[]} targetRanges Where to place sparklines
|
|
12
|
+
* @param {SparklineTypeEnum} type The type of Sparklines
|
|
13
|
+
*
|
|
14
|
+
* @returns {FSparkline | undefined} Returns the sparkline instance for the next call
|
|
15
|
+
*/
|
|
16
|
+
addSparkline(sourceRanges: IRange[], targetRanges: IRange[], type: SparklineTypeEnum.LINE_CHART): FSparkline | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* @description Get all sparklines in the worksheet.
|
|
19
|
+
*
|
|
20
|
+
* @returns {Map<string, ISparklineGroup> | undefined}
|
|
21
|
+
*/
|
|
22
|
+
getAllSubSparkline(): Map<string, ISparklineGroup> | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* @description Group the sparklines in the selection into a new sparkline group
|
|
25
|
+
*
|
|
26
|
+
* @param {IRange[]} ranges Current selection
|
|
27
|
+
*
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
composeSparkline(ranges: IRange[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* @description Split the sparkline group within the current selection
|
|
33
|
+
*
|
|
34
|
+
* @param {IRange[]} ranges Current selection
|
|
35
|
+
*
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
unComposeSparkline(ranges: IRange[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* @description Get the sparkline instance of the current cell
|
|
41
|
+
*
|
|
42
|
+
* @param {number} row
|
|
43
|
+
* @param {number} col
|
|
44
|
+
*
|
|
45
|
+
* @returns {FSparkline | undefined} Returns the sparkline instance for the next call
|
|
46
|
+
*/
|
|
47
|
+
getSparklineByCell(row: number, col: number): FSparkline | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* @description Get the sparkline groups instance of the current cell
|
|
50
|
+
*
|
|
51
|
+
* @param {number} row
|
|
52
|
+
* @param {number} col
|
|
53
|
+
*
|
|
54
|
+
* @returns {FSparklineGroup | undefined}
|
|
55
|
+
*/
|
|
56
|
+
getSparklineGroupByCell(row: number, col: number): FSparklineGroup | undefined;
|
|
57
|
+
}
|
|
58
|
+
export declare class FWorksheetSparklineMixin extends FWorksheet implements IFWorksheetSparklineMixin {
|
|
59
|
+
addSparkline(sourceRanges: IRange[], targetRanges: IRange[], type: SparklineTypeEnum.LINE_CHART): FSparkline | undefined;
|
|
60
|
+
getAllSubSparkline(): Map<string, ISparklineGroup> | undefined;
|
|
61
|
+
composeSparkline(ranges: IRange[]): void;
|
|
62
|
+
unComposeSparkline(ranges: IRange[]): void;
|
|
63
|
+
getSparklineByCell(row: number, col: number): FSparkline | undefined;
|
|
64
|
+
getSparklineGroupByCell(row: number, col: number): FSparklineGroup | undefined;
|
|
65
|
+
}
|
|
66
|
+
declare module '@univerjs/sheets/facade' {
|
|
67
|
+
interface FWorksheet extends IFWorksheetSparklineMixin {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { UniverSheetSparklinePlugin } from './plugin';
|
|
2
|
+
export { SparklineDataSourceModel } from './models/sparkline-data-source.model';
|
|
3
|
+
export type { IExcludeCustom, ISparklineAnchorData, ISparklineGroup, ISparklineGroupConfig, ISparklineGroupExtra, ISparklinePointConfig, ISparklinePoints, ISparklineSerializedGroup, IUnitInfo } from './common/type';
|
|
4
|
+
export { SpacialShowAsEnum, SparklineExtremumTypeEnum, SparklineThemeTypeEnum, SparklineTypeEnum } from './common/type';
|
|
5
|
+
export { AddSheetSparklineCommand } from './commands/commands/add-sheet-sparkline.command';
|
|
6
|
+
export { getSparklinePlacement } from './common/util';
|
|
7
|
+
export { RemoveSheetSparklineCommand } from './commands/commands/remove-sheet-sparkline.command';
|
|
8
|
+
export { SetSheetSparklineCommand } from './commands/commands/set-sheet-sparkline.command';
|
|
9
|
+
export { PLUGIN_NAME, SparklinePointsNames, SparklineThemeMapping } from './common/const';
|
|
10
|
+
export { AddSheetSparklineMutation } from './commands/mutations/add-sheet-sparkline.mutation';
|
|
11
|
+
export { RemoveSheetSparklineMutation } from './commands/mutations/remove-sheet-sparkline.mutation';
|
|
12
|
+
export type { ISetSheetSparklineCommandProps } from './commands/commands/set-sheet-sparkline.command';
|
|
13
|
+
export type { IAddSheetSparklineCommandProps } from './commands/commands/add-sheet-sparkline.command';
|
|
14
|
+
export type { IRemoveSheetSparklineCommandProps } from './commands/commands/remove-sheet-sparkline.command';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ISparklineAnchorMap, ISparklineGroup, ISparklinesModel, ISparklineSnapshotJSON } from '../common/type';
|
|
2
|
+
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
3
|
+
export declare class SparklineDataSourceModel extends Disposable {
|
|
4
|
+
private _univerInstanceService;
|
|
5
|
+
private readonly _sparklineModel;
|
|
6
|
+
private readonly _sparklineAnchorMap;
|
|
7
|
+
private _updateConfig$;
|
|
8
|
+
updateConfig$: import('rxjs').Observable<{
|
|
9
|
+
unitId: string;
|
|
10
|
+
subUnitId: string;
|
|
11
|
+
groupId: string;
|
|
12
|
+
config?: ISparklineGroup;
|
|
13
|
+
type: "add" | "set" | "remove";
|
|
14
|
+
}>;
|
|
15
|
+
constructor(_univerInstanceService: IUniverInstanceService);
|
|
16
|
+
private _ensureConfigMap;
|
|
17
|
+
private _ensureAnchorMatrix;
|
|
18
|
+
updateSparklineExtraNum(unitId: string, subUnitId: string, groupId: string, type?: 'set' | 'add'): void;
|
|
19
|
+
addSparkline(unitId: string, subUnitId: string, groupId: string, config: ISparklineGroup): void;
|
|
20
|
+
setSparkline(unitId: string, subUnitId: string, groupIds: string[], config: ISparklineGroup): void;
|
|
21
|
+
removeSparkline(unitId: string, subUnitId: string, groupId: string): void;
|
|
22
|
+
removePartSparkline(unitId: string, subUnitId: string, row: number, col: number): void;
|
|
23
|
+
clearSparklineCache(unitId: string, subUnitId: string, groupId: string): void;
|
|
24
|
+
getSubUnitSparkline(unitId: string, subUnitId: string): Map<string, ISparklineGroup> | undefined;
|
|
25
|
+
getSparklineById(unitId: string, subUnitId: string, groupId: string): ISparklineGroup | undefined;
|
|
26
|
+
getSparkline(unitId: string, subUnitId: string, row: number, col: number): string | undefined;
|
|
27
|
+
reBuildAnchorCache(unitId: string, subUnitId: string): void;
|
|
28
|
+
getSparklineCache(): {
|
|
29
|
+
sparklineModel: ISparklinesModel;
|
|
30
|
+
sparklineAnchorMap: ISparklineAnchorMap;
|
|
31
|
+
};
|
|
32
|
+
toJSON(unitId: string): ISparklineSnapshotJSON;
|
|
33
|
+
fromJSON(modelJSON: ISparklineSnapshotJSON): void;
|
|
34
|
+
deleteUnit(unitId: string): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ICommandService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
export declare class UniverSheetSparklinePlugin extends Plugin {
|
|
3
|
+
private readonly _config;
|
|
4
|
+
protected _injector: Injector;
|
|
5
|
+
private readonly _commandService;
|
|
6
|
+
static pluginName: string;
|
|
7
|
+
static type: UniverInstanceType;
|
|
8
|
+
constructor(_config: {} | undefined, _injector: Injector, _commandService: ICommandService);
|
|
9
|
+
private _initDependencies;
|
|
10
|
+
onReady(): void;
|
|
11
|
+
private _initRegisterCommand;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Disposable, IResourceManagerService } from '@univerjs/core';
|
|
2
|
+
import { SparklineDataSourceModel } from '../models/sparkline-data-source.model';
|
|
3
|
+
export declare class SparklineService extends Disposable {
|
|
4
|
+
private _resourceManagerService;
|
|
5
|
+
private _sparklineDataSourceModel;
|
|
6
|
+
constructor(_resourceManagerService: IResourceManagerService, _sparklineDataSourceModel: SparklineDataSourceModel);
|
|
7
|
+
private _initSnapshot;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x26d4(_0x4efe80,_0x4dc805){const _0x13546f=_0x1354();return _0x26d4=function(_0x26d413,_0x463c5a){_0x26d413=_0x26d413-0x1dc;let _0x563944=_0x13546f[_0x26d413];return _0x563944;},_0x26d4(_0x4efe80,_0x4dc805);}(function(_0x31671a,_0x423172){const _0x1a94b9=_0x26d4,_0x3270a3=_0x31671a();while(!![]){try{const _0x308141=-parseInt(_0x1a94b9(0x1ed))/0x1+-parseInt(_0x1a94b9(0x1dd))/0x2+-parseInt(_0x1a94b9(0x21e))/0x3*(parseInt(_0x1a94b9(0x205))/0x4)+-parseInt(_0x1a94b9(0x208))/0x5*(-parseInt(_0x1a94b9(0x212))/0x6)+parseInt(_0x1a94b9(0x209))/0x7*(parseInt(_0x1a94b9(0x20d))/0x8)+-parseInt(_0x1a94b9(0x1f0))/0x9*(-parseInt(_0x1a94b9(0x214))/0xa)+parseInt(_0x1a94b9(0x200))/0xb;if(_0x308141===_0x423172)break;else _0x3270a3['push'](_0x3270a3['shift']());}catch(_0x5f5bb4){_0x3270a3['push'](_0x3270a3['shift']());}}}(_0x1354,0x2d9be),function(_0x3b9502,_0x315a39){const _0xf14906=_0x26d4;typeof exports==_0xf14906(0x20e)&&typeof module<'u'?_0x315a39(exports,require('@univerjs/core'),require(_0xf14906(0x21a)),require(_0xf14906(0x217))):typeof define==_0xf14906(0x207)&&define[_0xf14906(0x202)]?define([_0xf14906(0x1ec),_0xf14906(0x21d),_0xf14906(0x21a),_0xf14906(0x217)],_0x315a39):(_0x3b9502=typeof globalThis<'u'?globalThis:_0x3b9502||self,_0x315a39(_0x3b9502[_0xf14906(0x1e1)]={},_0x3b9502[_0xf14906(0x219)],_0x3b9502[_0xf14906(0x210)],_0x3b9502[_0xf14906(0x1e3)]));}(this,function(_0x3a6c9c,_0x2e8e95,_0x6a8571,_0x4c7951){'use strict';const _0x4f0622=_0x26d4;var _0x5de5c7=Object[_0x4f0622(0x1fc)],_0x33208c=Object['getOwnPropertyDescriptor'],_0x2a1668=(_0x5c63bc,_0x457bcd,_0x496795,_0x3896b2)=>{const _0x2070f0=_0x4f0622;for(var _0x529713=_0x3896b2>0x1?void 0x0:_0x3896b2?_0x33208c(_0x457bcd,_0x496795):_0x457bcd,_0xe3c0a3=_0x5c63bc[_0x2070f0(0x1e7)]-0x1,_0x1aed2a;_0xe3c0a3>=0x0;_0xe3c0a3--)(_0x1aed2a=_0x5c63bc[_0xe3c0a3])&&(_0x529713=(_0x3896b2?_0x1aed2a(_0x457bcd,_0x496795,_0x529713):_0x1aed2a(_0x529713))||_0x529713);return _0x3896b2&&_0x529713&&_0x5de5c7(_0x457bcd,_0x496795,_0x529713),_0x529713;},_0x699d58=(_0x4ae19f,_0x58e7ef)=>(_0x3ffc0a,_0x5262b2)=>_0x58e7ef(_0x3ffc0a,_0x5262b2,_0x4ae19f);_0x3a6c9c[_0x4f0622(0x1ee)]=class{constructor(_0x3ac893,_0x331b1d,_0x5d49a5,_0x67d46c,_0x3e5987,_0x44853b){const _0xc3dd6=_0x4f0622;this[_0xc3dd6(0x204)]=_0x3ac893,this['_subUnitId']=_0x331b1d,this['_groupId']=_0x5d49a5,this[_0xc3dd6(0x1dc)]=_0x67d46c,this[_0xc3dd6(0x211)]=_0x3e5987,this[_0xc3dd6(0x1e6)]=_0x44853b;}['changeDataSource'](_0x499c53,_0x17663c){const _0x41b26c=_0x4f0622,_0x48334d=this[_0x41b26c(0x1e6)][_0x41b26c(0x1ff)](_0x4c7951[_0x41b26c(0x20f)])[_0x41b26c(0x20b)](this[_0x41b26c(0x204)],this[_0x41b26c(0x1f9)],this[_0x41b26c(0x213)]);if(!_0x48334d)return;_0x48334d[_0x41b26c(0x1e4)][_0x41b26c(0x1ea)](this[_0x41b26c(0x1dc)],this['_col']);const {startRow:_0x146590,startColumn:_0x26ee80}=_0x17663c;return _0x48334d[_0x41b26c(0x1e4)][_0x41b26c(0x1e8)](_0x146590,_0x26ee80,_0x499c53),this;}[_0x4f0622(0x1fa)](){const _0x48bbf4=_0x4f0622,_0x2ff5a1=this['_injector'][_0x48bbf4(0x1ff)](_0x4c7951[_0x48bbf4(0x20f)]),_0x3255fd=_0x2ff5a1[_0x48bbf4(0x20b)](this['_unitId'],this[_0x48bbf4(0x1f9)],this[_0x48bbf4(0x213)]);_0x3255fd&&(_0x2ff5a1[_0x48bbf4(0x1f5)](this[_0x48bbf4(0x204)],this[_0x48bbf4(0x1f9)],this[_0x48bbf4(0x213)]),_0x3255fd[_0x48bbf4(0x1e4)][_0x48bbf4(0x1ea)](this[_0x48bbf4(0x1dc)],this[_0x48bbf4(0x211)]),_0x2ff5a1['updateSparklineExtraNum'](this[_0x48bbf4(0x204)],this[_0x48bbf4(0x1f9)],this['_groupId']));}},_0x3a6c9c[_0x4f0622(0x1ee)]=_0x2a1668([_0x699d58(0x5,_0x2e8e95[_0x4f0622(0x1fe)](_0x2e8e95[_0x4f0622(0x20a)]))],_0x3a6c9c[_0x4f0622(0x1ee)]);var _0x139bde=Object[_0x4f0622(0x1fc)],_0x1c281c=Object[_0x4f0622(0x1f2)],_0x20c8eb=(_0x478435,_0x167d41,_0x5591ad,_0x38932d)=>{const _0x14bccf=_0x4f0622;for(var _0x3df741=_0x38932d>0x1?void 0x0:_0x38932d?_0x1c281c(_0x167d41,_0x5591ad):_0x167d41,_0xabac09=_0x478435[_0x14bccf(0x1e7)]-0x1,_0x58e5f9;_0xabac09>=0x0;_0xabac09--)(_0x58e5f9=_0x478435[_0xabac09])&&(_0x3df741=(_0x38932d?_0x58e5f9(_0x167d41,_0x5591ad,_0x3df741):_0x58e5f9(_0x3df741))||_0x3df741);return _0x38932d&&_0x3df741&&_0x139bde(_0x167d41,_0x5591ad,_0x3df741),_0x3df741;},_0xbc7e56=(_0xea3c14,_0x3170d6)=>(_0x31706d,_0x1c9243)=>_0x3170d6(_0x31706d,_0x1c9243,_0xea3c14);_0x3a6c9c['FSparklineGroup']=class{constructor(_0x44fa6e,_0x43895e,_0x500dd7,_0x308afb){const _0x86655e=_0x4f0622;this[_0x86655e(0x204)]=_0x44fa6e,this['_subUnitId']=_0x43895e,this[_0x86655e(0x213)]=_0x500dd7,this[_0x86655e(0x1e6)]=_0x308afb;}[_0x4f0622(0x1e0)](_0x520e43,_0x3dd914){const _0x136da2=_0x4f0622,_0x226d68=this[_0x136da2(0x204)],_0x1805f0=this['_subUnitId'],_0x4f142b=this['_injector'][_0x136da2(0x1ff)](_0x4c7951['SparklineDataSourceModel']),_0xe31d4e=_0x4f142b[_0x136da2(0x20b)](_0x226d68,_0x1805f0,this[_0x136da2(0x213)]);if(!_0xe31d4e)return;_0x4f142b[_0x136da2(0x1f5)](_0x226d68,_0x1805f0,this[_0x136da2(0x213)]);const _0x544661=_0x4c7951[_0x136da2(0x218)](_0x520e43,_0x3dd914);return _0xe31d4e['sparklines']=_0x544661,_0x4f142b['updateSparklineExtraNum'](_0x226d68,_0x1805f0,this[_0x136da2(0x213)]),this;}[_0x4f0622(0x1f6)](){const _0x3f93bf=_0x4f0622,_0x54eb8b=this[_0x3f93bf(0x1e6)][_0x3f93bf(0x1ff)](_0x4c7951[_0x3f93bf(0x20f)]);_0x54eb8b['getSparklineById'](this[_0x3f93bf(0x204)],this[_0x3f93bf(0x1f9)],this[_0x3f93bf(0x213)])&&_0x54eb8b[_0x3f93bf(0x1fa)](this[_0x3f93bf(0x204)],this[_0x3f93bf(0x1f9)],this['_groupId']);}[_0x4f0622(0x1df)](_0x432c03){const _0x471548=_0x4f0622,_0x3361be=this[_0x471548(0x1e6)][_0x471548(0x1ff)](_0x4c7951[_0x471548(0x20f)]);return _0x3361be[_0x471548(0x20b)](this[_0x471548(0x204)],this[_0x471548(0x1f9)],this['_groupId'])&&_0x3361be[_0x471548(0x1f3)](this[_0x471548(0x204)],this[_0x471548(0x1f9)],[this[_0x471548(0x213)]],_0x432c03),this;}},_0x3a6c9c[_0x4f0622(0x1e2)]=_0x20c8eb([_0xbc7e56(0x3,_0x2e8e95[_0x4f0622(0x1fe)](_0x2e8e95[_0x4f0622(0x20a)]))],_0x3a6c9c[_0x4f0622(0x1e2)]);class _0x41fd62 extends _0x6a8571['FWorksheet']{[_0x4f0622(0x21b)](_0x5f9739,_0x34768b,_0x31020a){const _0x195e3e=_0x4f0622;if(this[_0x195e3e(0x1f4)]['syncExecuteCommand'](_0x4c7951[_0x195e3e(0x216)]['id'],{'sourceRanges':_0x5f9739,'targetRanges':_0x34768b,'targetInfo':{'unitId':this[_0x195e3e(0x1fd)][_0x195e3e(0x203)](),'subUnitId':this[_0x195e3e(0x20c)][_0x195e3e(0x206)]()},'config':{'type':_0x31020a}})){const {startRow:_0x27dd7f,startColumn:_0x137074}=_0x34768b[0x0];return this['getSparklineByCell'](_0x27dd7f,_0x137074);}}[_0x4f0622(0x1f8)](){const _0x51c1a6=_0x4f0622;return this[_0x51c1a6(0x1e6)][_0x51c1a6(0x1ff)](_0x4c7951[_0x51c1a6(0x20f)])['getSubUnitSparkline'](this[_0x51c1a6(0x1fd)][_0x51c1a6(0x203)](),this['_worksheet']['getSheetId']());}['composeSparkline'](_0x28c94d){const _0x277742=_0x4f0622,_0x38f1e0=this[_0x277742(0x1e6)][_0x277742(0x1ff)](_0x4c7951[_0x277742(0x20f)]);let _0x14e0da;for(let _0x1eaa2a=0x0;_0x1eaa2a<_0x28c94d['length'];_0x1eaa2a++){const _0x2b83b6=_0x28c94d[_0x1eaa2a],{startRow:_0x4b2db3,endRow:_0x5dc03c,startColumn:_0x13cacf,endColumn:_0x4d0080}=_0x2b83b6;for(let _0x122b00=_0x4b2db3;_0x122b00<=_0x5dc03c;_0x122b00++)for(let _0x521a35=_0x13cacf;_0x521a35<=_0x4d0080;_0x521a35++){const _0x586c55=_0x38f1e0[_0x277742(0x1fb)](this[_0x277742(0x1fd)]['getUnitId'](),this[_0x277742(0x20c)][_0x277742(0x206)](),_0x122b00,_0x521a35);if(_0x586c55){const _0x1631c1=_0x38f1e0['getSparklineById'](this[_0x277742(0x1fd)][_0x277742(0x203)](),this[_0x277742(0x20c)][_0x277742(0x206)](),_0x586c55);if(_0x1631c1){_0x14e0da=_0x2e8e95['Tools']['deepClone'](_0x1631c1);break;}}}}_0x14e0da||this[_0x277742(0x1f4)]['executeCommand'](_0x4c7951[_0x277742(0x1eb)]['id'],{'ranges':_0x28c94d,'combine':!0x0,'config':_0x14e0da,'isChangeDataSource':!0x1});}[_0x4f0622(0x1de)](_0x46f6fe){const _0x1b713b=_0x4f0622,_0x129596=this['_injector'][_0x1b713b(0x1ff)](_0x4c7951[_0x1b713b(0x20f)]);let _0xee6aeb;for(let _0x2b09f8=0x0;_0x2b09f8<_0x46f6fe['length'];_0x2b09f8++){const _0x42e95c=_0x46f6fe[_0x2b09f8],{startRow:_0x394ba0,endRow:_0x198515,startColumn:_0x4c1e56,endColumn:_0x34bfe5}=_0x42e95c;for(let _0x300840=_0x394ba0;_0x300840<=_0x198515;_0x300840++)for(let _0x420f2c=_0x4c1e56;_0x420f2c<=_0x34bfe5;_0x420f2c++){const _0x51f6bf=_0x129596['getSparkline'](this[_0x1b713b(0x1fd)][_0x1b713b(0x203)](),this[_0x1b713b(0x20c)][_0x1b713b(0x206)](),_0x300840,_0x420f2c);if(_0x51f6bf){const _0x1d1334=_0x129596['getSparklineById'](this[_0x1b713b(0x1fd)][_0x1b713b(0x203)](),this['_worksheet']['getSheetId'](),_0x51f6bf);if(_0x1d1334){_0xee6aeb=_0x2e8e95[_0x1b713b(0x21c)][_0x1b713b(0x1e5)](_0x1d1334);break;}}}}_0xee6aeb||this[_0x1b713b(0x1f4)][_0x1b713b(0x1f7)](_0x4c7951[_0x1b713b(0x1eb)]['id'],{'ranges':_0x46f6fe,'unCombine':!0x0,'config':_0xee6aeb,'isChangeDataSource':!0x1});}[_0x4f0622(0x201)](_0x3a4f74,_0x48bb1e){const _0x28bd87=_0x4f0622,_0x5d6ac2=this[_0x28bd87(0x1e6)][_0x28bd87(0x1ff)](_0x4c7951[_0x28bd87(0x20f)]),_0x26c00c=this[_0x28bd87(0x1fd)][_0x28bd87(0x203)](),_0x2d7f49=this[_0x28bd87(0x20c)][_0x28bd87(0x206)](),_0x5d4fec=_0x5d6ac2['getSparkline'](_0x26c00c,_0x2d7f49,_0x3a4f74,_0x48bb1e);if(_0x5d4fec)return this[_0x28bd87(0x1e6)]['createInstance'](_0x3a6c9c[_0x28bd87(0x1ee)],_0x26c00c,_0x2d7f49,_0x5d4fec,_0x3a4f74,_0x48bb1e);}[_0x4f0622(0x1e9)](_0x8bf2bc,_0x5762af){const _0x3897a8=_0x4f0622,_0x3cc75b=this[_0x3897a8(0x1e6)]['get'](_0x4c7951['SparklineDataSourceModel']),_0x16ddd5=this[_0x3897a8(0x1fd)]['getUnitId'](),_0x2ebddf=this['_worksheet'][_0x3897a8(0x206)](),_0x5aeaf6=_0x3cc75b[_0x3897a8(0x1fb)](_0x16ddd5,_0x2ebddf,_0x8bf2bc,_0x5762af);if(_0x5aeaf6)return this[_0x3897a8(0x1e6)][_0x3897a8(0x1ef)](_0x3a6c9c['FSparklineGroup'],_0x16ddd5,_0x2ebddf,_0x5aeaf6);}}_0x6a8571[_0x4f0622(0x1f1)][_0x4f0622(0x215)](_0x41fd62),Object[_0x4f0622(0x1fc)](_0x3a6c9c,Symbol['toStringTag'],{'value':'Module'});}));function _0x1354(){const _0x3ed2ee=['exports','193727KkkmPN','FSparkline','createInstance','1153773OOyXLs','FWorksheet','getOwnPropertyDescriptor','setSparkline','_commandService','clearSparklineCache','removeSparklineGroup','executeCommand','getAllSubSparkline','_subUnitId','removeSparkline','getSparkline','defineProperty','_workbook','Inject','get','7707480QSyPJB','getSparklineByCell','amd','getUnitId','_unitId','12gbBBSQ','getSheetId','function','39095VKTIwp','61089qdQovk','Injector','getSparklineById','_worksheet','48IEnZWI','object','SparklineDataSourceModel','UniverSheetsFacade','_col','42iQggAt','_groupId','10TOWaPA','extend','AddSheetSparklineCommand','@univerjs-pro/sheets-sparkline','getSparklinePlacement','UniverCore','@univerjs/sheets/facade','addSparkline','Tools','@univerjs/core','365931nPPlHn','_row','379000UwpRQN','unComposeSparkline','setConfig','changeDataSource','UniverProSheetsSparklineFacade','FSparklineGroup','UniverProSheetsSparkline','sparklines','deepClone','_injector','length','setValue','getSparklineGroupByCell','realDeleteValue','SetSheetSparklineCommand'];_0x1354=function(){return _0x3ed2ee;};return _0x1354();}
|