@omegagrid/grid 0.10.1 → 0.10.2
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/package.json +7 -7
- package/dist/commands/editingCommands.d.ts +0 -4
- package/dist/commands/editingCommands.d.ts.map +0 -1
- package/dist/commands/editingCommands.js +0 -74
- package/dist/commands/editingCommands.js.map +0 -1
- package/dist/commands/groupCommands.d.ts +0 -8
- package/dist/commands/groupCommands.d.ts.map +0 -1
- package/dist/commands/groupCommands.js +0 -7
- package/dist/commands/groupCommands.js.map +0 -1
- package/dist/commands/index.d.ts +0 -4
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -9
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/navigationCommands.d.ts +0 -5
- package/dist/commands/navigationCommands.d.ts.map +0 -1
- package/dist/commands/navigationCommands.js +0 -117
- package/dist/commands/navigationCommands.js.map +0 -1
- package/dist/constants.d.ts +0 -65
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -8
- package/dist/constants.js.map +0 -1
- package/dist/editors/baseEditor.d.ts +0 -31
- package/dist/editors/baseEditor.d.ts.map +0 -1
- package/dist/editors/baseEditor.js +0 -112
- package/dist/editors/baseEditor.js.map +0 -1
- package/dist/editors/calendarEditor.d.ts +0 -12
- package/dist/editors/calendarEditor.d.ts.map +0 -1
- package/dist/editors/calendarEditor.js +0 -74
- package/dist/editors/calendarEditor.js.map +0 -1
- package/dist/editors/checkboxEditor.d.ts +0 -9
- package/dist/editors/checkboxEditor.d.ts.map +0 -1
- package/dist/editors/checkboxEditor.js +0 -32
- package/dist/editors/checkboxEditor.js.map +0 -1
- package/dist/editors/dateEditor.d.ts +0 -8
- package/dist/editors/dateEditor.d.ts.map +0 -1
- package/dist/editors/dateEditor.js +0 -37
- package/dist/editors/dateEditor.js.map +0 -1
- package/dist/editors/dropdownEditor.d.ts +0 -26
- package/dist/editors/dropdownEditor.d.ts.map +0 -1
- package/dist/editors/dropdownEditor.js +0 -142
- package/dist/editors/dropdownEditor.js.map +0 -1
- package/dist/editors/formulaEditor.d.ts +0 -21
- package/dist/editors/formulaEditor.d.ts.map +0 -1
- package/dist/editors/formulaEditor.js +0 -109
- package/dist/editors/formulaEditor.js.map +0 -1
- package/dist/editors/index.d.ts +0 -8
- package/dist/editors/index.d.ts.map +0 -1
- package/dist/editors/index.js +0 -19
- package/dist/editors/index.js.map +0 -1
- package/dist/editors/numberEditor.d.ts +0 -9
- package/dist/editors/numberEditor.d.ts.map +0 -1
- package/dist/editors/numberEditor.js +0 -37
- package/dist/editors/numberEditor.js.map +0 -1
- package/dist/editors/textEditor.d.ts +0 -15
- package/dist/editors/textEditor.d.ts.map +0 -1
- package/dist/editors/textEditor.js +0 -74
- package/dist/editors/textEditor.js.map +0 -1
- package/dist/filters/NumberFilter.d.ts +0 -8
- package/dist/filters/NumberFilter.d.ts.map +0 -1
- package/dist/filters/NumberFilter.js +0 -13
- package/dist/filters/NumberFilter.js.map +0 -1
- package/dist/filters/baseFilter.d.ts +0 -20
- package/dist/filters/baseFilter.d.ts.map +0 -1
- package/dist/filters/baseFilter.js +0 -47
- package/dist/filters/baseFilter.js.map +0 -1
- package/dist/filters/checkboxFilter.d.ts +0 -12
- package/dist/filters/checkboxFilter.d.ts.map +0 -1
- package/dist/filters/checkboxFilter.js +0 -67
- package/dist/filters/checkboxFilter.js.map +0 -1
- package/dist/filters/dropdownFilter.d.ts +0 -17
- package/dist/filters/dropdownFilter.d.ts.map +0 -1
- package/dist/filters/dropdownFilter.js +0 -116
- package/dist/filters/dropdownFilter.js.map +0 -1
- package/dist/filters/filterFactory.d.ts +0 -4
- package/dist/filters/filterFactory.d.ts.map +0 -1
- package/dist/filters/filterFactory.js +0 -39
- package/dist/filters/filterFactory.js.map +0 -1
- package/dist/filters/index.d.ts +0 -5
- package/dist/filters/index.d.ts.map +0 -1
- package/dist/filters/index.js +0 -5
- package/dist/filters/index.js.map +0 -1
- package/dist/filters/textFilter.d.ts +0 -17
- package/dist/filters/textFilter.d.ts.map +0 -1
- package/dist/filters/textFilter.js +0 -89
- package/dist/filters/textFilter.js.map +0 -1
- package/dist/gridAdapter.d.ts +0 -30
- package/dist/gridAdapter.d.ts.map +0 -1
- package/dist/gridAdapter.js +0 -11
- package/dist/gridAdapter.js.map +0 -1
- package/dist/i18n/en-us.d.ts +0 -4
- package/dist/i18n/en-us.d.ts.map +0 -1
- package/dist/i18n/en-us.js +0 -5
- package/dist/i18n/en-us.js.map +0 -1
- package/dist/i18n/index.d.ts +0 -5
- package/dist/i18n/index.d.ts.map +0 -1
- package/dist/i18n/index.js +0 -8
- package/dist/i18n/index.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/renderers/ActionRenderer.d.ts +0 -3
- package/dist/renderers/ActionRenderer.d.ts.map +0 -1
- package/dist/renderers/ActionRenderer.js +0 -68
- package/dist/renderers/ActionRenderer.js.map +0 -1
- package/dist/renderers/BaseRenderer.d.ts +0 -6
- package/dist/renderers/BaseRenderer.d.ts.map +0 -1
- package/dist/renderers/BaseRenderer.js +0 -56
- package/dist/renderers/BaseRenderer.js.map +0 -1
- package/dist/renderers/CheckboxRenderer.d.ts +0 -4
- package/dist/renderers/CheckboxRenderer.d.ts.map +0 -1
- package/dist/renderers/CheckboxRenderer.js +0 -22
- package/dist/renderers/CheckboxRenderer.js.map +0 -1
- package/dist/renderers/DateTimeRenderer.d.ts +0 -4
- package/dist/renderers/DateTimeRenderer.d.ts.map +0 -1
- package/dist/renderers/DateTimeRenderer.js +0 -21
- package/dist/renderers/DateTimeRenderer.js.map +0 -1
- package/dist/renderers/DropdownRenderer.d.ts +0 -4
- package/dist/renderers/DropdownRenderer.d.ts.map +0 -1
- package/dist/renderers/DropdownRenderer.js +0 -18
- package/dist/renderers/DropdownRenderer.js.map +0 -1
- package/dist/renderers/GeneralRenderer.d.ts +0 -4
- package/dist/renderers/GeneralRenderer.d.ts.map +0 -1
- package/dist/renderers/GeneralRenderer.js +0 -12
- package/dist/renderers/GeneralRenderer.js.map +0 -1
- package/dist/renderers/HtmlRenderer.d.ts +0 -4
- package/dist/renderers/HtmlRenderer.d.ts.map +0 -1
- package/dist/renderers/HtmlRenderer.js +0 -6
- package/dist/renderers/HtmlRenderer.js.map +0 -1
- package/dist/renderers/NumberRenderer.d.ts +0 -4
- package/dist/renderers/NumberRenderer.d.ts.map +0 -1
- package/dist/renderers/NumberRenderer.js +0 -14
- package/dist/renderers/NumberRenderer.js.map +0 -1
- package/dist/renderers/SparklineRenderer.d.ts +0 -3
- package/dist/renderers/SparklineRenderer.d.ts.map +0 -1
- package/dist/renderers/SparklineRenderer.js +0 -8
- package/dist/renderers/SparklineRenderer.js.map +0 -1
- package/dist/renderers/TextRenderer.d.ts +0 -4
- package/dist/renderers/TextRenderer.d.ts.map +0 -1
- package/dist/renderers/TextRenderer.js +0 -38
- package/dist/renderers/TextRenderer.js.map +0 -1
- package/dist/renderers/index.d.ts +0 -12
- package/dist/renderers/index.d.ts.map +0 -1
- package/dist/renderers/index.js +0 -32
- package/dist/renderers/index.js.map +0 -1
- package/dist/types.d.ts +0 -10
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/ui/comment.d.ts +0 -59
- package/dist/ui/comment.d.ts.map +0 -1
- package/dist/ui/comment.js +0 -284
- package/dist/ui/comment.js.map +0 -1
- package/dist/ui/comment.style.d.ts +0 -2
- package/dist/ui/comment.style.d.ts.map +0 -1
- package/dist/ui/comment.style.js +0 -108
- package/dist/ui/comment.style.js.map +0 -1
- package/dist/ui/elementCache.d.ts +0 -15
- package/dist/ui/elementCache.d.ts.map +0 -1
- package/dist/ui/elementCache.js +0 -57
- package/dist/ui/elementCache.js.map +0 -1
- package/dist/ui/filterLabel.d.ts +0 -10
- package/dist/ui/filterLabel.d.ts.map +0 -1
- package/dist/ui/filterLabel.js +0 -76
- package/dist/ui/filterLabel.js.map +0 -1
- package/dist/ui/formulaInput.d.ts +0 -56
- package/dist/ui/formulaInput.d.ts.map +0 -1
- package/dist/ui/formulaInput.js +0 -251
- package/dist/ui/formulaInput.js.map +0 -1
- package/dist/ui/formulaInput.style.d.ts +0 -2
- package/dist/ui/formulaInput.style.d.ts.map +0 -1
- package/dist/ui/formulaInput.style.js +0 -65
- package/dist/ui/formulaInput.style.js.map +0 -1
- package/dist/ui/grid.d.ts +0 -91
- package/dist/ui/grid.d.ts.map +0 -1
- package/dist/ui/grid.editing.d.ts +0 -61
- package/dist/ui/grid.editing.d.ts.map +0 -1
- package/dist/ui/grid.editing.js +0 -439
- package/dist/ui/grid.editing.js.map +0 -1
- package/dist/ui/grid.events.d.ts +0 -97
- package/dist/ui/grid.events.d.ts.map +0 -1
- package/dist/ui/grid.events.js +0 -581
- package/dist/ui/grid.events.js.map +0 -1
- package/dist/ui/grid.filtering.d.ts +0 -23
- package/dist/ui/grid.filtering.d.ts.map +0 -1
- package/dist/ui/grid.filtering.js +0 -68
- package/dist/ui/grid.filtering.js.map +0 -1
- package/dist/ui/grid.js +0 -297
- package/dist/ui/grid.js.map +0 -1
- package/dist/ui/grid.menu.d.ts +0 -43
- package/dist/ui/grid.menu.d.ts.map +0 -1
- package/dist/ui/grid.menu.js +0 -168
- package/dist/ui/grid.menu.js.map +0 -1
- package/dist/ui/grid.objects.d.ts +0 -24
- package/dist/ui/grid.objects.d.ts.map +0 -1
- package/dist/ui/grid.objects.js +0 -69
- package/dist/ui/grid.objects.js.map +0 -1
- package/dist/ui/grid.rendering.d.ts +0 -84
- package/dist/ui/grid.rendering.d.ts.map +0 -1
- package/dist/ui/grid.rendering.js +0 -471
- package/dist/ui/grid.rendering.js.map +0 -1
- package/dist/ui/grid.selecting.d.ts +0 -99
- package/dist/ui/grid.selecting.d.ts.map +0 -1
- package/dist/ui/grid.selecting.js +0 -319
- package/dist/ui/grid.selecting.js.map +0 -1
- package/dist/ui/grid.sorting.d.ts +0 -23
- package/dist/ui/grid.sorting.d.ts.map +0 -1
- package/dist/ui/grid.sorting.js +0 -47
- package/dist/ui/grid.sorting.js.map +0 -1
- package/dist/ui/grid.style.d.ts +0 -2
- package/dist/ui/grid.style.d.ts.map +0 -1
- package/dist/ui/grid.style.js +0 -39
- package/dist/ui/grid.style.js.map +0 -1
- package/dist/ui/group.d.ts +0 -71
- package/dist/ui/group.d.ts.map +0 -1
- package/dist/ui/group.js +0 -312
- package/dist/ui/group.js.map +0 -1
- package/dist/ui/index.d.ts +0 -19
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -19
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/objectHost.d.ts +0 -30
- package/dist/ui/objectHost.d.ts.map +0 -1
- package/dist/ui/objectHost.js +0 -114
- package/dist/ui/objectHost.js.map +0 -1
- package/dist/ui/objectHost.style.d.ts +0 -2
- package/dist/ui/objectHost.style.d.ts.map +0 -1
- package/dist/ui/objectHost.style.js +0 -43
- package/dist/ui/objectHost.style.js.map +0 -1
- package/dist/ui/selector.d.ts +0 -97
- package/dist/ui/selector.d.ts.map +0 -1
- package/dist/ui/selector.js +0 -489
- package/dist/ui/selector.js.map +0 -1
- package/dist/ui/selector.style.d.ts +0 -2
- package/dist/ui/selector.style.d.ts.map +0 -1
- package/dist/ui/selector.style.js +0 -106
- package/dist/ui/selector.style.js.map +0 -1
- package/dist/ui/sortingArrow.d.ts +0 -8
- package/dist/ui/sortingArrow.d.ts.map +0 -1
- package/dist/ui/sortingArrow.js +0 -42
- package/dist/ui/sortingArrow.js.map +0 -1
- package/dist/ui/sparkline.d.ts +0 -14
- package/dist/ui/sparkline.d.ts.map +0 -1
- package/dist/ui/sparkline.js +0 -111
- package/dist/ui/sparkline.js.map +0 -1
- package/dist/ui/table.d.ts +0 -122
- package/dist/ui/table.d.ts.map +0 -1
- package/dist/ui/table.js +0 -1063
- package/dist/ui/table.js.map +0 -1
- package/dist/ui/table.styles.d.ts +0 -2
- package/dist/ui/table.styles.d.ts.map +0 -1
- package/dist/ui/table.styles.js +0 -249
- package/dist/ui/table.styles.js.map +0 -1
- package/dist/ui/tooltip.d.ts +0 -9
- package/dist/ui/tooltip.d.ts.map +0 -1
- package/dist/ui/tooltip.js +0 -32
- package/dist/ui/tooltip.js.map +0 -1
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
export const style = css `
|
|
3
|
-
* {
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:host {
|
|
8
|
-
background: red;
|
|
9
|
-
display: block;
|
|
10
|
-
font-size: var(--og-font-size);
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
position: relative;
|
|
13
|
-
background-color: var(--og-background-color);
|
|
14
|
-
min-height: 22px;
|
|
15
|
-
outline: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#formulaPreview {
|
|
19
|
-
display: none;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
:host([preview]) #formulaPreview {
|
|
23
|
-
display: inline-block;
|
|
24
|
-
pointer-events: none;
|
|
25
|
-
z-index: 100;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
:host([preview]) #formulaInput {
|
|
29
|
-
color: transparent;
|
|
30
|
-
z-index: 99;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
#formulaPreview, #formulaInput {
|
|
34
|
-
height: 100%;
|
|
35
|
-
inset: 0;
|
|
36
|
-
font-size: var(--og-font-size);
|
|
37
|
-
font-family: var(--og-font-family);
|
|
38
|
-
border: none;
|
|
39
|
-
outline: none;
|
|
40
|
-
padding: 0 2px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#formulaPreview {
|
|
44
|
-
white-space: nowrap;
|
|
45
|
-
display: none;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
#formulaInput {
|
|
50
|
-
position: absolute;
|
|
51
|
-
width: 100%;
|
|
52
|
-
background-color: transparent;
|
|
53
|
-
caret-color: var(--og-text-color);
|
|
54
|
-
color: var(--og-text-color);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* #formulaPreview:before, #formulaInput:before {
|
|
58
|
-
content: "";
|
|
59
|
-
display: inline-block;
|
|
60
|
-
height: 100%;
|
|
61
|
-
vertical-align: middle;
|
|
62
|
-
} */
|
|
63
|
-
|
|
64
|
-
`;
|
|
65
|
-
//# sourceMappingURL=formulaInput.style.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formulaInput.style.js","sourceRoot":"","sources":["../../src/ui/formulaInput.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DvB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host {\n\t\tbackground: red;\n\t\tdisplay: block;\n\t\tfont-size: var(--og-font-size);\n\t\tbox-sizing: border-box;\n\t\tposition: relative;\n\t\tbackground-color: var(--og-background-color);\n\t\tmin-height: 22px;\n\t\toutline: none;\n\t}\n\n\t#formulaPreview {\n\t\tdisplay: none;\n\t}\n\n\t:host([preview]) #formulaPreview {\n\t\tdisplay: inline-block;\n\t\tpointer-events: none;\n\t\tz-index: 100;\n\t}\n\n\t:host([preview]) #formulaInput {\n\t\tcolor: transparent;\n\t\tz-index: 99;\n\t}\n\n\t#formulaPreview, #formulaInput {\n\t\theight: 100%;\n\t\tinset: 0;\n\t\tfont-size: var(--og-font-size);\n\t\tfont-family: var(--og-font-family);\n\t\tborder: none;\n\t\toutline: none;\n\t\tpadding: 0 2px;\n\t}\n\n\t#formulaPreview {\n\t\twhite-space: nowrap;\n\t\tdisplay: none;\n\t\toverflow: hidden;\n\t}\n\n\t#formulaInput {\n\t\tposition: absolute;\n\t\twidth: 100%;\n\t\tbackground-color: transparent;\n\t\tcaret-color: var(--og-text-color);\n\t\tcolor: var(--og-text-color);\n\t}\n\n\t/* #formulaPreview:before, #formulaInput:before {\n\t\tcontent: \"\";\n\t\tdisplay: inline-block;\n\t\theight: 100%;\n\t\tvertical-align: middle;\n\t} */\n\n`;"]}
|
package/dist/ui/grid.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { log, Slider, Sizer, Layout, Menu, Plugins, AnyConstructor } from '@omegagrid/core';
|
|
2
|
-
import { GridModel, GridSource, SelectionModel, Options, History, TableTheme } from '@omegagrid/grid-core';
|
|
3
|
-
import { Selector } from './selector';
|
|
4
|
-
import { CommandManager } from '@omegagrid/commands';
|
|
5
|
-
import { LitElement } from 'lit';
|
|
6
|
-
import { Table } from './table';
|
|
7
|
-
import { GridTooltip as Tooltip } from './tooltip';
|
|
8
|
-
import { GridRendering } from './grid.rendering';
|
|
9
|
-
import { GridSelecting } from './grid.selecting';
|
|
10
|
-
import { GridEvent, GridEvents } from './grid.events';
|
|
11
|
-
import { GridEditing } from './grid.editing';
|
|
12
|
-
import { GridFiltering } from './grid.filtering';
|
|
13
|
-
import { GridObjects } from './grid.objects';
|
|
14
|
-
import { GridSorting } from './grid.sorting';
|
|
15
|
-
import { GridMenus } from './grid.menu';
|
|
16
|
-
import { GridGroup } from './group';
|
|
17
|
-
import { Comment } from './comment';
|
|
18
|
-
import { GridAdapter } from '../gridAdapter';
|
|
19
|
-
export declare class Grid extends LitElement implements Layout {
|
|
20
|
-
static styles: import("lit").CSSResult[];
|
|
21
|
-
private tableRef;
|
|
22
|
-
get table(): Table;
|
|
23
|
-
private hSliderRef;
|
|
24
|
-
get hSlider(): Slider;
|
|
25
|
-
private vSliderRef;
|
|
26
|
-
get vSlider(): Slider;
|
|
27
|
-
private hSizerRef;
|
|
28
|
-
get hSizer(): Sizer;
|
|
29
|
-
private vSizerRef;
|
|
30
|
-
get vSizer(): Sizer;
|
|
31
|
-
private selectorRef;
|
|
32
|
-
get selector(): Selector;
|
|
33
|
-
private copySelectorRef;
|
|
34
|
-
get copySelector(): Selector;
|
|
35
|
-
private formulaSelectorRef;
|
|
36
|
-
get formulaSelector(): Selector;
|
|
37
|
-
private contextMenuRef;
|
|
38
|
-
get contextMenu(): Menu;
|
|
39
|
-
private tooltipRef;
|
|
40
|
-
get tooltip(): Tooltip;
|
|
41
|
-
private commentRef;
|
|
42
|
-
get comment(): Comment;
|
|
43
|
-
get designMode(): boolean;
|
|
44
|
-
model: GridModel;
|
|
45
|
-
adapter: GridAdapter;
|
|
46
|
-
selection: SelectionModel;
|
|
47
|
-
options: Options;
|
|
48
|
-
logger: log.Logger;
|
|
49
|
-
zoom: number;
|
|
50
|
-
group: GridGroup;
|
|
51
|
-
history: History;
|
|
52
|
-
rendering: GridRendering;
|
|
53
|
-
selecting: GridSelecting;
|
|
54
|
-
events: GridEvents;
|
|
55
|
-
editing: GridEditing;
|
|
56
|
-
filtering: GridFiltering;
|
|
57
|
-
sorting: GridSorting;
|
|
58
|
-
menus: GridMenus;
|
|
59
|
-
objects: GridObjects;
|
|
60
|
-
commands: CommandManager;
|
|
61
|
-
plugins: Plugins<Grid>;
|
|
62
|
-
loading: boolean;
|
|
63
|
-
connectedCallback(): void;
|
|
64
|
-
disconnectedCallback(): void;
|
|
65
|
-
destroy(): void;
|
|
66
|
-
initAdapter(): Promise<void>;
|
|
67
|
-
updateOptions(options: Partial<Options>): void;
|
|
68
|
-
private _debounceVerticalSlide;
|
|
69
|
-
private _debounceHorizontalSlide;
|
|
70
|
-
render: () => import("lit-html").TemplateResult<1>;
|
|
71
|
-
openCommands(): void;
|
|
72
|
-
closeCommands(): void;
|
|
73
|
-
firstUpdated(): Promise<void>;
|
|
74
|
-
updated(changedProps: Map<PropertyKey, unknown>): Promise<void>;
|
|
75
|
-
innerLayout(): void;
|
|
76
|
-
debounceInnerLayout: {
|
|
77
|
-
(this: unknown, ...args: [] & any[]): Promise<void>;
|
|
78
|
-
cancel: (reason?: any) => void;
|
|
79
|
-
};
|
|
80
|
-
layout(): void;
|
|
81
|
-
setSourceData(data: GridSource): void;
|
|
82
|
-
willUpdate(changedProps: Map<PropertyKey, unknown>): void;
|
|
83
|
-
focus(options?: FocusOptions): void;
|
|
84
|
-
refresh(): Promise<void>;
|
|
85
|
-
createEvent<TEvent extends GridEvent>(type: string, args?: Partial<TEvent>, event?: AnyConstructor<TEvent>): TEvent;
|
|
86
|
-
dispatchGridEvent<TEvent extends GridEvent>(type: string, args?: Partial<TEvent>, event?: AnyConstructor<TEvent>): void;
|
|
87
|
-
getConnectedGrid(name: string): Grid;
|
|
88
|
-
getSourceData(): GridSource;
|
|
89
|
-
setTheme(theme: TableTheme): void;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=grid.d.ts.map
|
package/dist/ui/grid.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/ui/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAU,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAe,OAAO,EAAa,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,aAAa,EAA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AC;IAK1G,iBAAiB,CAAC,MAAM,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC;IAIhH,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAI7B,aAAa;IAOb,QAAQ,CAAC,KAAK,EAAE,UAAU;CAM1B"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { BaseEditor } from "../editors/baseEditor";
|
|
2
|
-
import { CellModel, CellValueType, CellSource, CellAddress } from "@omegagrid/grid-core";
|
|
3
|
-
import { Grid } from "./grid";
|
|
4
|
-
export type DeleteOptions = {
|
|
5
|
-
index: number;
|
|
6
|
-
count: number;
|
|
7
|
-
dispatchEvent?: boolean;
|
|
8
|
-
fromHistory?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type InsertOptions = DeleteOptions & {
|
|
11
|
-
after?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export type MovingOptions = DeleteOptions & {
|
|
14
|
-
targetIndex: number;
|
|
15
|
-
};
|
|
16
|
-
export declare class GridEditing {
|
|
17
|
-
readonly grid: Grid;
|
|
18
|
-
private editorMap;
|
|
19
|
-
private editor;
|
|
20
|
-
columnMoving: boolean;
|
|
21
|
-
rowMoving: boolean;
|
|
22
|
-
get model(): import("@omegagrid/grid-core").GridModel;
|
|
23
|
-
get selection(): import("@omegagrid/grid-core").SelectionModel;
|
|
24
|
-
get selector(): import("./selector").Selector;
|
|
25
|
-
get events(): import("./grid.events").GridEvents;
|
|
26
|
-
get table(): import("./table").Table;
|
|
27
|
-
get isEditing(): boolean;
|
|
28
|
-
get activeEditor(): BaseEditor;
|
|
29
|
-
private _formulaMode;
|
|
30
|
-
get isFormulaMode(): boolean;
|
|
31
|
-
constructor(grid: Grid);
|
|
32
|
-
canEdit(cell: CellModel): boolean;
|
|
33
|
-
updateCell(cell: CellModel, value: CellValueType | CellSource, dispatchEvent?: boolean, fromHistory?: boolean): void;
|
|
34
|
-
updateCells(cells: CellModel[], values: (CellValueType | CellSource)[], dispatchEvent?: boolean, fromHistory?: boolean): void;
|
|
35
|
-
startFormulaMode(): void;
|
|
36
|
-
endFormulaMode(group?: boolean): void;
|
|
37
|
-
startEdit(initialValue?: unknown): void;
|
|
38
|
-
endEdit(): void;
|
|
39
|
-
commitEdit(): void;
|
|
40
|
-
insertRows(options: InsertOptions): import("@omegagrid/grid-core").RowModel[];
|
|
41
|
-
insertColumns(options: InsertOptions): import("@omegagrid/grid-core").ColumnModel[];
|
|
42
|
-
deleteRows(options: DeleteOptions): import("@omegagrid/grid-core").RowModel[];
|
|
43
|
-
deleteColumns(options: DeleteOptions): import("@omegagrid/grid-core").ColumnModel[];
|
|
44
|
-
moveRows(options: MovingOptions): void;
|
|
45
|
-
moveColumns(options: MovingOptions): void;
|
|
46
|
-
clearSelection(dispatchEvent?: boolean): void;
|
|
47
|
-
getEditor(cell: CellModel): BaseEditor;
|
|
48
|
-
getFormulaEditor(): BaseEditor;
|
|
49
|
-
getSelectionCellData(): CellSource[][];
|
|
50
|
-
copySelection(): void;
|
|
51
|
-
private pasteMatrix;
|
|
52
|
-
private pasteText;
|
|
53
|
-
paste(): Promise<void>;
|
|
54
|
-
openComments(cell: CellModel): void;
|
|
55
|
-
undo(): void;
|
|
56
|
-
redo(): void;
|
|
57
|
-
startColumnMoving(_c: number): void;
|
|
58
|
-
merge(range?: CellAddress): void;
|
|
59
|
-
unmerge(range?: CellAddress): void;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=grid.editing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grid.editing.d.ts","sourceRoot":"","sources":["../../src/ui/grid.editing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAwB,aAAa,EAA2B,UAAU,EAAE,WAAW,EAAE,MAAM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,UAAU;IAOV,UAAU,CAAC,OAAO,EAAE,aAAa;IAYjC,aAAa,CAAC,OAAO,EAAE,aAAa;IAYpC,UAAU,CAAC,OAAO,EAAE,aAAa;IAYjC,aAAa,CAAC,OAAO,EAAE,aAAa;IAYpC,QAAQ,CAAC,OAAO,EAAE,aAAa;IAY/B,WAAW,CAAC,OAAO,EAAE,aAAa;IAYlC,cAAc,CAAC,aAAa,UAAO;IAMnC,SAAS,CAAC,IAAI,EAAE,SAAS;IAUzB,gBAAgB;IAUhB,oBAAoB;IAMpB,aAAa;IA0Bb,OAAO,CAAC,WAAW;IA2FnB,OAAO,CAAC,SAAS;IAIX,KAAK;IAoBX,YAAY,CAAC,IAAI,EAAE,SAAS;IAM5B,IAAI;IA6BJ,IAAI;IA6BJ,iBAAiB,CAAC,EAAE,EAAE,MAAM;IAI5B,KAAK,CAAC,KAAK,CAAC,EAAE,WAAW;IASzB,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW;CAW3B"}
|
package/dist/ui/grid.editing.js
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
import { csv, utils } from "@omegagrid/core";
|
|
2
|
-
import { FormulaEditor, getEditorFactory } from "../editors";
|
|
3
|
-
import { isFormula, CellRange, decodeColumn, decodeRow } from "@omegagrid/grid-core";
|
|
4
|
-
import { GridEditEvent, GridEvent } from "./grid.events";
|
|
5
|
-
import constants from "../constants";
|
|
6
|
-
export class GridEditing {
|
|
7
|
-
get model() { return this.grid.model; }
|
|
8
|
-
get selection() { return this.grid.selection; }
|
|
9
|
-
get selector() { return this.grid.selector; }
|
|
10
|
-
get events() { return this.grid.events; }
|
|
11
|
-
get table() { return this.grid.table; }
|
|
12
|
-
get isEditing() { return !!this.editor; }
|
|
13
|
-
get activeEditor() { return this.editor; }
|
|
14
|
-
get isFormulaMode() { return this._formulaMode || this.grid.group?.isFormulaMode; }
|
|
15
|
-
constructor(grid) {
|
|
16
|
-
this.grid = grid;
|
|
17
|
-
this.editorMap = new Map();
|
|
18
|
-
this.columnMoving = false;
|
|
19
|
-
this.rowMoving = false;
|
|
20
|
-
this._formulaMode = false;
|
|
21
|
-
}
|
|
22
|
-
canEdit(cell) {
|
|
23
|
-
return (cell.editable || this.grid.designMode) && cell.type !== 'a';
|
|
24
|
-
}
|
|
25
|
-
updateCell(cell, value, dispatchEvent = true, fromHistory = false) {
|
|
26
|
-
this.updateCells([cell], [value], dispatchEvent, fromHistory);
|
|
27
|
-
}
|
|
28
|
-
updateCells(cells, values, dispatchEvent = true, fromHistory = false) {
|
|
29
|
-
let oldValues;
|
|
30
|
-
let oldPropsArr;
|
|
31
|
-
let newValues;
|
|
32
|
-
let newPropsArr;
|
|
33
|
-
let editedCells;
|
|
34
|
-
cells.forEach((cell, i) => {
|
|
35
|
-
const oldValue = cell.value;
|
|
36
|
-
let newValue;
|
|
37
|
-
let newProps;
|
|
38
|
-
if (utils.isObject(values[i])) {
|
|
39
|
-
newProps = values[i];
|
|
40
|
-
newValue = ('v' in newProps) ? newProps.v : undefined;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
newValue = values[i];
|
|
44
|
-
}
|
|
45
|
-
let oldProps;
|
|
46
|
-
if (newProps) {
|
|
47
|
-
oldProps = cell.update(newProps);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
cell.clearFormula();
|
|
51
|
-
if (oldValue !== newValue) {
|
|
52
|
-
oldProps = { v: oldValue, dv: cell.displayValue };
|
|
53
|
-
cell.value = newValue;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (dispatchEvent && oldProps) {
|
|
57
|
-
oldValues = oldValues || [];
|
|
58
|
-
oldPropsArr = oldPropsArr || [];
|
|
59
|
-
newValues = newValues || [];
|
|
60
|
-
newPropsArr = newPropsArr || [];
|
|
61
|
-
editedCells = editedCells || [];
|
|
62
|
-
oldValues.push(oldValue);
|
|
63
|
-
oldPropsArr.push(oldProps);
|
|
64
|
-
newValues.push(newValue);
|
|
65
|
-
newPropsArr.push(newProps);
|
|
66
|
-
editedCells.push(cell);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
if (dispatchEvent && editedCells?.length) {
|
|
70
|
-
this.grid.dispatchEvent(new GridEditEvent({
|
|
71
|
-
grid: this.grid,
|
|
72
|
-
fromHistory: !!fromHistory,
|
|
73
|
-
cells: editedCells,
|
|
74
|
-
editType: 'value',
|
|
75
|
-
newValues: newValues,
|
|
76
|
-
newProps: newPropsArr,
|
|
77
|
-
oldValues: oldValues,
|
|
78
|
-
oldProps: oldPropsArr
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
startFormulaMode() {
|
|
83
|
-
this._formulaMode = true;
|
|
84
|
-
if (this.grid.group)
|
|
85
|
-
this.grid.group.startFormulaMode(this.grid);
|
|
86
|
-
}
|
|
87
|
-
endFormulaMode(group = true) {
|
|
88
|
-
this._formulaMode = false;
|
|
89
|
-
if (group && this.grid.group)
|
|
90
|
-
this.grid.group.endFormulaMode();
|
|
91
|
-
this.grid.selecting.hideFormulaSelector();
|
|
92
|
-
this.grid.selecting.removeFormulaHighlight();
|
|
93
|
-
this.grid.selecting.showSelector();
|
|
94
|
-
}
|
|
95
|
-
startEdit(initialValue = null) {
|
|
96
|
-
const cell = this.grid.selecting.activeCell;
|
|
97
|
-
if (cell && this.canEdit(cell)) {
|
|
98
|
-
this.grid.logger.info(`start edit ${(new CellRange(cell.c, cell.r)).A1}`);
|
|
99
|
-
let formula = true;
|
|
100
|
-
if (isFormula(initialValue)) {
|
|
101
|
-
this.editor = this.getFormulaEditor().open(this.grid, initialValue);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
if (initialValue == null && cell.hasOwnFormula) {
|
|
105
|
-
this.editor = this.getFormulaEditor().open(this.grid, initialValue);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
formula = false;
|
|
109
|
-
this.editor = this.getEditor(cell).open(this.grid, initialValue);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
this.grid.dispatchEvent(new GridEvent('startEdit', { grid: this.grid }));
|
|
113
|
-
if (formula) {
|
|
114
|
-
this.startFormulaMode();
|
|
115
|
-
this.grid.dispatchEvent(new GridEvent('startFormulaEdit', { grid: this.grid }));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
endEdit() {
|
|
120
|
-
if (!this.editor)
|
|
121
|
-
return;
|
|
122
|
-
this.grid.logger.info('end edit');
|
|
123
|
-
this.grid.editing.endFormulaMode();
|
|
124
|
-
this.editor?.close();
|
|
125
|
-
this.editor = null;
|
|
126
|
-
this.grid.dispatchEvent(new GridEvent('endEdit', { grid: this.grid }));
|
|
127
|
-
}
|
|
128
|
-
commitEdit() {
|
|
129
|
-
if (this.editor) {
|
|
130
|
-
this.editor.commit();
|
|
131
|
-
this.endEdit();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
insertRows(options) {
|
|
135
|
-
const newRows = this.model.insertRows(options.index, options.count, options.after);
|
|
136
|
-
this.grid.rendering.renderAll(true);
|
|
137
|
-
if (utils.ifNull(options.dispatchEvent, true))
|
|
138
|
-
this.grid.dispatchEvent(new GridEditEvent({
|
|
139
|
-
grid: this.grid,
|
|
140
|
-
fromHistory: !!options.fromHistory,
|
|
141
|
-
editType: 'insert_row',
|
|
142
|
-
newValues: newRows
|
|
143
|
-
}));
|
|
144
|
-
return newRows;
|
|
145
|
-
}
|
|
146
|
-
insertColumns(options) {
|
|
147
|
-
const newColumns = this.model.insertColumns(options.index, options.count, options.after);
|
|
148
|
-
this.grid.rendering.renderAll(true);
|
|
149
|
-
if (utils.ifNull(options.dispatchEvent, true))
|
|
150
|
-
this.grid.dispatchEvent(new GridEditEvent({
|
|
151
|
-
grid: this.grid,
|
|
152
|
-
fromHistory: !!options.fromHistory,
|
|
153
|
-
editType: 'insert_column',
|
|
154
|
-
newValues: newColumns
|
|
155
|
-
}));
|
|
156
|
-
return newColumns;
|
|
157
|
-
}
|
|
158
|
-
deleteRows(options) {
|
|
159
|
-
const deletedRows = this.model.deleteRows(options.index, options.count);
|
|
160
|
-
this.grid.rendering.renderAll(true);
|
|
161
|
-
if (utils.ifNull(options.dispatchEvent, true))
|
|
162
|
-
this.grid.dispatchEvent(new GridEditEvent({
|
|
163
|
-
grid: this.grid,
|
|
164
|
-
fromHistory: !!options.fromHistory,
|
|
165
|
-
editType: 'delete_row',
|
|
166
|
-
oldValues: deletedRows
|
|
167
|
-
}));
|
|
168
|
-
return deletedRows;
|
|
169
|
-
}
|
|
170
|
-
deleteColumns(options) {
|
|
171
|
-
const deletedColumns = this.model.deleteColumns(options.index, options.count);
|
|
172
|
-
this.grid.rendering.renderAll(true);
|
|
173
|
-
if (utils.ifNull(options.dispatchEvent, true))
|
|
174
|
-
this.grid.dispatchEvent(new GridEditEvent({
|
|
175
|
-
grid: this.grid,
|
|
176
|
-
fromHistory: !!options.fromHistory,
|
|
177
|
-
editType: 'delete_column',
|
|
178
|
-
oldValues: deletedColumns
|
|
179
|
-
}));
|
|
180
|
-
return deletedColumns;
|
|
181
|
-
}
|
|
182
|
-
moveRows(options) {
|
|
183
|
-
this.model.moveRows(options.index, options.count, options.targetIndex);
|
|
184
|
-
this.grid.rendering.renderAll(false);
|
|
185
|
-
if (utils.ifNull(options.dispatchEvent, true))
|
|
186
|
-
this.grid.dispatchEvent(new GridEditEvent({
|
|
187
|
-
grid: this.grid,
|
|
188
|
-
fromHistory: options.fromHistory,
|
|
189
|
-
editType: 'move_row',
|
|
190
|
-
oldValues: [new CellRange(0, options.index, Infinity, options.index + options.count - 1)],
|
|
191
|
-
newValues: [new CellRange(0, options.targetIndex, Infinity, options.targetIndex + options.count - 1)],
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
moveColumns(options) {
|
|
195
|
-
this.model.moveColumns(options.index, options.count, options.targetIndex);
|
|
196
|
-
this.grid.rendering.renderAll(false);
|
|
197
|
-
if (utils.ifNull(options.dispatchEvent, true))
|
|
198
|
-
this.grid.dispatchEvent(new GridEditEvent({
|
|
199
|
-
grid: this.grid,
|
|
200
|
-
fromHistory: options.fromHistory,
|
|
201
|
-
editType: 'move_column',
|
|
202
|
-
oldValues: [new CellRange(options.index, options.index + options.count - 1, Infinity)],
|
|
203
|
-
newValues: [new CellRange(options.targetIndex, 0, options.targetIndex + options.count - 1, Infinity)],
|
|
204
|
-
}));
|
|
205
|
-
}
|
|
206
|
-
clearSelection(dispatchEvent = true) {
|
|
207
|
-
const cells = this.model.getCellArray(this.selection.range).filter(cell => this.canEdit(cell));
|
|
208
|
-
this.updateCells(cells, cells.map(() => null), dispatchEvent);
|
|
209
|
-
this.grid.rendering.updateCells(cells, true);
|
|
210
|
-
}
|
|
211
|
-
getEditor(cell) {
|
|
212
|
-
const type = cell.type;
|
|
213
|
-
if (!this.editorMap.has(type)) {
|
|
214
|
-
const editor = getEditorFactory(type).createComponent(this.model.options.editing);
|
|
215
|
-
this.grid.shadowRoot.appendChild(editor);
|
|
216
|
-
this.editorMap.set(type, editor);
|
|
217
|
-
}
|
|
218
|
-
return this.editorMap.get(type);
|
|
219
|
-
}
|
|
220
|
-
getFormulaEditor() {
|
|
221
|
-
const type = 'formula';
|
|
222
|
-
if (!this.editorMap.has(type)) {
|
|
223
|
-
const editor = new FormulaEditor();
|
|
224
|
-
this.grid.shadowRoot.appendChild(editor);
|
|
225
|
-
this.editorMap.set(type, editor);
|
|
226
|
-
}
|
|
227
|
-
return this.editorMap.get(type);
|
|
228
|
-
}
|
|
229
|
-
getSelectionCellData() {
|
|
230
|
-
return this.model.getCellMatrix(this.selection.range).map(row => row.map(cell => cell.getSourceData({ displayValue: true })));
|
|
231
|
-
}
|
|
232
|
-
copySelection() {
|
|
233
|
-
const customClipboardSupport = ClipboardItem.supports(constants.CUSTOM_CLIPBOARD_TYPE);
|
|
234
|
-
const values = this.model.getValuesInRange(this.selection.range, customClipboardSupport);
|
|
235
|
-
this.grid.selecting.hideSelector();
|
|
236
|
-
this.grid.selecting.showCopySelector();
|
|
237
|
-
const clipboardData = { 'text/plain': new Blob([
|
|
238
|
-
csv.arrayToCsv(values, { decimalSeparator: this.model.options.systemDecimalSeparator })
|
|
239
|
-
], {
|
|
240
|
-
type: "text/plain"
|
|
241
|
-
}) };
|
|
242
|
-
if (customClipboardSupport) {
|
|
243
|
-
clipboardData[constants.CUSTOM_CLIPBOARD_TYPE] = new Blob([JSON.stringify(this.getSelectionCellData())], {
|
|
244
|
-
type: "application/json"
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
this.grid.logger.warn("Browser does not support custom clipboard type");
|
|
249
|
-
}
|
|
250
|
-
navigator.clipboard.write([new ClipboardItem(clipboardData)]).then(() => this.grid.logger.info("selected content copied"), () => this.grid.logger.error("copy rejected"));
|
|
251
|
-
}
|
|
252
|
-
pasteMatrix(data) {
|
|
253
|
-
const range = this.selection.range;
|
|
254
|
-
const cells = [];
|
|
255
|
-
const cellValues = [];
|
|
256
|
-
const rowPasteMode = this.model.options.clipboard?.rowPasteMode;
|
|
257
|
-
const columnPasteMode = this.model.options.clipboard?.columnPasteMode;
|
|
258
|
-
const pasteProps = (this.model.options.clipboard?.pasteProps ?? 'all') == 'all'
|
|
259
|
-
? null : this.model.options.clipboard.pasteProps;
|
|
260
|
-
const height = data.length;
|
|
261
|
-
const width = height > 0 ? data[0].length : 0;
|
|
262
|
-
// insert rows if needed
|
|
263
|
-
if (rowPasteMode == 'insert') {
|
|
264
|
-
this.insertRows({ index: range.r1, count: height, after: false });
|
|
265
|
-
}
|
|
266
|
-
else if (rowPasteMode == 'rewrite_append' && range.r1 + height > this.model.rows.length - 1) {
|
|
267
|
-
this.insertRows({
|
|
268
|
-
index: this.model.rows.length - 1,
|
|
269
|
-
count: range.r1 + height - this.model.rows.length,
|
|
270
|
-
after: true
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
// insert columns if needed
|
|
274
|
-
if (columnPasteMode == 'insert') {
|
|
275
|
-
this.insertColumns({ index: range.c1, count: width, after: false });
|
|
276
|
-
}
|
|
277
|
-
else if (columnPasteMode == 'rewrite_append' && range.c1 + width > this.model.columns.length - 1) {
|
|
278
|
-
this.insertColumns({
|
|
279
|
-
index: this.model.columns.length - 1,
|
|
280
|
-
count: range.c1 + width - this.model.columns.length,
|
|
281
|
-
after: true
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
// duplicate clipboard matrix over selection range if it fits
|
|
285
|
-
const dataFitsSelection = height > 0 && width > 0 &&
|
|
286
|
-
range.size.rows % height == 0 && range.size.columns % width == 0;
|
|
287
|
-
let rMax = Math.min(dataFitsSelection ? range.r2 : range.r1 + height - 1, this.model.rows.length - 1);
|
|
288
|
-
const cMax = Math.min(dataFitsSelection ? range.c2 : range.c1 + width - 1, this.model.columns.length - 1);
|
|
289
|
-
for (let r = range.r1; r <= rMax; r++) {
|
|
290
|
-
const i = (r - range.r1) % height;
|
|
291
|
-
const row = this.model.rows[r];
|
|
292
|
-
if (!row)
|
|
293
|
-
break;
|
|
294
|
-
if (this.model.options.clipboard?.skipHiddenRows) {
|
|
295
|
-
if (!row.visible) {
|
|
296
|
-
// resize target range to accommodate skipped row, but only if clipboard data is larger than selection
|
|
297
|
-
if (height > range.size.rows)
|
|
298
|
-
rMax++;
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
for (let c = range.c1; c <= cMax; c++) {
|
|
303
|
-
const cell = row.cell(c);
|
|
304
|
-
if (!cell.editable)
|
|
305
|
-
continue;
|
|
306
|
-
const j = (c - range.c1) % data[i].length;
|
|
307
|
-
if (pasteProps && utils.isObject(data[i][j])) {
|
|
308
|
-
// filter unwanted properties
|
|
309
|
-
const updateProps = {};
|
|
310
|
-
pasteProps.forEach((key) => {
|
|
311
|
-
updateProps[key] = data[i][j][key];
|
|
312
|
-
});
|
|
313
|
-
// copiing properties of cell with display value into cell without display value
|
|
314
|
-
if (!cell.prefersDisplayValue)
|
|
315
|
-
updateProps.dv = undefined;
|
|
316
|
-
cellValues.push(updateProps);
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
cellValues.push(data[i][j]);
|
|
320
|
-
}
|
|
321
|
-
cells.push(cell);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
this.updateCells(cells, cellValues, true);
|
|
325
|
-
this.grid.rendering.updateCells(cells, true);
|
|
326
|
-
}
|
|
327
|
-
pasteText(text) {
|
|
328
|
-
this.pasteMatrix(csv.csvToArray(text));
|
|
329
|
-
}
|
|
330
|
-
async paste() {
|
|
331
|
-
this.grid.selecting.hideCopySelector();
|
|
332
|
-
try {
|
|
333
|
-
const clipboardItems = await navigator.clipboard.read();
|
|
334
|
-
if (clipboardItems.length == 0)
|
|
335
|
-
return;
|
|
336
|
-
const clipboardItem = clipboardItems[0];
|
|
337
|
-
if (clipboardItem.types.includes(constants.CUSTOM_CLIPBOARD_TYPE)) {
|
|
338
|
-
const data = await clipboardItem.getType(constants.CUSTOM_CLIPBOARD_TYPE);
|
|
339
|
-
this.pasteMatrix(JSON.parse(await data.text()));
|
|
340
|
-
}
|
|
341
|
-
else if (clipboardItem.types.includes('text/plain')) {
|
|
342
|
-
const data = await clipboardItem.getType('text/plain');
|
|
343
|
-
this.pasteText(await data.text());
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
catch (_e) {
|
|
347
|
-
this.grid.logger.error("paste rejected");
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
openComments(cell) {
|
|
352
|
-
setTimeout(() => {
|
|
353
|
-
this.grid.comment.attachTo(this.grid.table.getCellByCellModel(cell), cell, true);
|
|
354
|
-
}, 100);
|
|
355
|
-
}
|
|
356
|
-
undo() {
|
|
357
|
-
let cells;
|
|
358
|
-
const [item] = this.grid.history.pop();
|
|
359
|
-
if (!item)
|
|
360
|
-
return;
|
|
361
|
-
switch (item.type) {
|
|
362
|
-
case 'value':
|
|
363
|
-
cells = item.addresses.map(addr => this.model.getCellByA1(addr));
|
|
364
|
-
this.updateCells(cells, item.oldProps, true, true);
|
|
365
|
-
this.grid.rendering.updateCells(cells, true);
|
|
366
|
-
break;
|
|
367
|
-
case 'insert_column':
|
|
368
|
-
item.newValues.forEach((_, i) => this.grid.editing.deleteColumns({
|
|
369
|
-
index: decodeColumn(item.addresses[i]),
|
|
370
|
-
count: 1,
|
|
371
|
-
dispatchEvent: true,
|
|
372
|
-
fromHistory: true
|
|
373
|
-
}));
|
|
374
|
-
break;
|
|
375
|
-
case 'insert_row':
|
|
376
|
-
item.newValues.forEach((_, i) => this.grid.editing.deleteRows({
|
|
377
|
-
index: decodeRow(item.addresses[i]),
|
|
378
|
-
count: 1,
|
|
379
|
-
dispatchEvent: true,
|
|
380
|
-
fromHistory: true
|
|
381
|
-
}));
|
|
382
|
-
break;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
redo() {
|
|
386
|
-
let cells;
|
|
387
|
-
const [item] = this.grid.history.pop2();
|
|
388
|
-
if (!item)
|
|
389
|
-
return;
|
|
390
|
-
switch (item.type) {
|
|
391
|
-
case 'value':
|
|
392
|
-
cells = item.addresses.map(addr => this.model.getCellByA1(addr));
|
|
393
|
-
this.updateCells(cells, item.newValues, true, true);
|
|
394
|
-
this.grid.rendering.updateCells(cells, true);
|
|
395
|
-
break;
|
|
396
|
-
case 'insert_column':
|
|
397
|
-
item.newValues.forEach((_, i) => this.grid.editing.insertColumns({
|
|
398
|
-
index: decodeColumn(item.addresses[i]),
|
|
399
|
-
count: 1,
|
|
400
|
-
dispatchEvent: true,
|
|
401
|
-
fromHistory: true
|
|
402
|
-
}));
|
|
403
|
-
break;
|
|
404
|
-
case 'insert_row':
|
|
405
|
-
item.newValues.forEach((_, i) => this.grid.editing.insertRows({
|
|
406
|
-
index: decodeRow(item.addresses[i]),
|
|
407
|
-
count: 1,
|
|
408
|
-
dispatchEvent: true,
|
|
409
|
-
fromHistory: true
|
|
410
|
-
}));
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
startColumnMoving(_c) {
|
|
415
|
-
this.columnMoving = true;
|
|
416
|
-
}
|
|
417
|
-
merge(range) {
|
|
418
|
-
const r = range ? CellRange.fromA1(range) : this.selection.range;
|
|
419
|
-
const cell = this.model.rows[r.r1]?.cell(r.c1);
|
|
420
|
-
if (!cell)
|
|
421
|
-
return;
|
|
422
|
-
this.model.merges.add({ r: r.r1, c: r.c1, rs: r.size.rows, cs: r.size.columns });
|
|
423
|
-
this.grid.rendering.renderCells({ vertical: true, horizontal: true });
|
|
424
|
-
this.grid.selecting.select(r);
|
|
425
|
-
}
|
|
426
|
-
unmerge(range) {
|
|
427
|
-
const r = range ? CellRange.fromA1(range) : this.selection.range;
|
|
428
|
-
const cell = this.model.rows[r.r1]?.cell(r.c1);
|
|
429
|
-
if (!cell)
|
|
430
|
-
return;
|
|
431
|
-
const merge = this.model.merges.mergedCells.get(cell.address);
|
|
432
|
-
if (!merge)
|
|
433
|
-
return;
|
|
434
|
-
this.model.merges.remove(cell.address);
|
|
435
|
-
this.grid.rendering.renderCells({ vertical: true, horizontal: true });
|
|
436
|
-
this.grid.selecting.select(new CellRange(merge.c, merge.r, merge.c + merge.cs - 1, merge.r + merge.rs - 1));
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
//# sourceMappingURL=grid.editing.js.map
|