@odoo/o-spreadsheet 16.2.0-alpha.1 → 16.2.0-alpha.3
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/dist/o_spreadsheet.cjs.js +185 -133
- package/dist/o_spreadsheet.d.ts +77 -69
- package/dist/o_spreadsheet.esm.js +185 -133
- package/dist/o_spreadsheet.iife.js +185 -133
- package/dist/o_spreadsheet.iife.min.js +11 -23
- package/package.json +7 -4
package/dist/o_spreadsheet.d.ts
CHANGED
|
@@ -672,6 +672,7 @@ interface WorkbookData {
|
|
|
672
672
|
};
|
|
673
673
|
};
|
|
674
674
|
revisionId: UID;
|
|
675
|
+
uniqueFigureIds: boolean;
|
|
675
676
|
}
|
|
676
677
|
interface ExcelWorkbookData extends WorkbookData {
|
|
677
678
|
sheets: ExcelSheetData[];
|
|
@@ -1865,7 +1866,7 @@ interface FocusInputCommand {
|
|
|
1865
1866
|
/**
|
|
1866
1867
|
* Range to focus
|
|
1867
1868
|
*/
|
|
1868
|
-
rangeId:
|
|
1869
|
+
rangeId: number;
|
|
1869
1870
|
}
|
|
1870
1871
|
/**
|
|
1871
1872
|
* Add an empty range at the end of a SelectionComponent state
|
|
@@ -1884,7 +1885,7 @@ interface RemoveRangeCommand {
|
|
|
1884
1885
|
/** SelectionComponent id */
|
|
1885
1886
|
id: string;
|
|
1886
1887
|
/** The range to be removed */
|
|
1887
|
-
rangeId:
|
|
1888
|
+
rangeId: number;
|
|
1888
1889
|
}
|
|
1889
1890
|
/**
|
|
1890
1891
|
* Set a new value for a given range of a SelectionComponent state.
|
|
@@ -1894,7 +1895,7 @@ interface ChangeRangeCommand {
|
|
|
1894
1895
|
/** SelectionComponent id */
|
|
1895
1896
|
id: string;
|
|
1896
1897
|
/** The range to be changed */
|
|
1897
|
-
rangeId:
|
|
1898
|
+
rangeId: number;
|
|
1898
1899
|
/**
|
|
1899
1900
|
* Range to set in the input. Invalid ranges are also accepted.
|
|
1900
1901
|
* e.g. "B2:B3" or the invalid "A5:"
|
|
@@ -2076,7 +2077,7 @@ declare const enum CommandResult {
|
|
|
2076
2077
|
InvalidRange = 25,
|
|
2077
2078
|
InvalidZones = 26,
|
|
2078
2079
|
InvalidSheetId = 27,
|
|
2079
|
-
|
|
2080
|
+
InvalidFigureId = 28,
|
|
2080
2081
|
InputAlreadyFocused = 29,
|
|
2081
2082
|
MaximumRangesReached = 30,
|
|
2082
2083
|
InvalidChartDefinition = 31,
|
|
@@ -2132,7 +2133,8 @@ declare const enum CommandResult {
|
|
|
2132
2133
|
NonContinuousTargets = 81,
|
|
2133
2134
|
DuplicatedFigureId = 82,
|
|
2134
2135
|
InvalidSelectionStep = 83,
|
|
2135
|
-
DuplicatedChartId = 84
|
|
2136
|
+
DuplicatedChartId = 84,
|
|
2137
|
+
ChartDoesNotExist = 85
|
|
2136
2138
|
}
|
|
2137
2139
|
interface CommandHandler<T> {
|
|
2138
2140
|
allowDispatch(command: T): CommandResult | CommandResult[];
|
|
@@ -3179,24 +3181,22 @@ declare abstract class AbstractChart {
|
|
|
3179
3181
|
* This plugin manages charts
|
|
3180
3182
|
* */
|
|
3181
3183
|
interface ChartState {
|
|
3182
|
-
readonly charts:
|
|
3183
|
-
[sheetId: UID]: Record<UID, AbstractChart | undefined> | undefined;
|
|
3184
|
-
};
|
|
3184
|
+
readonly charts: Record<UID, AbstractChart | undefined>;
|
|
3185
3185
|
}
|
|
3186
3186
|
declare class ChartPlugin extends CorePlugin<ChartState> implements ChartState {
|
|
3187
3187
|
static getters: readonly ["isChartDefined", "getChartDefinition", "getChartType", "getChartIds", "getChart", "getContextCreationChart"];
|
|
3188
|
-
readonly charts:
|
|
3188
|
+
readonly charts: Record<UID, AbstractChart | undefined>;
|
|
3189
3189
|
private createChart;
|
|
3190
3190
|
private validateChartDefinition;
|
|
3191
3191
|
adaptRanges(applyChange: ApplyRangeChange): void;
|
|
3192
3192
|
allowDispatch(cmd: Command): CommandResult | CommandResult[];
|
|
3193
3193
|
handle(cmd: CoreCommand): void;
|
|
3194
|
-
getContextCreationChart(
|
|
3195
|
-
getChart(
|
|
3196
|
-
getChartType(
|
|
3197
|
-
isChartDefined(
|
|
3194
|
+
getContextCreationChart(figureId: UID): ChartCreationContext | undefined;
|
|
3195
|
+
getChart(figureId: UID): AbstractChart | undefined;
|
|
3196
|
+
getChartType(figureId: UID): ChartType;
|
|
3197
|
+
isChartDefined(figureId: UID): boolean;
|
|
3198
3198
|
getChartIds(sheetId: UID): string[];
|
|
3199
|
-
getChartDefinition(
|
|
3199
|
+
getChartDefinition(figureId: UID): ChartDefinition;
|
|
3200
3200
|
import(data: WorkbookData): void;
|
|
3201
3201
|
export(data: WorkbookData): void;
|
|
3202
3202
|
exportForExcel(data: ExcelWorkbookData): void;
|
|
@@ -3210,6 +3210,7 @@ declare class ChartPlugin extends CorePlugin<ChartState> implements ChartState {
|
|
|
3210
3210
|
*/
|
|
3211
3211
|
private addChart;
|
|
3212
3212
|
private checkChartDuplicate;
|
|
3213
|
+
private checkChartExists;
|
|
3213
3214
|
}
|
|
3214
3215
|
|
|
3215
3216
|
interface ConditionalFormatState {
|
|
@@ -3260,12 +3261,14 @@ declare class ConditionalFormatPlugin extends CorePlugin<ConditionalFormatState>
|
|
|
3260
3261
|
|
|
3261
3262
|
interface FigureState {
|
|
3262
3263
|
readonly figures: {
|
|
3263
|
-
[sheet:
|
|
3264
|
+
[sheet: string]: Record<UID, Figure | undefined> | undefined;
|
|
3264
3265
|
};
|
|
3265
3266
|
}
|
|
3266
3267
|
declare class FigurePlugin extends CorePlugin<FigureState> implements FigureState {
|
|
3267
|
-
static getters: readonly ["getFigures", "getFigure"];
|
|
3268
|
-
readonly figures:
|
|
3268
|
+
static getters: readonly ["getFigures", "getFigure", "getFigureSheetId"];
|
|
3269
|
+
readonly figures: {
|
|
3270
|
+
[sheet: string]: Record<UID, Figure | undefined> | undefined;
|
|
3271
|
+
};
|
|
3269
3272
|
allowDispatch(cmd: CoreCommand): CommandResult;
|
|
3270
3273
|
handle(cmd: CoreCommand): void;
|
|
3271
3274
|
private updateFigure;
|
|
@@ -3276,6 +3279,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
|
|
|
3276
3279
|
private checkFigureDuplicate;
|
|
3277
3280
|
getFigures(sheetId: UID): Figure[];
|
|
3278
3281
|
getFigure(sheetId: string, figureId: string): Figure | undefined;
|
|
3282
|
+
getFigureSheetId(figureId: string): UID | undefined;
|
|
3279
3283
|
import(data: WorkbookData): void;
|
|
3280
3284
|
export(data: WorkbookData): void;
|
|
3281
3285
|
exportForExcel(data: ExcelWorkbookData): void;
|
|
@@ -3396,7 +3400,7 @@ interface ImageState {
|
|
|
3396
3400
|
readonly images: Record<UID, Record<UID, Image | undefined> | undefined>;
|
|
3397
3401
|
}
|
|
3398
3402
|
declare class ImagePlugin extends CorePlugin<ImageState> implements ImageState {
|
|
3399
|
-
static getters: readonly ["getImage"];
|
|
3403
|
+
static getters: readonly ["getImage", "getImagePath", "getImageSize"];
|
|
3400
3404
|
readonly fileStore?: FileStore;
|
|
3401
3405
|
readonly images: Record<UID, Record<UID, Image | undefined> | undefined>;
|
|
3402
3406
|
/**
|
|
@@ -3404,13 +3408,15 @@ declare class ImagePlugin extends CorePlugin<ImageState> implements ImageState {
|
|
|
3404
3408
|
*/
|
|
3405
3409
|
readonly syncedImages: Set<Image["path"]>;
|
|
3406
3410
|
constructor(config: CorePluginConfig);
|
|
3407
|
-
allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.
|
|
3411
|
+
allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.InvalidFigureId;
|
|
3408
3412
|
handle(cmd: CoreCommand): void;
|
|
3409
3413
|
/**
|
|
3410
3414
|
* Delete unused images from the file store
|
|
3411
3415
|
*/
|
|
3412
3416
|
garbageCollectExternalResources(): void;
|
|
3413
|
-
getImage(
|
|
3417
|
+
getImage(figureId: UID): Image;
|
|
3418
|
+
getImagePath(figureId: UID): string;
|
|
3419
|
+
getImageSize(figureId: UID): FigureSize;
|
|
3414
3420
|
private addFigure;
|
|
3415
3421
|
import(data: WorkbookData): void;
|
|
3416
3422
|
export(data: WorkbookData): void;
|
|
@@ -3705,12 +3711,10 @@ declare class EvaluationPlugin extends UIPlugin {
|
|
|
3705
3711
|
|
|
3706
3712
|
declare class EvaluationChartPlugin extends UIPlugin {
|
|
3707
3713
|
static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
|
|
3708
|
-
readonly charts:
|
|
3709
|
-
[sheetId: UID]: Record<UID, ChartRuntime | undefined> | undefined;
|
|
3710
|
-
};
|
|
3714
|
+
readonly charts: Record<UID, ChartRuntime | undefined>;
|
|
3711
3715
|
private createRuntimeChart;
|
|
3712
3716
|
handle(cmd: Command): void;
|
|
3713
|
-
getChartRuntime(
|
|
3717
|
+
getChartRuntime(figureId: UID): ChartRuntime;
|
|
3714
3718
|
/**
|
|
3715
3719
|
* Get the background color of a chart based on the color of the first cell of the main range
|
|
3716
3720
|
* of the chart. In order of priority, it will return :
|
|
@@ -4252,7 +4256,7 @@ declare class RendererPlugin extends UIPlugin {
|
|
|
4252
4256
|
}
|
|
4253
4257
|
|
|
4254
4258
|
interface RangeInputValue {
|
|
4255
|
-
id:
|
|
4259
|
+
id: number;
|
|
4256
4260
|
xc: string;
|
|
4257
4261
|
color: string;
|
|
4258
4262
|
}
|
|
@@ -4315,7 +4319,7 @@ declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<S
|
|
|
4315
4319
|
* Return the index of a range given its id
|
|
4316
4320
|
* or `null` if the range is not found.
|
|
4317
4321
|
*/
|
|
4318
|
-
getIndex(rangeId:
|
|
4322
|
+
getIndex(rangeId: number | null): number | null;
|
|
4319
4323
|
}
|
|
4320
4324
|
|
|
4321
4325
|
/**
|
|
@@ -4889,15 +4893,14 @@ declare class SelectionInput extends Component<Props$B, SpreadsheetChildEnv> {
|
|
|
4889
4893
|
getColor(range: SelectionRange): string;
|
|
4890
4894
|
private triggerChange;
|
|
4891
4895
|
onKeydown(ev: KeyboardEvent): void;
|
|
4892
|
-
focus(rangeId:
|
|
4896
|
+
focus(rangeId: number): void;
|
|
4893
4897
|
addEmptyInput(): void;
|
|
4894
|
-
removeInput(rangeId:
|
|
4895
|
-
onInputChanged(rangeId:
|
|
4896
|
-
|
|
4898
|
+
removeInput(rangeId: number): void;
|
|
4899
|
+
onInputChanged(rangeId: number, ev: InputEvent): void;
|
|
4900
|
+
confirm(): void;
|
|
4897
4901
|
}
|
|
4898
4902
|
|
|
4899
4903
|
interface Props$A {
|
|
4900
|
-
sheetId: UID;
|
|
4901
4904
|
figureId: UID;
|
|
4902
4905
|
definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
|
|
4903
4906
|
updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
|
|
@@ -4936,9 +4939,42 @@ declare class BarConfigPanel extends LineBarPieConfigPanel {
|
|
|
4936
4939
|
onUpdateAggregated(ev: any): void;
|
|
4937
4940
|
}
|
|
4938
4941
|
|
|
4942
|
+
interface PopoverProps {
|
|
4943
|
+
/**
|
|
4944
|
+
* Rectangle around which the popover is displayed.
|
|
4945
|
+
* Coordinates are expressed as absolute DOM position.
|
|
4946
|
+
*/
|
|
4947
|
+
anchorRect: Rect;
|
|
4948
|
+
/** The popover can be positioned below the anchor Rectangle, or to the right of the rectangle */
|
|
4949
|
+
positioning: PopoverPropsPosition;
|
|
4950
|
+
maxWidth?: Pixel;
|
|
4951
|
+
maxHeight?: Pixel;
|
|
4952
|
+
/** Offset to apply to the vertical position of the popover.*/
|
|
4953
|
+
verticalOffset: number;
|
|
4954
|
+
onMouseWheel?: () => void;
|
|
4955
|
+
onPopoverMoved?: () => void;
|
|
4956
|
+
onPopoverHidden?: () => void;
|
|
4957
|
+
}
|
|
4958
|
+
declare class Popover extends Component<PopoverProps, SpreadsheetChildEnv> {
|
|
4959
|
+
static template: string;
|
|
4960
|
+
static defaultProps: {
|
|
4961
|
+
positioning: string;
|
|
4962
|
+
verticalOffset: number;
|
|
4963
|
+
onMouseWheel: () => void;
|
|
4964
|
+
onPopoverMoved: () => void;
|
|
4965
|
+
onPopoverHidden: () => void;
|
|
4966
|
+
};
|
|
4967
|
+
private popoverRef;
|
|
4968
|
+
private currentPosition;
|
|
4969
|
+
private currentDisplayValue;
|
|
4970
|
+
private spreadsheetRect;
|
|
4971
|
+
private containerRect;
|
|
4972
|
+
setup(): void;
|
|
4973
|
+
}
|
|
4974
|
+
|
|
4939
4975
|
interface ColorPickerProps {
|
|
4976
|
+
anchorRect: Rect;
|
|
4940
4977
|
maxHeight?: Pixel;
|
|
4941
|
-
dropdownDirection?: "left" | "right" | "center";
|
|
4942
4978
|
onColorPicked: (color: Color) => void;
|
|
4943
4979
|
currentColor: Color;
|
|
4944
4980
|
}
|
|
@@ -4947,9 +4983,13 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
|
|
|
4947
4983
|
static defaultProps: {
|
|
4948
4984
|
currentColor: string;
|
|
4949
4985
|
};
|
|
4986
|
+
static components: {
|
|
4987
|
+
Popover: typeof Popover;
|
|
4988
|
+
};
|
|
4950
4989
|
COLORS: string[];
|
|
4951
4990
|
private state;
|
|
4952
4991
|
get colorPickerStyle(): string;
|
|
4992
|
+
get popoverProps(): PopoverProps;
|
|
4953
4993
|
onColorClick(color: Color): void;
|
|
4954
4994
|
getCheckMarkColor(): Color;
|
|
4955
4995
|
resetColor(): void;
|
|
@@ -4968,7 +5008,6 @@ interface Props$z {
|
|
|
4968
5008
|
showColorPicker: boolean;
|
|
4969
5009
|
onColorPicked: (color: string) => void;
|
|
4970
5010
|
icon: string;
|
|
4971
|
-
dropdownDirection?: "left" | "right" | "center";
|
|
4972
5011
|
title?: string;
|
|
4973
5012
|
disabled?: boolean;
|
|
4974
5013
|
dropdownMaxHeight?: Pixel;
|
|
@@ -4979,7 +5018,11 @@ declare class ColorPickerWidget extends Component<Props$z, SpreadsheetChildEnv>
|
|
|
4979
5018
|
static components: {
|
|
4980
5019
|
ColorPicker: typeof ColorPicker;
|
|
4981
5020
|
};
|
|
5021
|
+
colorPickerButtonRef: {
|
|
5022
|
+
el: HTMLElement | null;
|
|
5023
|
+
};
|
|
4982
5024
|
get iconStyle(): string;
|
|
5025
|
+
get colorPickerAnchorRect(): Rect;
|
|
4983
5026
|
}
|
|
4984
5027
|
|
|
4985
5028
|
interface Props$y {
|
|
@@ -5002,7 +5045,6 @@ declare class LineBarPieDesignPanel extends Component<Props$y, SpreadsheetChildE
|
|
|
5002
5045
|
}
|
|
5003
5046
|
|
|
5004
5047
|
interface Props$x {
|
|
5005
|
-
sheetId: UID;
|
|
5006
5048
|
figureId: UID;
|
|
5007
5049
|
definition: GaugeChartDefinition;
|
|
5008
5050
|
updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
|
|
@@ -5059,7 +5101,6 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
5059
5101
|
}
|
|
5060
5102
|
|
|
5061
5103
|
interface Props$v {
|
|
5062
|
-
sheetId: UID;
|
|
5063
5104
|
figureId: UID;
|
|
5064
5105
|
definition: ScorecardChartDefinition;
|
|
5065
5106
|
updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
|
|
@@ -5214,7 +5255,7 @@ declare class ChartJsComponent extends Component<Props$t, SpreadsheetChildEnv> {
|
|
|
5214
5255
|
static template: string;
|
|
5215
5256
|
private canvas;
|
|
5216
5257
|
private chart?;
|
|
5217
|
-
get background():
|
|
5258
|
+
get background(): string;
|
|
5218
5259
|
get canvasStyle(): string;
|
|
5219
5260
|
get chartRuntime(): ChartJSRuntime;
|
|
5220
5261
|
setup(): void;
|
|
@@ -5256,39 +5297,6 @@ declare class ScorecardChart extends Component<Props$s, SpreadsheetChildEnv> {
|
|
|
5256
5297
|
private getWidestElement;
|
|
5257
5298
|
}
|
|
5258
5299
|
|
|
5259
|
-
interface PopoverProps {
|
|
5260
|
-
/**
|
|
5261
|
-
* Rectangle around which the popover is displayed.
|
|
5262
|
-
* Coordinates are expressed as absolute DOM position.
|
|
5263
|
-
*/
|
|
5264
|
-
anchorRect: Rect;
|
|
5265
|
-
/** The popover can be positioned below the anchor Rectangle, or to the right of the rectangle */
|
|
5266
|
-
positioning: PopoverPropsPosition;
|
|
5267
|
-
maxWidth?: Pixel;
|
|
5268
|
-
maxHeight?: Pixel;
|
|
5269
|
-
/** Offset to apply to the vertical position of the popover.*/
|
|
5270
|
-
verticalOffset: number;
|
|
5271
|
-
onMouseWheel?: () => void;
|
|
5272
|
-
onPopoverMoved?: () => void;
|
|
5273
|
-
onPopoverHidden?: () => void;
|
|
5274
|
-
}
|
|
5275
|
-
declare class Popover extends Component<PopoverProps, SpreadsheetChildEnv> {
|
|
5276
|
-
static template: string;
|
|
5277
|
-
static defaultProps: {
|
|
5278
|
-
positioning: string;
|
|
5279
|
-
verticalOffset: number;
|
|
5280
|
-
onMouseWheel: () => void;
|
|
5281
|
-
onPopoverMoved: () => void;
|
|
5282
|
-
onPopoverHidden: () => void;
|
|
5283
|
-
};
|
|
5284
|
-
private popoverRef;
|
|
5285
|
-
private currentPosition;
|
|
5286
|
-
private currentDisplayValue;
|
|
5287
|
-
private spreadsheetRect;
|
|
5288
|
-
private containerRect;
|
|
5289
|
-
setup(): void;
|
|
5290
|
-
}
|
|
5291
|
-
|
|
5292
5300
|
interface Props$r {
|
|
5293
5301
|
position: DOMCoordinates;
|
|
5294
5302
|
menuItems: MenuItem[];
|