@odoo/o-spreadsheet 14.0.1 → 14.0.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 +17880 -0
- package/dist/o-spreadsheet.d.ts +4119 -0
- package/dist/o-spreadsheet.esm.js +17845 -0
- package/dist/o-spreadsheet.iife.js +17882 -0
- package/dist/o-spreadsheet.iife.min.js +1446 -0
- package/package.json +32 -9
- package/readme.md +10 -0
- 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
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { Model } from "../../src/model";
|
|
2
|
-
import { CommandResult } from "../../src/types/commands";
|
|
3
|
-
import { simulateClick, triggerMouseEvent } from "../dom_helper";
|
|
4
|
-
import { getActiveXc, GridParent, makeTestFixture, nextTick } from "../helpers";
|
|
5
|
-
|
|
6
|
-
const COLUMN_D = { x: 340, y: 10 };
|
|
7
|
-
const ROW_5 = { x: 30, y: 100 };
|
|
8
|
-
const OUTSIDE_CM = { x: 50, y: 50 };
|
|
9
|
-
|
|
10
|
-
let fixture: HTMLElement;
|
|
11
|
-
let model: Model;
|
|
12
|
-
let parent: GridParent;
|
|
13
|
-
|
|
14
|
-
beforeEach(async () => {
|
|
15
|
-
fixture = makeTestFixture();
|
|
16
|
-
model = new Model();
|
|
17
|
-
parent = new GridParent(model);
|
|
18
|
-
await parent.mount(fixture);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
fixture.remove();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
function simulateContextMenu(selector: string, coord: { x: number; y: number }) {
|
|
26
|
-
const target = document.querySelector(selector)! as HTMLElement;
|
|
27
|
-
triggerMouseEvent(selector, "mousedown", coord.x, coord.y, { button: 1, bubbles: true });
|
|
28
|
-
target.focus();
|
|
29
|
-
triggerMouseEvent(selector, "mouseup", coord.x, coord.y, { button: 1, bubbles: true });
|
|
30
|
-
triggerMouseEvent(selector, "contextmenu", coord.x, coord.y, { button: 1, bubbles: true });
|
|
31
|
-
}
|
|
32
|
-
describe("Context Menu add/remove row/col", () => {
|
|
33
|
-
test("can open contextmenu for columns then click elsewhere to close it", async () => {
|
|
34
|
-
expect(fixture.querySelector(".o-menu")).toBeFalsy();
|
|
35
|
-
simulateContextMenu(".o-col-resizer", COLUMN_D);
|
|
36
|
-
expect(getActiveXc(model)).toBe("D1");
|
|
37
|
-
await nextTick();
|
|
38
|
-
expect(fixture.querySelector(".o-menu")).toBeTruthy();
|
|
39
|
-
await simulateClick("canvas", OUTSIDE_CM.x, OUTSIDE_CM.y);
|
|
40
|
-
expect(fixture.querySelector(".o-menu")).toBeFalsy();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("can open contextmenu for rows then click elsewhere to close it", async () => {
|
|
44
|
-
expect(fixture.querySelector(".o-menu")).toBeFalsy();
|
|
45
|
-
simulateContextMenu(".o-row-resizer", ROW_5);
|
|
46
|
-
expect(getActiveXc(model)).toBe("A5");
|
|
47
|
-
await nextTick();
|
|
48
|
-
expect(fixture.querySelector(".o-menu")).toBeTruthy();
|
|
49
|
-
await simulateClick("canvas", OUTSIDE_CM.x, OUTSIDE_CM.y);
|
|
50
|
-
expect(fixture.querySelector(".o-menu")).toBeFalsy();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("can clear cols with contextmenu", async () => {
|
|
54
|
-
simulateContextMenu(".o-col-resizer", COLUMN_D);
|
|
55
|
-
await nextTick();
|
|
56
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
57
|
-
simulateClick(".o-menu div[data-name='clear_column']");
|
|
58
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("DELETE_CONTENT", {
|
|
59
|
-
target: [
|
|
60
|
-
{
|
|
61
|
-
top: 0,
|
|
62
|
-
bottom: model["workbook"].activeSheet.rows.length - 1,
|
|
63
|
-
left: 3,
|
|
64
|
-
right: 3,
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
sheet: model["workbook"].activeSheet.id,
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test("can clear row with contextmenu", async () => {
|
|
72
|
-
simulateContextMenu(".o-row-resizer", ROW_5);
|
|
73
|
-
await nextTick();
|
|
74
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
75
|
-
simulateClick(".o-menu div[data-name='clear_row']");
|
|
76
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("DELETE_CONTENT", {
|
|
77
|
-
target: [
|
|
78
|
-
{
|
|
79
|
-
top: 4,
|
|
80
|
-
bottom: 4,
|
|
81
|
-
left: 0,
|
|
82
|
-
right: model["workbook"].activeSheet.cols.length - 1,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
sheet: model["workbook"].activeSheet.id,
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test("can delete cols with contextmenu", async () => {
|
|
90
|
-
simulateContextMenu(".o-col-resizer", COLUMN_D);
|
|
91
|
-
await nextTick();
|
|
92
|
-
|
|
93
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
94
|
-
simulateClick(".o-menu div[data-name='delete_column']");
|
|
95
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("REMOVE_COLUMNS", {
|
|
96
|
-
columns: [3],
|
|
97
|
-
sheet: model["workbook"].activeSheet.id,
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
test("can delete rows with contextmenu", async () => {
|
|
102
|
-
simulateContextMenu(".o-row-resizer", ROW_5);
|
|
103
|
-
await nextTick();
|
|
104
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
105
|
-
simulateClick(".o-menu div[data-name='delete_row']");
|
|
106
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("REMOVE_ROWS", {
|
|
107
|
-
rows: [4],
|
|
108
|
-
sheet: model["workbook"].activeSheet.id,
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test("can add before cols with contextmenu", async () => {
|
|
113
|
-
simulateContextMenu(".o-col-resizer", COLUMN_D);
|
|
114
|
-
await nextTick();
|
|
115
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
116
|
-
simulateClick(".o-menu div[data-name='add_column_before']");
|
|
117
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("ADD_COLUMNS", {
|
|
118
|
-
position: "before",
|
|
119
|
-
column: 3,
|
|
120
|
-
quantity: 1,
|
|
121
|
-
sheet: model["workbook"].activeSheet.id,
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
test("can add before rows with contextmenu", async () => {
|
|
126
|
-
simulateContextMenu(".o-row-resizer", ROW_5);
|
|
127
|
-
await nextTick();
|
|
128
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
129
|
-
simulateClick(".o-menu div[data-name='add_row_before']");
|
|
130
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("ADD_ROWS", {
|
|
131
|
-
position: "before",
|
|
132
|
-
row: 4,
|
|
133
|
-
quantity: 1,
|
|
134
|
-
sheet: model["workbook"].activeSheet.id,
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test("can add after cols with contextmenu", async () => {
|
|
139
|
-
simulateContextMenu(".o-col-resizer", COLUMN_D);
|
|
140
|
-
await nextTick();
|
|
141
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
142
|
-
simulateClick(".o-menu div[data-name='add_column_after']");
|
|
143
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("ADD_COLUMNS", {
|
|
144
|
-
position: "after",
|
|
145
|
-
column: 3,
|
|
146
|
-
quantity: 1,
|
|
147
|
-
sheet: model["workbook"].activeSheet.id,
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test("can add after rows with contextmenu", async () => {
|
|
152
|
-
simulateContextMenu(".o-row-resizer", ROW_5);
|
|
153
|
-
await nextTick();
|
|
154
|
-
parent.env.dispatch = jest.fn((command) => ({ status: "SUCCESS" } as CommandResult));
|
|
155
|
-
simulateClick(".o-menu div[data-name='add_row_after']");
|
|
156
|
-
expect(parent.env.dispatch).toHaveBeenCalledWith("ADD_ROWS", {
|
|
157
|
-
position: "after",
|
|
158
|
-
row: 4,
|
|
159
|
-
quantity: 1,
|
|
160
|
-
sheet: model["workbook"].activeSheet.id,
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|