@odoo/o-spreadsheet 14.0.1 → 15.0.0
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 +31302 -0
- package/dist/o_spreadsheet.d.ts +6604 -0
- package/dist/o_spreadsheet.esm.js +31257 -0
- package/dist/o_spreadsheet.iife.js +31304 -0
- package/dist/o_spreadsheet.iife.min.js +3071 -0
- package/package.json +57 -15
- package/.eslintrc.json +0 -20
- package/.husky/post-checkout +0 -9
- package/.husky/pre-commit +0 -39
- package/.prettierignore +0 -1
- package/astToFormula.patch +0 -0
- package/demo/data.js +0 -255
- package/demo/index.html +0 -9
- package/demo/libs/Chart.bundle.js +0 -20755
- package/demo/main.js +0 -101
- package/doc/readme.md +0 -46
- package/rollup.config.js +0 -23
- package/src/base_plugin.ts +0 -102
- package/src/components/autofill.ts +0 -146
- package/src/components/bottom_bar.ts +0 -199
- package/src/components/color_picker.ts +0 -150
- package/src/components/composer/autocomplete_dropdown.ts +0 -135
- package/src/components/composer/composer.ts +0 -487
- package/src/components/composer/content_editable_helper.ts +0 -146
- package/src/components/figures/chart.ts +0 -70
- package/src/components/figures/container.ts +0 -268
- package/src/components/figures/text_figure.ts +0 -36
- package/src/components/grid.ts +0 -635
- package/src/components/helpers/dom_helpers.ts +0 -7
- package/src/components/helpers/drag_and_drop.ts +0 -17
- package/src/components/icons.ts +0 -36
- package/src/components/index.ts +0 -1
- package/src/components/menu.ts +0 -288
- package/src/components/overlay.ts +0 -457
- package/src/components/scrollbar.ts +0 -22
- package/src/components/selection_input.ts +0 -168
- package/src/components/side_panel/cell_is_rule_editor.ts +0 -169
- package/src/components/side_panel/chart_panel.ts +0 -104
- package/src/components/side_panel/color_scale_rule_editor.ts +0 -145
- package/src/components/side_panel/conditional_formatting.ts +0 -396
- package/src/components/side_panel/side_panel.ts +0 -127
- package/src/components/side_panel/translations_terms.ts +0 -45
- package/src/components/spreadsheet.ts +0 -198
- package/src/components/top_bar.ts +0 -535
- package/src/constants.ts +0 -26
- package/src/data.ts +0 -149
- package/src/fonts.ts +0 -41
- package/src/formulas/compiler.ts +0 -258
- package/src/formulas/composer_tokenizer.ts +0 -70
- package/src/formulas/index.ts +0 -15
- package/src/formulas/normalize.ts +0 -52
- package/src/formulas/parser.ts +0 -280
- package/src/formulas/range_tokenizer.ts +0 -97
- package/src/formulas/tokenizer.ts +0 -242
- package/src/functions/arguments.ts +0 -114
- package/src/functions/dates.ts +0 -302
- package/src/functions/helpers.ts +0 -592
- package/src/functions/index.ts +0 -52
- package/src/functions/module_database.ts +0 -282
- package/src/functions/module_date.ts +0 -743
- package/src/functions/module_info.ts +0 -69
- package/src/functions/module_logical.ts +0 -208
- package/src/functions/module_lookup.ts +0 -185
- package/src/functions/module_math.ts +0 -1252
- package/src/functions/module_operators.ts +0 -291
- package/src/functions/module_statistical.ts +0 -882
- package/src/functions/module_text.ts +0 -370
- package/src/helpers/color.ts +0 -30
- package/src/helpers/coordinates.ts +0 -71
- package/src/helpers/grid_manipulation.ts +0 -68
- package/src/helpers/index.ts +0 -7
- package/src/helpers/misc.ts +0 -76
- package/src/helpers/numbers.ts +0 -117
- package/src/helpers/uuid.ts +0 -19
- package/src/helpers/zones.ts +0 -263
- package/src/history.ts +0 -186
- package/src/index.ts +0 -84
- package/src/model.ts +0 -261
- package/src/plugins/autofill.ts +0 -412
- package/src/plugins/chart.ts +0 -404
- package/src/plugins/clipboard.ts +0 -461
- package/src/plugins/conditional_format.ts +0 -445
- package/src/plugins/core.ts +0 -1502
- package/src/plugins/edition.ts +0 -157
- package/src/plugins/evaluation.ts +0 -428
- package/src/plugins/figures.ts +0 -123
- package/src/plugins/formatting.ts +0 -630
- package/src/plugins/highlight.ts +0 -187
- package/src/plugins/index.ts +0 -32
- package/src/plugins/merge.ts +0 -524
- package/src/plugins/renderer.ts +0 -571
- package/src/plugins/selection.ts +0 -562
- package/src/plugins/selection_inputs.ts +0 -326
- package/src/registries/autofill_modifiers.ts +0 -76
- package/src/registries/autofill_rules.ts +0 -98
- package/src/registries/figure_registry.ts +0 -30
- package/src/registries/index.ts +0 -7
- package/src/registries/menu_items_registry.ts +0 -110
- package/src/registries/menus/cell_menu_registry.ts +0 -79
- package/src/registries/menus/col_menu_registry.ts +0 -63
- package/src/registries/menus/index.ts +0 -6
- package/src/registries/menus/menu_items_actions.ts +0 -425
- package/src/registries/menus/row_menu_registry.ts +0 -63
- package/src/registries/menus/sheet_menu_registry.ts +0 -75
- package/src/registries/menus/topbar_menu_registry.ts +0 -204
- package/src/registries/side_panel_registry.ts +0 -26
- package/src/registries/topbar_component_registry.ts +0 -12
- package/src/registry.ts +0 -51
- package/src/translation.ts +0 -44
- package/src/types/autofill.ts +0 -48
- package/src/types/chart.ts +0 -26
- package/src/types/commands.ts +0 -716
- package/src/types/conditional_formatting.ts +0 -124
- package/src/types/env.ts +0 -13
- package/src/types/functions.ts +0 -35
- package/src/types/getters.ts +0 -103
- package/src/types/index.ts +0 -20
- package/src/types/misc.ts +0 -143
- package/src/types/rendering.ts +0 -41
- package/src/types/workbook_data.ts +0 -62
- package/tests/__mocks__/uuid.ts +0 -7
- package/tests/canvas.mock.ts +0 -34
- package/tests/components/__mocks__/content_editable_helper.ts +0 -79
- package/tests/components/__mocks__/scrollbar.ts +0 -18
- package/tests/components/__snapshots__/autocomplete_dropdown_test.ts.snap +0 -29
- package/tests/components/__snapshots__/bottom_bar_test.ts.snap +0 -75
- package/tests/components/__snapshots__/context_menu_test.ts.snap +0 -88
- package/tests/components/__snapshots__/grid_test.ts.snap +0 -60
- package/tests/components/__snapshots__/spreadsheet_test.ts.snap +0 -455
- package/tests/components/__snapshots__/top_bar_test.ts.snap +0 -705
- package/tests/components/autocomplete_dropdown_test.ts +0 -315
- package/tests/components/autofill_test.ts +0 -167
- package/tests/components/bottom_bar_test.ts +0 -262
- package/tests/components/chart_side_panel_test.ts +0 -123
- package/tests/components/composer_test.ts +0 -400
- package/tests/components/context_menu_test.ts +0 -825
- package/tests/components/grid_manipulation_test.ts +0 -163
- package/tests/components/grid_test.ts +0 -581
- package/tests/components/overlay_test.ts +0 -541
- package/tests/components/selection_input_test.ts +0 -259
- package/tests/components/side_panel_test.ts +0 -148
- package/tests/components/spreadsheet_test.ts +0 -194
- package/tests/components/top_bar_test.ts +0 -427
- package/tests/data_test.ts +0 -175
- package/tests/dom_helper.ts +0 -42
- package/tests/formulas/__snapshots__/compiler_test.ts.snap +0 -302
- package/tests/formulas/compiler_test.ts +0 -266
- package/tests/formulas/composer_tokenizer_test.ts +0 -137
- package/tests/formulas/expressions_test.ts +0 -57
- package/tests/formulas/formulas_test.ts +0 -80
- package/tests/formulas/normalize_test.ts +0 -82
- package/tests/formulas/parser_test.ts +0 -224
- package/tests/formulas/range_tokenizer_test.ts +0 -187
- package/tests/formulas/tokenizer_test.ts +0 -164
- package/tests/functions/arguments_test.ts +0 -141
- package/tests/functions/dates_test.ts +0 -1081
- package/tests/functions/functions_test.ts +0 -53
- package/tests/functions/helper_test.ts +0 -98
- package/tests/functions/module_database_test.ts +0 -311
- package/tests/functions/module_date_test.ts +0 -941
- package/tests/functions/module_info_test.ts +0 -139
- package/tests/functions/module_logical_test.ts +0 -369
- package/tests/functions/module_lookup_test.ts +0 -541
- package/tests/functions/module_math_test.ts +0 -2482
- package/tests/functions/module_operators_test.ts +0 -955
- package/tests/functions/module_statistical_test.ts +0 -2014
- package/tests/functions/module_text_test.ts +0 -667
- package/tests/helpers/coordinates_test.ts +0 -25
- package/tests/helpers/misc_test.ts +0 -95
- package/tests/helpers/numbers_test.ts +0 -196
- package/tests/helpers/zones_test.ts +0 -97
- package/tests/helpers.ts +0 -384
- package/tests/menu_items_registry_test.ts +0 -540
- package/tests/model/plugins/__snapshots__/chart_test.ts.snap +0 -90
- package/tests/model/plugins/chart_test.ts +0 -562
- package/tests/model_test.ts +0 -82
- package/tests/plugins/__snapshots__/conditional_formatting_test.ts.snap +0 -131
- package/tests/plugins/__snapshots__/renderer_test.ts.snap +0 -371
- package/tests/plugins/autofill_test.ts +0 -457
- package/tests/plugins/borders_test.ts +0 -295
- package/tests/plugins/clipboard_test.ts +0 -1180
- package/tests/plugins/conditional_formatting_test.ts +0 -1253
- package/tests/plugins/core_test.ts +0 -614
- package/tests/plugins/edition_test.ts +0 -100
- package/tests/plugins/evaluation_async_test.ts +0 -332
- package/tests/plugins/evaluation_dates_test.ts +0 -79
- package/tests/plugins/evaluation_test.ts +0 -901
- package/tests/plugins/figures_test.ts +0 -327
- package/tests/plugins/formatting_test.ts +0 -391
- package/tests/plugins/grid_manipulation_test.ts +0 -1366
- package/tests/plugins/highlight_test.ts +0 -413
- package/tests/plugins/history_test.ts +0 -142
- package/tests/plugins/import_export_test.ts +0 -276
- package/tests/plugins/merges_test.ts +0 -490
- package/tests/plugins/navigation_test.ts +0 -181
- package/tests/plugins/plugins/evaluation_test.ts +0 -111
- package/tests/plugins/renderer_test.ts +0 -598
- package/tests/plugins/resizing_test.ts +0 -152
- package/tests/plugins/selection_input_test.ts +0 -409
- package/tests/plugins/selection_test.ts +0 -442
- package/tests/plugins/sheets_test.ts +0 -643
- package/tests/plugins/style_test.ts +0 -90
- package/tsconfig.json +0 -22
package/src/types/commands.ts
DELETED
|
@@ -1,716 +0,0 @@
|
|
|
1
|
-
import { BorderCommand, ConditionalFormat, CreateChartDefinition, Style, Zone } from "./index";
|
|
2
|
-
import { Cell } from "./misc";
|
|
3
|
-
import { Figure } from "./workbook_data";
|
|
4
|
-
|
|
5
|
-
// -----------------------------------------------------------------------------
|
|
6
|
-
// Grid commands
|
|
7
|
-
// -----------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* There are two kinds of commands: Primitive and Local
|
|
11
|
-
*
|
|
12
|
-
* - Primitive commands are commands that
|
|
13
|
-
* 1. manipulate the imported/exported spreadsheet state
|
|
14
|
-
* 2. are "low level" => cannot be converted into lower level commands
|
|
15
|
-
* 3. make sense when sent by the network to another user
|
|
16
|
-
*
|
|
17
|
-
* - Local commands: every other command.
|
|
18
|
-
* 1. manipulate the local state (such as the selection, or the clipboard)
|
|
19
|
-
* 2. can often be converted into primitive commands
|
|
20
|
-
* 3. do not make sense to send by network to another user.
|
|
21
|
-
*
|
|
22
|
-
* For example, "RESIZE_COLUMNS" is a primitive command. "AUTORESIZE_COLUMNS"
|
|
23
|
-
* can be (locally) converted into a "RESIZE_COLUMNS", and therefore, is not a
|
|
24
|
-
* primitive command.
|
|
25
|
-
*
|
|
26
|
-
* Primitive commands should be "device agnostic". This means that they should
|
|
27
|
-
* contain all the information necessary to perform their job. Local commands
|
|
28
|
-
* can use inferred information from the local internal state, such as the
|
|
29
|
-
* active sheet.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
interface BaseCommand {
|
|
33
|
-
interactive?: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Primitive Commands
|
|
37
|
-
// ------------------------------------------------
|
|
38
|
-
export interface UpdateCellCommand extends BaseCommand {
|
|
39
|
-
type: "UPDATE_CELL";
|
|
40
|
-
sheet: string;
|
|
41
|
-
col: number;
|
|
42
|
-
row: number;
|
|
43
|
-
content?: string;
|
|
44
|
-
style?: number;
|
|
45
|
-
border?: number;
|
|
46
|
-
format?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface ResizeColumnsCommand extends BaseCommand {
|
|
50
|
-
type: "RESIZE_COLUMNS";
|
|
51
|
-
sheet: string;
|
|
52
|
-
cols: number[];
|
|
53
|
-
size: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface ResizeRowsCommand extends BaseCommand {
|
|
57
|
-
type: "RESIZE_ROWS";
|
|
58
|
-
sheet: string;
|
|
59
|
-
rows: number[];
|
|
60
|
-
size: number;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Todo: add a string "id" field, and change the code to use internally a uuid.
|
|
65
|
-
*/
|
|
66
|
-
export interface CreateSheetCommand extends BaseCommand {
|
|
67
|
-
type: "CREATE_SHEET";
|
|
68
|
-
id: string;
|
|
69
|
-
name?: string;
|
|
70
|
-
cols?: number;
|
|
71
|
-
rows?: number;
|
|
72
|
-
activate?: boolean;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface MoveSheetCommand extends BaseCommand {
|
|
76
|
-
type: "MOVE_SHEET";
|
|
77
|
-
sheet: string;
|
|
78
|
-
direction: "left" | "right";
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface RenameSheetCommand extends BaseCommand {
|
|
82
|
-
type: "RENAME_SHEET";
|
|
83
|
-
sheet: string;
|
|
84
|
-
name?: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface DuplicateSheetCommand extends BaseCommand {
|
|
88
|
-
type: "DUPLICATE_SHEET";
|
|
89
|
-
sheet: string;
|
|
90
|
-
id: string;
|
|
91
|
-
name: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface DeleteSheetCommand extends BaseCommand {
|
|
95
|
-
type: "DELETE_SHEET";
|
|
96
|
-
sheet: string;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface DeleteSheetConfirmationCommand extends BaseCommand {
|
|
100
|
-
type: "DELETE_SHEET_CONFIRMATION";
|
|
101
|
-
sheet: string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface AddMergeCommand extends BaseCommand {
|
|
105
|
-
type: "ADD_MERGE";
|
|
106
|
-
sheet: string;
|
|
107
|
-
zone: Zone;
|
|
108
|
-
force?: boolean;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface RemoveMergeCommand extends BaseCommand {
|
|
112
|
-
type: "REMOVE_MERGE";
|
|
113
|
-
sheet: string;
|
|
114
|
-
zone: Zone;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface AddFormattingCommand extends BaseCommand {
|
|
118
|
-
type: "SET_FORMATTING";
|
|
119
|
-
sheet: string;
|
|
120
|
-
target: Zone[];
|
|
121
|
-
style?: Style;
|
|
122
|
-
border?: BorderCommand;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface ClearFormattingCommand extends BaseCommand {
|
|
126
|
-
type: "CLEAR_FORMATTING";
|
|
127
|
-
sheet: string;
|
|
128
|
-
target: Zone[];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface SetFormatterCommand extends BaseCommand {
|
|
132
|
-
type: "SET_FORMATTER";
|
|
133
|
-
sheet: string;
|
|
134
|
-
target: Zone[];
|
|
135
|
-
formatter: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface SetDecimalCommand extends BaseCommand {
|
|
139
|
-
type: "SET_DECIMAL";
|
|
140
|
-
sheet: string;
|
|
141
|
-
target: Zone[];
|
|
142
|
-
step: number;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* todo: add sheet argument...
|
|
147
|
-
* todo: use id instead of a list. this is not safe to serialize and send to
|
|
148
|
-
* another user
|
|
149
|
-
*/
|
|
150
|
-
export interface AddConditionalFormatCommand extends BaseCommand {
|
|
151
|
-
type: "ADD_CONDITIONAL_FORMAT";
|
|
152
|
-
cf: ConditionalFormat;
|
|
153
|
-
sheet: string;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export interface RemoveConditionalFormatCommand extends BaseCommand {
|
|
157
|
-
type: "REMOVE_CONDITIONAL_FORMAT";
|
|
158
|
-
id: string;
|
|
159
|
-
sheet: string;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface RemoveColumnsCommand extends BaseCommand {
|
|
163
|
-
type: "REMOVE_COLUMNS";
|
|
164
|
-
columns: number[];
|
|
165
|
-
sheet: string; //Not used for now
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface RemoveRowsCommand extends BaseCommand {
|
|
169
|
-
type: "REMOVE_ROWS";
|
|
170
|
-
rows: number[];
|
|
171
|
-
sheet: string; //Not used for now
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export interface AddColumnsCommand extends BaseCommand {
|
|
175
|
-
type: "ADD_COLUMNS";
|
|
176
|
-
column: number;
|
|
177
|
-
sheet: string; //Not used for now
|
|
178
|
-
quantity: number;
|
|
179
|
-
position: "before" | "after";
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface AddRowsCommand extends BaseCommand {
|
|
183
|
-
type: "ADD_ROWS";
|
|
184
|
-
row: number;
|
|
185
|
-
sheet: string; //Not used for now
|
|
186
|
-
quantity: number;
|
|
187
|
-
position: "before" | "after";
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Local Commands
|
|
191
|
-
// ------------------------------------------------
|
|
192
|
-
export interface CopyCommand extends BaseCommand {
|
|
193
|
-
type: "COPY";
|
|
194
|
-
target: Zone[];
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export interface CutCommand extends BaseCommand {
|
|
198
|
-
type: "CUT";
|
|
199
|
-
target: Zone[];
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export interface PasteCommand extends BaseCommand {
|
|
203
|
-
type: "PASTE";
|
|
204
|
-
target: Zone[];
|
|
205
|
-
onlyValue?: boolean;
|
|
206
|
-
onlyFormat?: boolean;
|
|
207
|
-
force?: boolean;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export interface PasteCellCommand extends BaseCommand {
|
|
211
|
-
type: "PASTE_CELL";
|
|
212
|
-
origin: Cell | null;
|
|
213
|
-
originCol: number;
|
|
214
|
-
originRow: number;
|
|
215
|
-
col: number;
|
|
216
|
-
row: number;
|
|
217
|
-
sheet: string;
|
|
218
|
-
cut?: boolean;
|
|
219
|
-
onlyValue: boolean;
|
|
220
|
-
onlyFormat: boolean;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export interface AutoFillCellCommand extends BaseCommand {
|
|
224
|
-
type: "AUTOFILL_CELL";
|
|
225
|
-
originCol: number;
|
|
226
|
-
originRow: number;
|
|
227
|
-
col: number;
|
|
228
|
-
row: number;
|
|
229
|
-
content?: string;
|
|
230
|
-
style?: number;
|
|
231
|
-
border?: number;
|
|
232
|
-
format?: string;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export interface ActivatePaintFormatCommand extends BaseCommand {
|
|
236
|
-
type: "ACTIVATE_PAINT_FORMAT";
|
|
237
|
-
target: Zone[];
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export interface PasteFromOSClipboardCommand extends BaseCommand {
|
|
241
|
-
type: "PASTE_FROM_OS_CLIPBOARD";
|
|
242
|
-
target: Zone[];
|
|
243
|
-
text: string;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export interface AutoresizeColumnsCommand extends BaseCommand {
|
|
247
|
-
type: "AUTORESIZE_COLUMNS";
|
|
248
|
-
sheet: string;
|
|
249
|
-
cols: number[];
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export interface AutoresizeRowsCommand extends BaseCommand {
|
|
253
|
-
type: "AUTORESIZE_ROWS";
|
|
254
|
-
sheet: string;
|
|
255
|
-
rows: number[];
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export interface MovePositionCommand extends BaseCommand {
|
|
259
|
-
type: "MOVE_POSITION";
|
|
260
|
-
deltaX: number;
|
|
261
|
-
deltaY: number;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export interface ActivateSheetCommand extends BaseCommand {
|
|
265
|
-
type: "ACTIVATE_SHEET";
|
|
266
|
-
from: string;
|
|
267
|
-
to: string;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export interface SelectCellCommand extends BaseCommand {
|
|
271
|
-
type: "SELECT_CELL";
|
|
272
|
-
col: number;
|
|
273
|
-
row: number;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
export interface SetSelectionCommand extends BaseCommand {
|
|
277
|
-
type: "SET_SELECTION";
|
|
278
|
-
anchor: [number, number];
|
|
279
|
-
zones: Zone[];
|
|
280
|
-
strict?: boolean;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Set the selection mode to `selecting`.
|
|
285
|
-
* The user is currently selecting some cells.
|
|
286
|
-
*/
|
|
287
|
-
export interface StartSelectionCommand extends BaseCommand {
|
|
288
|
-
type: "START_SELECTION";
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Set the selection mode to `readyToExpand`.
|
|
293
|
-
* The user is ready to expand the selected zones with a new
|
|
294
|
-
* selection (i.e. add an other zone the to currently selected zones).
|
|
295
|
-
* In other words, the next selection will be added to the
|
|
296
|
-
* current selection if this mode is active.
|
|
297
|
-
*/
|
|
298
|
-
export interface PrepareExpansionCommand extends BaseCommand {
|
|
299
|
-
type: "PREPARE_SELECTION_EXPANSION";
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Set the selection mode to `expanding`.
|
|
304
|
-
* This mode means that the user is currently selecting
|
|
305
|
-
* a new zone which will be added to the current selection.
|
|
306
|
-
*/
|
|
307
|
-
export interface StartExpansionCommand extends BaseCommand {
|
|
308
|
-
type: "START_SELECTION_EXPANSION";
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Set the selection mode to `idle`.
|
|
313
|
-
*/
|
|
314
|
-
export interface StopSelectionCommand extends BaseCommand {
|
|
315
|
-
type: "STOP_SELECTION";
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* When selection highlight is enabled, every selection will
|
|
320
|
-
* be highlighted. Each selected zone have a different color.
|
|
321
|
-
*/
|
|
322
|
-
export interface HighlightSelectionCommand extends BaseCommand {
|
|
323
|
-
type: "HIGHLIGHT_SELECTION";
|
|
324
|
-
enabled: boolean;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Add some highlights as pending highlights.
|
|
329
|
-
* When highlight selection is enabled, pending highlights
|
|
330
|
-
* are removed at every new selection.
|
|
331
|
-
*/
|
|
332
|
-
export interface AddPendingHighlightCommand extends BaseCommand {
|
|
333
|
-
type: "ADD_PENDING_HIGHLIGHTS";
|
|
334
|
-
ranges: { [range: string]: string };
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Removes all pending highlights.
|
|
339
|
-
*/
|
|
340
|
-
export interface ResetPendingHighlightCommand extends BaseCommand {
|
|
341
|
-
type: "RESET_PENDING_HIGHLIGHT";
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Set a color to be used for the next selection to highlight.
|
|
346
|
-
* The color is only used when selection highlight is enabled.
|
|
347
|
-
*/
|
|
348
|
-
export interface SetColorCommand extends BaseCommand {
|
|
349
|
-
type: "SET_HIGHLIGHT_COLOR";
|
|
350
|
-
color: string;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
export interface SelectColumnCommand extends BaseCommand {
|
|
354
|
-
type: "SELECT_COLUMN";
|
|
355
|
-
index: number;
|
|
356
|
-
createRange?: boolean;
|
|
357
|
-
updateRange?: boolean;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export interface SelectRowCommand extends BaseCommand {
|
|
361
|
-
type: "SELECT_ROW";
|
|
362
|
-
index: number;
|
|
363
|
-
createRange?: boolean;
|
|
364
|
-
updateRange?: boolean;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
export interface SelectAllCommand extends BaseCommand {
|
|
368
|
-
type: "SELECT_ALL";
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export interface AlterSelectionCommand extends BaseCommand {
|
|
372
|
-
type: "ALTER_SELECTION";
|
|
373
|
-
delta?: [number, number];
|
|
374
|
-
cell?: [number, number];
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export interface EvaluateCellsCommand extends BaseCommand {
|
|
378
|
-
type: "EVALUATE_CELLS";
|
|
379
|
-
onlyWaiting?: boolean;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
export interface AddHighlightsCommand extends BaseCommand {
|
|
383
|
-
type: "ADD_HIGHLIGHTS";
|
|
384
|
-
ranges: { [range: string]: string };
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Remove the given highlights.
|
|
389
|
-
*/
|
|
390
|
-
export interface RemoveHighlightsCommand extends BaseCommand {
|
|
391
|
-
type: "REMOVE_HIGHLIGHTS";
|
|
392
|
-
/**
|
|
393
|
-
* Ranges to remove. Keys are ranges in XC format and values
|
|
394
|
-
* are the associated colors.
|
|
395
|
-
* e.g. { B4: "#e2e2e2" }
|
|
396
|
-
*/
|
|
397
|
-
ranges: { [range: string]: string };
|
|
398
|
-
}
|
|
399
|
-
export interface RemoveAllHighlightsCommand extends BaseCommand {
|
|
400
|
-
type: "REMOVE_ALL_HIGHLIGHTS";
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
export interface StartComposerSelectionCommand extends BaseCommand {
|
|
404
|
-
type: "START_COMPOSER_SELECTION";
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
export interface StopComposerSelectionCommand extends BaseCommand {
|
|
408
|
-
type: "STOP_COMPOSER_SELECTION";
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
export interface StartEditionCommand extends BaseCommand {
|
|
412
|
-
type: "START_EDITION";
|
|
413
|
-
text?: string;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
export interface StopEditionCommand extends BaseCommand {
|
|
417
|
-
type: "STOP_EDITION";
|
|
418
|
-
cancel?: boolean;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
export interface SetCurrentContentCommand extends BaseCommand {
|
|
422
|
-
type: "SET_CURRENT_CONTENT";
|
|
423
|
-
content: string;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
export interface SetValueCommand extends BaseCommand {
|
|
427
|
-
type: "SET_VALUE";
|
|
428
|
-
xc: string;
|
|
429
|
-
text: string;
|
|
430
|
-
sheetId?: string;
|
|
431
|
-
}
|
|
432
|
-
export interface ShowFormulaCommand extends BaseCommand {
|
|
433
|
-
type: "SET_FORMULA_VISIBILITY";
|
|
434
|
-
show: boolean;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export interface DeleteContentCommand extends BaseCommand {
|
|
438
|
-
type: "DELETE_CONTENT";
|
|
439
|
-
sheet: string;
|
|
440
|
-
target: Zone[];
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
export interface ClearCellCommand extends BaseCommand {
|
|
444
|
-
type: "CLEAR_CELL";
|
|
445
|
-
sheet: string;
|
|
446
|
-
col: number;
|
|
447
|
-
row: number;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
export interface UndoCommand extends BaseCommand {
|
|
451
|
-
type: "UNDO";
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
export interface RedoCommand extends BaseCommand {
|
|
455
|
-
type: "REDO";
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
export interface StartCommand extends BaseCommand {
|
|
459
|
-
type: "START";
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
export interface AutofillCommand extends BaseCommand {
|
|
463
|
-
type: "AUTOFILL";
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
export interface AutofillSelectCommand extends BaseCommand {
|
|
467
|
-
type: "AUTOFILL_SELECT";
|
|
468
|
-
col: number;
|
|
469
|
-
row: number;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
export interface AutofillAutoCommand extends BaseCommand {
|
|
473
|
-
type: "AUTOFILL_AUTO";
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Create a new state for a SelectionInput component
|
|
478
|
-
*/
|
|
479
|
-
export interface NewInputCommand extends BaseCommand {
|
|
480
|
-
type: "ENABLE_NEW_SELECTION_INPUT";
|
|
481
|
-
/**
|
|
482
|
-
* Identifier to use to reference this state.
|
|
483
|
-
*/
|
|
484
|
-
id: string;
|
|
485
|
-
/**
|
|
486
|
-
* Initial ranges for the state.
|
|
487
|
-
* e.g. ["B4", "A1:A3"]
|
|
488
|
-
*/
|
|
489
|
-
initialRanges?: string[];
|
|
490
|
-
/**
|
|
491
|
-
* Maximum number of ranges allowed
|
|
492
|
-
*/
|
|
493
|
-
maximumRanges?: number;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Delete an identified SelectionInput state.
|
|
498
|
-
*/
|
|
499
|
-
export interface RemoveInputCommand extends BaseCommand {
|
|
500
|
-
type: "DISABLE_SELECTION_INPUT";
|
|
501
|
-
/** SelectionComponent id */
|
|
502
|
-
id: string;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Set the focus on a given range of a SelectionComponent state.
|
|
507
|
-
*/
|
|
508
|
-
export interface FocusInputCommand extends BaseCommand {
|
|
509
|
-
type: "FOCUS_RANGE";
|
|
510
|
-
/** SelectionComponent id */
|
|
511
|
-
id: string;
|
|
512
|
-
/**
|
|
513
|
-
* Range to focus. If `null` is given, removes the focus entirely.
|
|
514
|
-
*/
|
|
515
|
-
rangeId: string | null;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Add an empty range at the end of a SelectionComponent state
|
|
520
|
-
* and focus it.
|
|
521
|
-
*/
|
|
522
|
-
export interface AddEmptyRangeCommand extends BaseCommand {
|
|
523
|
-
type: "ADD_EMPTY_RANGE";
|
|
524
|
-
/** SelectionComponent id */
|
|
525
|
-
id: string;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Remove a given range in a SelectionComponent state
|
|
530
|
-
*/
|
|
531
|
-
export interface RemoveRangeCommand extends BaseCommand {
|
|
532
|
-
type: "REMOVE_RANGE";
|
|
533
|
-
/** SelectionComponent id */
|
|
534
|
-
id: string;
|
|
535
|
-
/** The range to be removed */
|
|
536
|
-
rangeId: string;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Set a new value for a given range of a SelectionComponent state.
|
|
541
|
-
*/
|
|
542
|
-
export interface ChangeRangeCommand extends BaseCommand {
|
|
543
|
-
type: "CHANGE_RANGE";
|
|
544
|
-
/** SelectionComponent id */
|
|
545
|
-
id: string;
|
|
546
|
-
/** The range to be changed */
|
|
547
|
-
rangeId: string;
|
|
548
|
-
/**
|
|
549
|
-
* Range to set in the input. Invalid ranges are also accepted.
|
|
550
|
-
* e.g. "B2:B3" or the invalid "A5:"
|
|
551
|
-
*/
|
|
552
|
-
value: string;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
export interface CreateFigureCommand extends BaseCommand {
|
|
556
|
-
type: "CREATE_FIGURE";
|
|
557
|
-
figure: Figure<any>;
|
|
558
|
-
sheet: string; // id of the target sheet
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export interface SelectFigureCommand extends BaseCommand {
|
|
562
|
-
type: "SELECT_FIGURE";
|
|
563
|
-
id: string;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
export interface UpdateFigureCommand extends BaseCommand, Partial<Figure<any>> {
|
|
567
|
-
type: "UPDATE_FIGURE";
|
|
568
|
-
id: string;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
export interface DeleteFigureCommand extends BaseCommand {
|
|
572
|
-
type: "DELETE_FIGURE";
|
|
573
|
-
id: string;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
export interface CreateChartCommand extends BaseCommand {
|
|
577
|
-
type: "CREATE_CHART";
|
|
578
|
-
id: string;
|
|
579
|
-
sheetId: string;
|
|
580
|
-
definition: CreateChartDefinition;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
export interface UpdateChartCommand extends BaseCommand {
|
|
584
|
-
type: "UPDATE_CHART";
|
|
585
|
-
id: string;
|
|
586
|
-
definition: CreateChartDefinition;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
export type Command =
|
|
590
|
-
| NewInputCommand
|
|
591
|
-
| RemoveInputCommand
|
|
592
|
-
| FocusInputCommand
|
|
593
|
-
| AddEmptyRangeCommand
|
|
594
|
-
| RemoveRangeCommand
|
|
595
|
-
| ChangeRangeCommand
|
|
596
|
-
| UpdateCellCommand
|
|
597
|
-
| CopyCommand
|
|
598
|
-
| CutCommand
|
|
599
|
-
| PasteCommand
|
|
600
|
-
| PasteCellCommand
|
|
601
|
-
| AutoFillCellCommand
|
|
602
|
-
| PasteFromOSClipboardCommand
|
|
603
|
-
| ActivatePaintFormatCommand
|
|
604
|
-
| ResizeRowsCommand
|
|
605
|
-
| ResizeColumnsCommand
|
|
606
|
-
| AutoresizeColumnsCommand
|
|
607
|
-
| AutoresizeRowsCommand
|
|
608
|
-
| MovePositionCommand
|
|
609
|
-
| CreateSheetCommand
|
|
610
|
-
| MoveSheetCommand
|
|
611
|
-
| RenameSheetCommand
|
|
612
|
-
| DuplicateSheetCommand
|
|
613
|
-
| DeleteSheetCommand
|
|
614
|
-
| DeleteSheetConfirmationCommand
|
|
615
|
-
| ActivateSheetCommand
|
|
616
|
-
| StartSelectionCommand
|
|
617
|
-
| StartExpansionCommand
|
|
618
|
-
| PrepareExpansionCommand
|
|
619
|
-
| StopSelectionCommand
|
|
620
|
-
| SelectCellCommand
|
|
621
|
-
| SetSelectionCommand
|
|
622
|
-
| SelectColumnCommand
|
|
623
|
-
| SelectRowCommand
|
|
624
|
-
| SelectAllCommand
|
|
625
|
-
| AlterSelectionCommand
|
|
626
|
-
| DeleteContentCommand
|
|
627
|
-
| EvaluateCellsCommand
|
|
628
|
-
| AddConditionalFormatCommand
|
|
629
|
-
| RemoveConditionalFormatCommand
|
|
630
|
-
| AddHighlightsCommand
|
|
631
|
-
| RemoveHighlightsCommand
|
|
632
|
-
| RemoveAllHighlightsCommand
|
|
633
|
-
| HighlightSelectionCommand
|
|
634
|
-
| AddPendingHighlightCommand
|
|
635
|
-
| ResetPendingHighlightCommand
|
|
636
|
-
| SetColorCommand
|
|
637
|
-
| StartComposerSelectionCommand
|
|
638
|
-
| StopComposerSelectionCommand
|
|
639
|
-
| StartEditionCommand
|
|
640
|
-
| StopEditionCommand
|
|
641
|
-
| AddMergeCommand
|
|
642
|
-
| RemoveMergeCommand
|
|
643
|
-
| SetCurrentContentCommand
|
|
644
|
-
| SetValueCommand
|
|
645
|
-
| AddFormattingCommand
|
|
646
|
-
| ClearFormattingCommand
|
|
647
|
-
| SetFormatterCommand
|
|
648
|
-
| SetDecimalCommand
|
|
649
|
-
| ClearCellCommand
|
|
650
|
-
| UndoCommand
|
|
651
|
-
| RedoCommand
|
|
652
|
-
| StartCommand
|
|
653
|
-
| RemoveRowsCommand
|
|
654
|
-
| RemoveColumnsCommand
|
|
655
|
-
| AddRowsCommand
|
|
656
|
-
| CreateChartCommand
|
|
657
|
-
| UpdateChartCommand
|
|
658
|
-
| AddColumnsCommand
|
|
659
|
-
| AutofillCommand
|
|
660
|
-
| AutofillSelectCommand
|
|
661
|
-
| ShowFormulaCommand
|
|
662
|
-
| AutofillAutoCommand
|
|
663
|
-
| CreateFigureCommand
|
|
664
|
-
| SelectFigureCommand
|
|
665
|
-
| UpdateFigureCommand
|
|
666
|
-
| DeleteFigureCommand;
|
|
667
|
-
|
|
668
|
-
export interface CommandSuccess {
|
|
669
|
-
status: "SUCCESS";
|
|
670
|
-
}
|
|
671
|
-
export interface CommandCancelled {
|
|
672
|
-
status: "CANCELLED";
|
|
673
|
-
reason: CancelledReason;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
export const enum CancelledReason {
|
|
677
|
-
Unknown,
|
|
678
|
-
WillRemoveExistingMerge,
|
|
679
|
-
MergeIsDestructive,
|
|
680
|
-
EmptyUndoStack,
|
|
681
|
-
EmptyRedoStack,
|
|
682
|
-
NotEnoughColumns,
|
|
683
|
-
NotEnoughRows,
|
|
684
|
-
NotEnoughSheets,
|
|
685
|
-
WrongSheetName,
|
|
686
|
-
WrongSheetMove,
|
|
687
|
-
SelectionOutOfBound,
|
|
688
|
-
WrongPasteSelection,
|
|
689
|
-
EmptyClipboard,
|
|
690
|
-
InvalidRange,
|
|
691
|
-
InputAlreadyFocused,
|
|
692
|
-
MaximumRangesReached,
|
|
693
|
-
InvalidChartDefinition,
|
|
694
|
-
InvalidAutofillSelection,
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
export type CommandResult = CommandSuccess | CommandCancelled;
|
|
698
|
-
|
|
699
|
-
export interface CommandHandler {
|
|
700
|
-
allowDispatch(command: Command): CommandResult;
|
|
701
|
-
beforeHandle(command: Command): void;
|
|
702
|
-
handle(command: Command): void;
|
|
703
|
-
finalize(command: Command): void;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
export interface CommandDispatcher {
|
|
707
|
-
dispatch<T extends CommandTypes, C extends Extract<Command, { type: T }>>(
|
|
708
|
-
type: {} extends Omit<C, "type"> ? T : never
|
|
709
|
-
): CommandResult;
|
|
710
|
-
dispatch<T extends CommandTypes, C extends Extract<Command, { type: T }>>(
|
|
711
|
-
type: T,
|
|
712
|
-
r: Omit<C, "type">
|
|
713
|
-
): CommandResult;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
export type CommandTypes = Command["type"];
|