@revolist/revogrid 3.2.4 → 3.2.7
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/custom-element/index.js +29217 -0
- package/custom-element/resize-observer.js +503 -0
- package/dist/cjs/css-shim-9f5bc84d.js +9 -0
- package/dist/cjs/debounce-6cea2774.js +578 -0
- package/dist/cjs/dom-fcb646f0.js +78 -0
- package/dist/{revo-grid/index-8a604c17.js → cjs/index-cb904e00.js} +230 -1445
- package/dist/cjs/index.cjs.js +5 -0
- package/dist/cjs/loader.cjs.js +38 -0
- package/dist/cjs/resize-observer-bf327d6a.js +507 -0
- package/dist/cjs/revo-grid.cjs.js +79 -0
- package/dist/cjs/revo-grid_11.cjs.entry.js +28301 -0
- package/dist/cjs/revogr-clipboard.cjs.entry.js +56 -0
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +278 -0
- package/dist/collection/collection-manifest.json +25 -0
- package/dist/collection/components/button/button.js +7 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js +124 -0
- package/dist/collection/components/data/cellRenderer.js +27 -0
- package/dist/{revo-grid/columnService-91e552ba.js → collection/components/data/columnService.js} +6 -8
- package/dist/collection/components/data/revogr-data-style.css +135 -0
- package/dist/collection/components/data/revogr-data.js +325 -0
- package/dist/collection/components/data/rowRenderer.js +9 -0
- package/dist/collection/components/header/headerCellRenderer.js +29 -0
- package/dist/collection/components/header/headerRenderer.js +48 -0
- package/dist/collection/components/header/revogr-header-style.css +198 -0
- package/dist/collection/components/header/revogr-header.js +300 -0
- package/dist/collection/components/order/orderRenderer.js +53 -0
- package/dist/collection/components/order/revogr-order-editor.js +361 -0
- package/dist/collection/components/order/rowOrderService.js +71 -0
- package/dist/collection/components/overlay/autofill.service.js +185 -0
- package/dist/collection/components/overlay/clipboard.service.js +42 -0
- package/dist/collection/components/overlay/editors/edit.utils.js +8 -0
- package/dist/collection/components/overlay/editors/text.js +38 -0
- package/dist/collection/components/overlay/keyboard.service.js +131 -0
- package/dist/collection/components/overlay/revogr-edit-style.css +86 -0
- package/dist/collection/components/overlay/revogr-edit.js +162 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +729 -0
- package/dist/collection/components/overlay/revogr-overlay-style.css +98 -0
- package/dist/{revo-grid/selection.utils-a9932db6.js → collection/components/overlay/selection.utils.js} +9 -12
- package/dist/collection/components/revo-grid/revo-grid-style.css +544 -0
- package/dist/collection/components/revo-grid/revo-grid.js +2226 -0
- package/dist/collection/components/revo-grid/viewport.helpers.js +14 -0
- package/dist/collection/components/revo-grid/viewport.interfaces.js +4 -0
- package/dist/collection/components/revo-grid/viewport.js +21 -0
- package/dist/collection/components/revo-grid/viewport.resize.service.js +24 -0
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js +63 -0
- package/dist/collection/components/revo-grid/viewport.section.js +31 -0
- package/dist/collection/components/revo-grid/viewport.service.js +212 -0
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +213 -0
- package/dist/collection/components/rowHeaders/row-header-render.js +4 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +137 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +402 -0
- package/dist/collection/components/scrollable/revogr-scroll-style.css +104 -0
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +256 -0
- package/dist/collection/components/selection-focus/revogr-focus-style.css +77 -0
- package/dist/collection/components/selection-focus/revogr-focus.js +106 -0
- package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +98 -0
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js +141 -0
- package/dist/{revo-grid/app-globals-7e6866ba.js → collection/global/global.js} +2 -8
- package/dist/collection/index.js +4 -0
- package/dist/collection/plugins/autoSizeColumn.js +233 -0
- package/dist/collection/plugins/basePlugin.js +30 -0
- package/dist/{revo-grid/dispatcher-891af82e.js → collection/plugins/dispatcher.js} +2 -4
- package/dist/collection/plugins/export/csv.js +71 -0
- package/dist/collection/plugins/export/export.plugin.js +168 -0
- package/dist/collection/plugins/export/types.js +4 -0
- package/dist/collection/plugins/filter/conditions/equal.js +20 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +13 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +10 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +15 -0
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +10 -0
- package/dist/collection/plugins/filter/conditions/set.js +6 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +20 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js +21 -0
- package/dist/{revo-grid/filter.button-74c1cd9c.js → collection/plugins/filter/filter.button.js} +10 -13
- package/dist/collection/plugins/filter/filter.plugin.js +259 -0
- package/dist/collection/plugins/filter/filter.pop.js +488 -0
- package/dist/collection/plugins/filter/filter.service.js +47 -0
- package/dist/collection/plugins/filter/filter.style.css +239 -0
- package/dist/collection/plugins/filter/filter.types.js +4 -0
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +33 -0
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +39 -0
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +24 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js +13 -0
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +79 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +261 -0
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +32 -0
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +4 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js +158 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +60 -0
- package/dist/collection/plugins/moveColumn/columnDragPlugin.js +151 -0
- package/dist/collection/plugins/moveColumn/columnOrderHandler.js +63 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js +184 -0
- package/dist/collection/plugins/sorting/sorting.sign.js +9 -0
- package/dist/collection/plugins/stretchPlugin.js +71 -0
- package/dist/collection/plugins/trimmed/trimmed.plugin.js +35 -0
- package/dist/collection/services/cell.helpers.js +10 -0
- package/dist/collection/services/column.data.provider.js +191 -0
- package/dist/collection/services/data.provider.js +50 -0
- package/dist/collection/services/dimension.provider.js +81 -0
- package/dist/{revo-grid/localScrollService-e9b73323.js → collection/services/localScrollService.js} +2 -5
- package/dist/collection/services/resizable.directive.js +255 -0
- package/dist/collection/services/selection.store.connector.js +216 -0
- package/dist/collection/services/viewport.provider.js +17 -0
- package/dist/collection/store/dataSource/data.proxy.js +37 -0
- package/dist/collection/store/dataSource/data.store.js +130 -0
- package/dist/collection/store/dimension/dimension.helpers.js +110 -0
- package/dist/collection/store/dimension/dimension.store.js +62 -0
- package/dist/collection/store/selection/selection.helpers.js +56 -0
- package/dist/collection/store/selection/selection.store.js +71 -0
- package/dist/collection/store/selection/selection.store.service.js +38 -0
- package/dist/collection/store/storeTypes.js +8 -0
- package/dist/{revo-grid/viewport.store-ffaaab6d.js → collection/store/viewPort/viewport.helpers.js} +9 -132
- package/dist/collection/store/viewPort/viewport.store.js +124 -0
- package/dist/collection/themeManager/theme.compact.js +8 -0
- package/dist/collection/themeManager/theme.default.js +8 -0
- package/dist/collection/themeManager/theme.material.js +8 -0
- package/dist/{revo-grid/themeService-ddaaa364.js → collection/themeManager/themeService.js} +6 -23
- package/dist/collection/utils/closestPolifill.js +21 -0
- package/dist/collection/utils/consts.js +22 -0
- package/dist/collection/utils/generateAlphabetHeader.js +23 -0
- package/dist/collection/utils/keyCodes.js +73 -0
- package/dist/collection/utils/keyCodes.utils.js +67 -0
- package/dist/collection/utils/platform.js +8 -0
- package/dist/collection/utils/resizeObserver.js +9 -0
- package/dist/collection/utils/store.utils.js +10 -0
- package/dist/{revo-grid/utils-2c3b3857.js → collection/utils/utils.js} +8 -10
- package/dist/collection/utilsExternal/generate-data.js +132 -0
- package/dist/esm/css-shim-e1e1ea5e.js +7 -0
- package/dist/esm/debounce-e4e6dd45.js +561 -0
- package/dist/esm/dom-21bd1807.js +76 -0
- package/dist/esm/index-6f753b3c.js +1817 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/loader.js +34 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/resize-observer-00c48d78.js +503 -0
- package/dist/esm/revo-grid.js +77 -0
- package/dist/{revo-grid/lodash-a0ab4cdd.js → esm/revo-grid_11.entry.js} +25351 -14282
- package/dist/esm/revogr-clipboard.entry.js +52 -0
- package/dist/esm/revogr-filter-panel.entry.js +274 -0
- package/dist/esm-es5/css-shim-e1e1ea5e.js +4 -0
- package/dist/esm-es5/debounce-e4e6dd45.js +4 -0
- package/dist/esm-es5/dom-21bd1807.js +24 -0
- package/dist/esm-es5/index-6f753b3c.js +4 -0
- package/dist/esm-es5/index.js +3 -0
- package/dist/esm-es5/loader.js +4 -0
- package/dist/esm-es5/resize-observer-00c48d78.js +4 -0
- package/dist/esm-es5/revo-grid.js +4 -0
- package/dist/esm-es5/revo-grid_11.entry.js +4 -0
- package/dist/esm-es5/revogr-clipboard.entry.js +4 -0
- package/dist/esm-es5/revogr-filter-panel.entry.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/revo-grid/css-shim-bcf89cc0.system.js +4 -0
- package/dist/revo-grid/css-shim-e1e1ea5e.js +4 -0
- package/dist/revo-grid/debounce-5a33c710.system.js +4 -0
- package/dist/revo-grid/debounce-726bdadb.js +4 -0
- package/dist/revo-grid/dom-21bd1807.js +5 -59
- package/dist/revo-grid/dom-726246e2.system.js +24 -0
- package/dist/revo-grid/index-f14b41a0.system.js +5 -0
- package/dist/revo-grid/index-f30d1de1.js +5 -0
- package/dist/revo-grid/index.system.js +4 -0
- package/dist/revo-grid/resize-observer-00c48d78.js +1 -500
- package/dist/revo-grid/resize-observer-8af0bc0e.system.js +4 -0
- package/dist/revo-grid/revo-grid.esm.js +1 -130
- package/dist/revo-grid/revo-grid.js +133 -0
- package/dist/revo-grid/revo-grid.system.js +4 -0
- package/dist/revo-grid/revo-grid_11.entry.js +4 -0
- package/dist/revo-grid/revo-grid_11.system.entry.js +4 -0
- package/dist/revo-grid/revogr-clipboard.entry.js +1 -49
- package/dist/revo-grid/revogr-clipboard.system.entry.js +4 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -274
- package/dist/revo-grid/revogr-filter-panel.system.entry.js +4 -0
- package/dist/types/components/revo-grid/revo-grid.d.ts +0 -1
- package/dist/types/components.d.ts +2 -2
- package/loader/cdn.js +3 -1
- package/loader/index.cjs.js +3 -1
- package/loader/index.d.ts +0 -1
- package/loader/index.es2017.js +3 -1
- package/loader/index.js +3 -1
- package/package.json +1 -1
- package/dist/revo-grid/_baseIteratee-af30b221.js +0 -2070
- package/dist/revo-grid/consts-ef824e6f.js +0 -46
- package/dist/revo-grid/css-shim-5387c708.js +0 -7
- package/dist/revo-grid/data.store-3263fff9.js +0 -557
- package/dist/revo-grid/debounce-aaa4b4da.js +0 -217
- package/dist/revo-grid/dimension.helpers-a7944fc4.js +0 -340
- package/dist/revo-grid/each-0378e5a3.js +0 -180
- package/dist/revo-grid/identity-c8c7d3d8.js +0 -26
- package/dist/revo-grid/isString-a51066b5.js +0 -34
- package/dist/revo-grid/isSymbol-e4b5dafe.js +0 -247
- package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +0 -299
- package/dist/revo-grid/keys-70b7c240.js +0 -561
- package/dist/revo-grid/revo-grid.entry.js +0 -3484
- package/dist/revo-grid/revogr-data.entry.js +0 -152
- package/dist/revo-grid/revogr-edit.entry.js +0 -105
- package/dist/revo-grid/revogr-focus.entry.js +0 -41
- package/dist/revo-grid/revogr-header.entry.js +0 -560
- package/dist/revo-grid/revogr-order-editor.entry.js +0 -175
- package/dist/revo-grid/revogr-overlay-selection.entry.js +0 -711
- package/dist/revo-grid/revogr-row-headers.entry.js +0 -73
- package/dist/revo-grid/revogr-scroll-virtual.entry.js +0 -114
- package/dist/revo-grid/revogr-temp-range.entry.js +0 -73
- package/dist/revo-grid/revogr-viewport-scroll.entry.js +0 -340
- package/dist/revo-grid/selection.store.connector-2b613fd0.js +0 -503
- package/dist/revo-grid/shadow-css-602a09db.js +0 -390
- package/dist/revo-grid/toInteger-9e6cbfd2.js +0 -107
- package/dist/revo-grid/toNumber-913b0b72.js +0 -105
- package/dist/revo-grid/viewport.helpers-49d3f031.js +0 -16
|
@@ -1,711 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by Revolist
|
|
3
|
-
*/
|
|
4
|
-
import { h, r as registerInstance, e as createEvent, f as Host, g as getElement } from './index-8a604c17.js';
|
|
5
|
-
import { C as ColumnService } from './columnService-91e552ba.js';
|
|
6
|
-
import { l as getRange, m as isRangeSingleCell } from './selection.store.connector-2b613fd0.js';
|
|
7
|
-
import { i as isCtrlKey, c as codesLetter, a as isClear, b as isEnterKey, d as isLetterKey } from './keyCodes.utils-bd06e3ba.js';
|
|
8
|
-
import { E as EDIT_INPUT_WR, C as CELL_HANDLER_CLASS, S as SELECTION_BORDER_CLASS } from './consts-ef824e6f.js';
|
|
9
|
-
import { a as getCoordinate, i as isAfterLast, b as isBeforeFirst, c as getCell, d as getCurrentCell, e as getDirectionCoordinate, f as getLargestAxis, g as getElStyle } from './selection.utils-a9932db6.js';
|
|
10
|
-
import { t as timeout } from './utils-2c3b3857.js';
|
|
11
|
-
import { d as debounce_1 } from './debounce-aaa4b4da.js';
|
|
12
|
-
import { e as each } from './each-0378e5a3.js';
|
|
13
|
-
import { _ as _isIterateeCall, g as getSourceItem } from './data.store-3263fff9.js';
|
|
14
|
-
import { t as toInteger_1 } from './toInteger-9e6cbfd2.js';
|
|
15
|
-
import './keys-70b7c240.js';
|
|
16
|
-
import './isSymbol-e4b5dafe.js';
|
|
17
|
-
import './isString-a51066b5.js';
|
|
18
|
-
import './dimension.helpers-a7944fc4.js';
|
|
19
|
-
import './identity-c8c7d3d8.js';
|
|
20
|
-
import './_baseIteratee-af30b221.js';
|
|
21
|
-
import './toNumber-913b0b72.js';
|
|
22
|
-
|
|
23
|
-
class SelectionStoreService {
|
|
24
|
-
constructor(store, config) {
|
|
25
|
-
this.store = store;
|
|
26
|
-
this.config = config;
|
|
27
|
-
this.store = store;
|
|
28
|
-
}
|
|
29
|
-
get edited() {
|
|
30
|
-
return this.store.get('edit');
|
|
31
|
-
}
|
|
32
|
-
get focused() {
|
|
33
|
-
return this.store.get('focus');
|
|
34
|
-
}
|
|
35
|
-
get ranged() {
|
|
36
|
-
return this.store.get('range');
|
|
37
|
-
}
|
|
38
|
-
changeRange(range) {
|
|
39
|
-
return this.config.changeRange(range);
|
|
40
|
-
}
|
|
41
|
-
focus(cell, isMulti = false) {
|
|
42
|
-
if (!cell) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
let end = cell;
|
|
46
|
-
// range edit
|
|
47
|
-
if (isMulti) {
|
|
48
|
-
let start = this.store.get('focus');
|
|
49
|
-
if (start) {
|
|
50
|
-
return this.config.changeRange(getRange(start, end));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// single focus
|
|
54
|
-
return this.config.focus(cell, end);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// is edit input
|
|
59
|
-
function isEditInput(el) {
|
|
60
|
-
return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
class KeyboardService {
|
|
64
|
-
constructor(sv) {
|
|
65
|
-
this.sv = sv;
|
|
66
|
-
this.ctrlDown = false;
|
|
67
|
-
}
|
|
68
|
-
async keyDown(e, canRange) {
|
|
69
|
-
if (!this.sv.selectionStoreService.focused) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (isCtrlKey(e.keyCode, navigator.platform)) {
|
|
73
|
-
this.ctrlDown = true;
|
|
74
|
-
}
|
|
75
|
-
// tab key means same as arrow right
|
|
76
|
-
if (codesLetter.TAB === e.code) {
|
|
77
|
-
this.keyChangeSelection(e, canRange);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* IF EDIT MODE
|
|
82
|
-
*/
|
|
83
|
-
if (this.sv.selectionStoreService.edited) {
|
|
84
|
-
switch (e.code) {
|
|
85
|
-
case codesLetter.ESCAPE:
|
|
86
|
-
this.sv.doEdit(undefined, true);
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* IF NOT EDIT MODE
|
|
93
|
-
*/
|
|
94
|
-
// pressed clear key
|
|
95
|
-
if (isClear(e.code)) {
|
|
96
|
-
this.sv.clearCell();
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
// pressed enter
|
|
100
|
-
if (isEnterKey(e.code)) {
|
|
101
|
-
this.sv.doEdit();
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
// copy operation
|
|
105
|
-
if (this.isCopy(e)) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
// paste operation
|
|
109
|
-
if (this.isPaste(e)) {
|
|
110
|
-
this.sv.internalPaste();
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
// pressed letter key
|
|
114
|
-
if (isLetterKey(e.keyCode)) {
|
|
115
|
-
this.sv.doEdit(e.key);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
// pressed arrow, change selection position
|
|
119
|
-
if (await this.keyChangeSelection(e, canRange)) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
async keyChangeSelection(e, canRange) {
|
|
124
|
-
const data = this.changeDirectionKey(e, canRange);
|
|
125
|
-
if (!data) {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
await timeout();
|
|
129
|
-
const range = this.sv.selectionStore.get('range');
|
|
130
|
-
const focus = this.sv.selectionStore.get('focus');
|
|
131
|
-
return this.keyPositionChange(data.changes, this.sv.getData(), range, focus, data.isMulti);
|
|
132
|
-
}
|
|
133
|
-
keyPositionChange(changes, eData, range, focus, isMulti = false) {
|
|
134
|
-
if (!range || !focus) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
const data = getCoordinate(range, focus, changes, isMulti);
|
|
138
|
-
if (!data) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
if (isMulti) {
|
|
142
|
-
if (isAfterLast(data.end, eData) || isBeforeFirst(data.start)) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
const range = getRange(data.start, data.end);
|
|
146
|
-
return this.sv.selectionStoreService.changeRange(range);
|
|
147
|
-
}
|
|
148
|
-
return this.sv.selectionStoreService.focus(data.start);
|
|
149
|
-
}
|
|
150
|
-
keyUp(e) {
|
|
151
|
-
if (isCtrlKey(e.keyCode, navigator.platform)) {
|
|
152
|
-
this.ctrlDown = false;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
isCopy(e) {
|
|
156
|
-
return this.ctrlDown && e.code == codesLetter.C;
|
|
157
|
-
}
|
|
158
|
-
isPaste(e) {
|
|
159
|
-
return this.ctrlDown && e.code == codesLetter.V;
|
|
160
|
-
}
|
|
161
|
-
/** Monitor key direction changes */
|
|
162
|
-
changeDirectionKey(e, canRange) {
|
|
163
|
-
const isMulti = canRange && e.shiftKey;
|
|
164
|
-
switch (e.code) {
|
|
165
|
-
case codesLetter.TAB:
|
|
166
|
-
case codesLetter.ARROW_UP:
|
|
167
|
-
case codesLetter.ARROW_DOWN:
|
|
168
|
-
case codesLetter.ARROW_LEFT:
|
|
169
|
-
case codesLetter.ARROW_RIGHT:
|
|
170
|
-
e.preventDefault();
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
switch (e.code) {
|
|
174
|
-
case codesLetter.ARROW_UP:
|
|
175
|
-
return { changes: { y: -1 }, isMulti };
|
|
176
|
-
case codesLetter.ARROW_DOWN:
|
|
177
|
-
return { changes: { y: 1 }, isMulti };
|
|
178
|
-
case codesLetter.ARROW_LEFT:
|
|
179
|
-
return { changes: { x: -1 }, isMulti };
|
|
180
|
-
case codesLetter.TAB:
|
|
181
|
-
case codesLetter.ARROW_RIGHT:
|
|
182
|
-
return { changes: { x: 1 }, isMulti };
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* The base implementation of `_.slice` without an iteratee call guard.
|
|
189
|
-
*
|
|
190
|
-
* @private
|
|
191
|
-
* @param {Array} array The array to slice.
|
|
192
|
-
* @param {number} [start=0] The start position.
|
|
193
|
-
* @param {number} [end=array.length] The end position.
|
|
194
|
-
* @returns {Array} Returns the slice of `array`.
|
|
195
|
-
*/
|
|
196
|
-
function baseSlice(array, start, end) {
|
|
197
|
-
var index = -1,
|
|
198
|
-
length = array.length;
|
|
199
|
-
|
|
200
|
-
if (start < 0) {
|
|
201
|
-
start = -start > length ? 0 : (length + start);
|
|
202
|
-
}
|
|
203
|
-
end = end > length ? length : end;
|
|
204
|
-
if (end < 0) {
|
|
205
|
-
end += length;
|
|
206
|
-
}
|
|
207
|
-
length = start > end ? 0 : ((end - start) >>> 0);
|
|
208
|
-
start >>>= 0;
|
|
209
|
-
|
|
210
|
-
var result = Array(length);
|
|
211
|
-
while (++index < length) {
|
|
212
|
-
result[index] = array[index + start];
|
|
213
|
-
}
|
|
214
|
-
return result;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
var _baseSlice = baseSlice;
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
221
|
-
*
|
|
222
|
-
* **Note:** This method is used instead of
|
|
223
|
-
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
|
224
|
-
* returned.
|
|
225
|
-
*
|
|
226
|
-
* @static
|
|
227
|
-
* @memberOf _
|
|
228
|
-
* @since 3.0.0
|
|
229
|
-
* @category Array
|
|
230
|
-
* @param {Array} array The array to slice.
|
|
231
|
-
* @param {number} [start=0] The start position.
|
|
232
|
-
* @param {number} [end=array.length] The end position.
|
|
233
|
-
* @returns {Array} Returns the slice of `array`.
|
|
234
|
-
*/
|
|
235
|
-
function slice(array, start, end) {
|
|
236
|
-
var length = array == null ? 0 : array.length;
|
|
237
|
-
if (!length) {
|
|
238
|
-
return [];
|
|
239
|
-
}
|
|
240
|
-
if (end && typeof end != 'number' && _isIterateeCall(array, start, end)) {
|
|
241
|
-
start = 0;
|
|
242
|
-
end = length;
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
start = start == null ? 0 : toInteger_1(start);
|
|
246
|
-
end = end === undefined ? length : toInteger_1(end);
|
|
247
|
-
}
|
|
248
|
-
return _baseSlice(array, start, end);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
var slice_1 = slice;
|
|
252
|
-
|
|
253
|
-
var AutoFillType;
|
|
254
|
-
(function (AutoFillType) {
|
|
255
|
-
AutoFillType["selection"] = "Selection";
|
|
256
|
-
AutoFillType["autoFill"] = "AutoFill";
|
|
257
|
-
})(AutoFillType || (AutoFillType = {}));
|
|
258
|
-
class AutoFillService {
|
|
259
|
-
constructor(sv) {
|
|
260
|
-
this.sv = sv;
|
|
261
|
-
this.autoFillType = null;
|
|
262
|
-
this.autoFillInitial = null;
|
|
263
|
-
this.autoFillStart = null;
|
|
264
|
-
this.autoFillLast = null;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Render autofill box
|
|
268
|
-
* @param range
|
|
269
|
-
* @param selectionFocus
|
|
270
|
-
*/
|
|
271
|
-
renderAutofill(range, selectionFocus) {
|
|
272
|
-
let handlerStyle;
|
|
273
|
-
if (range) {
|
|
274
|
-
handlerStyle = getCell(range, this.sv.dimensionRow.state, this.sv.dimensionCol.state);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
handlerStyle = getCell(Object.assign(Object.assign({}, selectionFocus), { x1: selectionFocus.x, y1: selectionFocus.y }), this.sv.dimensionRow.state, this.sv.dimensionCol.state);
|
|
278
|
-
}
|
|
279
|
-
return (h("div", { class: CELL_HANDLER_CLASS, style: { left: `${handlerStyle.right}px`, top: `${handlerStyle.bottom}px` }, onMouseDown: (e) => this.selectionStart(e, this.sv.getData(), AutoFillType.autoFill) }));
|
|
280
|
-
}
|
|
281
|
-
get isAutoFill() {
|
|
282
|
-
return !!this.autoFillType;
|
|
283
|
-
}
|
|
284
|
-
/** Process mouse move events */
|
|
285
|
-
selectionMouseMove(e) {
|
|
286
|
-
// initiate mouse move debounce if not present
|
|
287
|
-
if (!this.onMouseMoveAutofill) {
|
|
288
|
-
this.onMouseMoveAutofill = debounce_1((e, data) => this.doAutofillMouseMove(e, data), 5);
|
|
289
|
-
}
|
|
290
|
-
if (this.isAutoFill) {
|
|
291
|
-
this.onMouseMoveAutofill(e, this.sv.getData());
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
getFocus() {
|
|
295
|
-
let focus = this.sv.selectionStoreService.focused;
|
|
296
|
-
const range = this.sv.selectionStoreService.ranged;
|
|
297
|
-
if (range) {
|
|
298
|
-
focus = { x: range.x, y: range.y };
|
|
299
|
-
}
|
|
300
|
-
if (!focus && !range) {
|
|
301
|
-
return null;
|
|
302
|
-
}
|
|
303
|
-
return focus;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Autofill logic:
|
|
307
|
-
* on mouse move apply based on previous direction (if present)
|
|
308
|
-
*/
|
|
309
|
-
doAutofillMouseMove({ x, y }, data) {
|
|
310
|
-
if (!this.autoFillInitial) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
let current = getCurrentCell({ x, y }, data);
|
|
314
|
-
let direction;
|
|
315
|
-
if (this.autoFillLast) {
|
|
316
|
-
direction = getDirectionCoordinate(this.autoFillStart, this.autoFillLast);
|
|
317
|
-
}
|
|
318
|
-
// first time or direction equal to start(same as first time)
|
|
319
|
-
if (!this.autoFillLast || !direction) {
|
|
320
|
-
direction = getLargestAxis(this.autoFillStart, current);
|
|
321
|
-
if (!this.autoFillLast) {
|
|
322
|
-
this.autoFillLast = this.autoFillStart;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
// nothing changed
|
|
326
|
-
if (!direction) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
each(direction, (v, k) => {
|
|
330
|
-
if (v) {
|
|
331
|
-
current = Object.assign(Object.assign({}, this.autoFillLast), { [k]: current[k] });
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
// check if not the latest
|
|
335
|
-
if (isAfterLast(current, data)) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
this.autoFillLast = current;
|
|
339
|
-
this.sv.setTempRange({
|
|
340
|
-
area: getRange(this.autoFillInitial, this.autoFillLast),
|
|
341
|
-
type: this.autoFillType,
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Range selection started
|
|
346
|
-
* Mode @param type:
|
|
347
|
-
* Can be triggered from MouseDown selection on element
|
|
348
|
-
* Or can be triggered on corner square drag
|
|
349
|
-
*/
|
|
350
|
-
selectionStart(e, data, type = AutoFillType.selection) {
|
|
351
|
-
/** Get cell by autofill element */
|
|
352
|
-
const { top, left } = e.target.getBoundingClientRect();
|
|
353
|
-
this.autoFillInitial = this.getFocus();
|
|
354
|
-
this.autoFillType = type;
|
|
355
|
-
this.autoFillStart = getCurrentCell({ x: left, y: top }, data);
|
|
356
|
-
e.preventDefault();
|
|
357
|
-
}
|
|
358
|
-
/** Clear current range selection */
|
|
359
|
-
clearAutoFillSelection() {
|
|
360
|
-
// Apply autofill values on mouse up
|
|
361
|
-
if (this.autoFillInitial) {
|
|
362
|
-
// Get latest
|
|
363
|
-
this.autoFillInitial = this.getFocus();
|
|
364
|
-
if (this.autoFillType === AutoFillType.autoFill) {
|
|
365
|
-
this.applyRangeWithData(this.autoFillInitial, this.autoFillLast);
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
this.applyRangeOnly(this.autoFillInitial, this.autoFillLast);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
this.autoFillType = null;
|
|
372
|
-
this.autoFillInitial = null;
|
|
373
|
-
this.autoFillLast = null;
|
|
374
|
-
this.autoFillStart = null;
|
|
375
|
-
}
|
|
376
|
-
/** Trigger range apply events and handle responses */
|
|
377
|
-
onRangeApply(data, range) {
|
|
378
|
-
const models = {};
|
|
379
|
-
for (let rowIndex in data) {
|
|
380
|
-
models[rowIndex] = getSourceItem(this.sv.dataStore, parseInt(rowIndex, 10));
|
|
381
|
-
}
|
|
382
|
-
const dataEvent = this.sv.internalRangeDataApply({
|
|
383
|
-
data,
|
|
384
|
-
models,
|
|
385
|
-
type: this.sv.dataStore.get('type'),
|
|
386
|
-
});
|
|
387
|
-
if (!dataEvent.defaultPrevented) {
|
|
388
|
-
this.sv.columnService.applyRangeData(data);
|
|
389
|
-
}
|
|
390
|
-
this.sv.setRange(range);
|
|
391
|
-
}
|
|
392
|
-
/** Apply range and copy data during range application */
|
|
393
|
-
applyRangeWithData(start, end) {
|
|
394
|
-
// no changes to apply
|
|
395
|
-
if (!start || !end) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
const oldRange = this.sv.selectionStoreService.ranged;
|
|
399
|
-
const newRange = getRange(start, end);
|
|
400
|
-
const columns = [...this.sv.columnService.columns];
|
|
401
|
-
const rangeData = {
|
|
402
|
-
type: this.sv.dataStore.get('type'),
|
|
403
|
-
newData: {},
|
|
404
|
-
newRange,
|
|
405
|
-
oldRange,
|
|
406
|
-
newProps: slice_1(columns, newRange.x, newRange.x1 + 1).map(v => v.prop),
|
|
407
|
-
oldProps: slice_1(columns, oldRange.x, oldRange.x1 + 1).map(v => v.prop),
|
|
408
|
-
};
|
|
409
|
-
rangeData.newData = this.sv.columnService.getRangeData(rangeData);
|
|
410
|
-
const selectionEndEvent = this.sv.internalSelectionChanged(rangeData);
|
|
411
|
-
if (selectionEndEvent.defaultPrevented) {
|
|
412
|
-
this.sv.setTempRange(null);
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
this.onRangeApply(rangeData.newData, newRange);
|
|
416
|
-
}
|
|
417
|
-
/** Update range selection ony, no data change (mouse selection) */
|
|
418
|
-
applyRangeOnly(start, end) {
|
|
419
|
-
// no changes to apply
|
|
420
|
-
if (!start || !end) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
const newRange = getRange(start, end);
|
|
424
|
-
this.sv.setRange(newRange);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
class ClipboardService {
|
|
429
|
-
constructor(sv) {
|
|
430
|
-
this.sv = sv;
|
|
431
|
-
}
|
|
432
|
-
onCopy(e) {
|
|
433
|
-
const canCopy = this.sv.internalCopy();
|
|
434
|
-
if (canCopy.defaultPrevented) {
|
|
435
|
-
return false;
|
|
436
|
-
}
|
|
437
|
-
let focus = this.sv.selectionStoreService.focused;
|
|
438
|
-
let range = this.sv.selectionStoreService.ranged;
|
|
439
|
-
let data;
|
|
440
|
-
if (!range) {
|
|
441
|
-
range = getRange(focus, focus);
|
|
442
|
-
}
|
|
443
|
-
if (range) {
|
|
444
|
-
const columns = [...this.sv.columnService.columns];
|
|
445
|
-
const props = slice_1(columns, range.x, range.x1 + 1).map(v => v.prop);
|
|
446
|
-
data = this.sv.columnService.copyRangeArray(range, props, this.sv.dataStore);
|
|
447
|
-
}
|
|
448
|
-
this.clipboard.doCopy(e, data);
|
|
449
|
-
return true;
|
|
450
|
-
}
|
|
451
|
-
renderClipboard() {
|
|
452
|
-
return h("revogr-clipboard", { onCopyRegion: e => this.onCopy(e.detail), ref: e => (this.clipboard = e), onPasteRegion: e => this.onPaste(e.detail) });
|
|
453
|
-
}
|
|
454
|
-
onPaste(data) {
|
|
455
|
-
const focus = this.sv.selectionStoreService.focused;
|
|
456
|
-
const isEditing = this.sv.selectionStoreService.edited !== null;
|
|
457
|
-
if (!focus || isEditing) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
const { changed, range } = this.sv.columnService.getTransformedDataToApply(focus, data);
|
|
461
|
-
this.sv.onRangeApply(changed, range);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
const revogrOverlayStyleCss = ".revo-drag-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 438 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M421.875,70.40625 C426.432292,70.40625 430.175781,68.9414062 433.105469,66.0117188 C436.035156,63.0820312 437.5,59.3385417 437.5,54.78125 L437.5,54.78125 L437.5,15.71875 C437.5,11.1614583 436.035156,7.41796875 433.105469,4.48828125 C430.175781,1.55859375 426.432292,0.09375 421.875,0.09375 L421.875,0.09375 L15.625,0.09375 C11.0677083,0.09375 7.32421875,1.55859375 4.39453125,4.48828125 C1.46484375,7.41796875 0,11.1614583 0,15.71875 L0,15.71875 L0,54.78125 C0,59.3385417 1.46484375,63.0820312 4.39453125,66.0117188 C7.32421875,68.9414062 11.0677083,70.40625 15.625,70.40625 L15.625,70.40625 L421.875,70.40625 Z M421.875,226.65625 C426.432292,226.65625 430.175781,225.191406 433.105469,222.261719 C436.035156,219.332031 437.5,215.588542 437.5,211.03125 L437.5,211.03125 L437.5,171.96875 C437.5,167.411458 436.035156,163.667969 433.105469,160.738281 C430.175781,157.808594 426.432292,156.34375 421.875,156.34375 L421.875,156.34375 L15.625,156.34375 C11.0677083,156.34375 7.32421875,157.808594 4.39453125,160.738281 C1.46484375,163.667969 0,167.411458 0,171.96875 L0,171.96875 L0,211.03125 C0,215.588542 1.46484375,219.332031 4.39453125,222.261719 C7.32421875,225.191406 11.0677083,226.65625 15.625,226.65625 L15.625,226.65625 L421.875,226.65625 Z M421.875,382.90625 C426.432292,382.90625 430.175781,381.441406 433.105469,378.511719 C436.035156,375.582031 437.5,371.838542 437.5,367.28125 L437.5,367.28125 L437.5,328.21875 C437.5,323.661458 436.035156,319.917969 433.105469,316.988281 C430.175781,314.058594 426.432292,312.59375 421.875,312.59375 L421.875,312.59375 L15.625,312.59375 C11.0677083,312.59375 7.32421875,314.058594 4.39453125,316.988281 C1.46484375,319.917969 0,323.661458 0,328.21875 L0,328.21875 L0,367.28125 C0,371.838542 1.46484375,375.582031 4.39453125,378.511719 C7.32421875,381.441406 11.0677083,382.90625 15.625,382.90625 L15.625,382.90625 L421.875,382.90625 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 438 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M421.875,70.40625 C426.432292,70.40625 430.175781,68.9414062 433.105469,66.0117188 C436.035156,63.0820312 437.5,59.3385417 437.5,54.78125 L437.5,54.78125 L437.5,15.71875 C437.5,11.1614583 436.035156,7.41796875 433.105469,4.48828125 C430.175781,1.55859375 426.432292,0.09375 421.875,0.09375 L421.875,0.09375 L15.625,0.09375 C11.0677083,0.09375 7.32421875,1.55859375 4.39453125,4.48828125 C1.46484375,7.41796875 0,11.1614583 0,15.71875 L0,15.71875 L0,54.78125 C0,59.3385417 1.46484375,63.0820312 4.39453125,66.0117188 C7.32421875,68.9414062 11.0677083,70.40625 15.625,70.40625 L15.625,70.40625 L421.875,70.40625 Z M421.875,226.65625 C426.432292,226.65625 430.175781,225.191406 433.105469,222.261719 C436.035156,219.332031 437.5,215.588542 437.5,211.03125 L437.5,211.03125 L437.5,171.96875 C437.5,167.411458 436.035156,163.667969 433.105469,160.738281 C430.175781,157.808594 426.432292,156.34375 421.875,156.34375 L421.875,156.34375 L15.625,156.34375 C11.0677083,156.34375 7.32421875,157.808594 4.39453125,160.738281 C1.46484375,163.667969 0,167.411458 0,171.96875 L0,171.96875 L0,211.03125 C0,215.588542 1.46484375,219.332031 4.39453125,222.261719 C7.32421875,225.191406 11.0677083,226.65625 15.625,226.65625 L15.625,226.65625 L421.875,226.65625 Z M421.875,382.90625 C426.432292,382.90625 430.175781,381.441406 433.105469,378.511719 C436.035156,375.582031 437.5,371.838542 437.5,367.28125 L437.5,367.28125 L437.5,328.21875 C437.5,323.661458 436.035156,319.917969 433.105469,316.988281 C430.175781,314.058594 426.432292,312.59375 421.875,312.59375 L421.875,312.59375 L15.625,312.59375 C11.0677083,312.59375 7.32421875,314.058594 4.39453125,316.988281 C1.46484375,319.917969 0,323.661458 0,328.21875 L0,328.21875 L0,367.28125 C0,371.838542 1.46484375,375.582031 4.39453125,378.511719 C7.32421875,381.441406 11.0677083,382.90625 15.625,382.90625 L15.625,382.90625 L421.875,382.90625 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:7px;background-size:cover;background-repeat:no-repeat}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#2ee072;border:1px solid #20d565}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:2px solid #cedefa;line-height:32px;background:none;color:#4876ca;box-shadow:none}revogr-overlay-selection{display:block;position:relative;width:100%}revogr-overlay-selection .autofill-handle{position:absolute;width:10px;height:10px;background:#0d63e8;margin-left:-9px;margin-top:-9px;border:1px solid white;box-sizing:border-box;z-index:10;cursor:crosshair}revogr-overlay-selection .selection-border-range{position:absolute;pointer-events:none;z-index:9}revogr-overlay-selection .selection-border-range{box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset}revogr-overlay-selection revogr-edit{z-index:10}";
|
|
466
|
-
|
|
467
|
-
const OverlaySelection = class {
|
|
468
|
-
constructor(hostRef) {
|
|
469
|
-
registerInstance(this, hostRef);
|
|
470
|
-
this.internalCopy = createEvent(this, "internalCopy", 7);
|
|
471
|
-
this.internalPaste = createEvent(this, "internalPaste", 7);
|
|
472
|
-
this.internalCellEdit = createEvent(this, "internalCellEdit", 7);
|
|
473
|
-
this.internalFocusCell = createEvent(this, "internalFocusCell", 7);
|
|
474
|
-
this.setEdit = createEvent(this, "setEdit", 3);
|
|
475
|
-
this.setRange = createEvent(this, "setRange", 7);
|
|
476
|
-
this.setTempRange = createEvent(this, "setTempRange", 7);
|
|
477
|
-
this.focusCell = createEvent(this, "focusCell", 3);
|
|
478
|
-
this.internalSelectionChanged = createEvent(this, "internalSelectionChanged", 7);
|
|
479
|
-
this.internalRangeDataApply = createEvent(this, "internalRangeDataApply", 7);
|
|
480
|
-
this.keyboardService = null;
|
|
481
|
-
this.autoFillService = null;
|
|
482
|
-
this.clipboardService = null;
|
|
483
|
-
}
|
|
484
|
-
// --------------------------------------------------------------------------
|
|
485
|
-
//
|
|
486
|
-
// Listeners
|
|
487
|
-
//
|
|
488
|
-
// --------------------------------------------------------------------------
|
|
489
|
-
onMouseMove(e) {
|
|
490
|
-
if (this.selectionStoreService.focused) {
|
|
491
|
-
this.autoFillService.selectionMouseMove(e);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
/** Pointer left document, clear any active operation */
|
|
495
|
-
onMouseOut() {
|
|
496
|
-
this.autoFillService.clearAutoFillSelection();
|
|
497
|
-
}
|
|
498
|
-
/** Action finished inside of the document */
|
|
499
|
-
onMouseUp() {
|
|
500
|
-
this.autoFillService.clearAutoFillSelection();
|
|
501
|
-
}
|
|
502
|
-
/** Row drag started */
|
|
503
|
-
onCellDrag(e) {
|
|
504
|
-
var _a;
|
|
505
|
-
(_a = this.orderEditor) === null || _a === void 0 ? void 0 : _a.dragStart(e.detail);
|
|
506
|
-
}
|
|
507
|
-
/** Recived keyboard down from element */
|
|
508
|
-
onKeyUp(e) {
|
|
509
|
-
var _a;
|
|
510
|
-
(_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyUp(e);
|
|
511
|
-
}
|
|
512
|
-
/** Recived keyboard down from element */
|
|
513
|
-
onKeyDown(e) {
|
|
514
|
-
var _a;
|
|
515
|
-
if (e.defaultPrevented) {
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
(_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range);
|
|
519
|
-
}
|
|
520
|
-
/** Create selection store */
|
|
521
|
-
selectionServiceSet(s) {
|
|
522
|
-
this.selectionStoreService = new SelectionStoreService(s, {
|
|
523
|
-
changeRange: range => { var _a; return !((_a = this.setRange.emit(range)) === null || _a === void 0 ? void 0 : _a.defaultPrevented); },
|
|
524
|
-
focus: (focus, end) => {
|
|
525
|
-
var _a;
|
|
526
|
-
const focused = { focus, end };
|
|
527
|
-
const { defaultPrevented } = this.internalFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
528
|
-
if (defaultPrevented) {
|
|
529
|
-
return false;
|
|
530
|
-
}
|
|
531
|
-
return !((_a = this.focusCell.emit(focused)) === null || _a === void 0 ? void 0 : _a.defaultPrevented);
|
|
532
|
-
},
|
|
533
|
-
});
|
|
534
|
-
this.keyboardService = new KeyboardService({
|
|
535
|
-
selectionStoreService: this.selectionStoreService,
|
|
536
|
-
selectionStore: s,
|
|
537
|
-
doEdit: (v, c) => this.doEdit(v, c),
|
|
538
|
-
clearCell: () => this.clearCell(),
|
|
539
|
-
getData: () => this.getData(),
|
|
540
|
-
internalPaste: () => this.internalPaste.emit()
|
|
541
|
-
});
|
|
542
|
-
this.createAutoFillService();
|
|
543
|
-
this.createClipboardService();
|
|
544
|
-
}
|
|
545
|
-
createAutoFillService() {
|
|
546
|
-
this.autoFillService = new AutoFillService({
|
|
547
|
-
selectionStoreService: this.selectionStoreService,
|
|
548
|
-
dimensionRow: this.dimensionRow,
|
|
549
|
-
dimensionCol: this.dimensionCol,
|
|
550
|
-
columnService: this.columnService,
|
|
551
|
-
dataStore: this.dataStore,
|
|
552
|
-
setTempRange: (e) => this.setTempRange.emit(e),
|
|
553
|
-
internalSelectionChanged: (e) => this.internalSelectionChanged.emit(e),
|
|
554
|
-
internalRangeDataApply: (e) => this.internalRangeDataApply.emit(e),
|
|
555
|
-
setRange: (e) => this.setRange.emit(e),
|
|
556
|
-
getData: () => this.getData(),
|
|
557
|
-
});
|
|
558
|
-
}
|
|
559
|
-
columnServiceSet() {
|
|
560
|
-
var _a;
|
|
561
|
-
(_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
562
|
-
this.columnService = new ColumnService(this.dataStore, this.colData);
|
|
563
|
-
this.createAutoFillService();
|
|
564
|
-
this.createClipboardService();
|
|
565
|
-
}
|
|
566
|
-
createClipboardService() {
|
|
567
|
-
this.clipboardService = new ClipboardService({
|
|
568
|
-
selectionStoreService: this.selectionStoreService,
|
|
569
|
-
columnService: this.columnService,
|
|
570
|
-
dataStore: this.dataStore,
|
|
571
|
-
onRangeApply: (d, r) => this.autoFillService.onRangeApply(d, r),
|
|
572
|
-
internalCopy: () => this.internalCopy.emit()
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
connectedCallback() {
|
|
576
|
-
this.columnServiceSet();
|
|
577
|
-
this.selectionServiceSet(this.selectionStore);
|
|
578
|
-
}
|
|
579
|
-
disconnectedCallback() {
|
|
580
|
-
var _a;
|
|
581
|
-
(_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
582
|
-
}
|
|
583
|
-
renderRange(range) {
|
|
584
|
-
const style = getElStyle(range, this.dimensionRow.state, this.dimensionCol.state);
|
|
585
|
-
return [h("div", { class: SELECTION_BORDER_CLASS, style: style })];
|
|
586
|
-
}
|
|
587
|
-
renderEditCell() {
|
|
588
|
-
// if can edit
|
|
589
|
-
const editCell = this.selectionStore.get('edit');
|
|
590
|
-
if (this.readonly || !editCell) {
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
const val = editCell.val || this.columnService.getCellData(editCell.y, editCell.x);
|
|
594
|
-
const editable = Object.assign(Object.assign({}, editCell), this.columnService.getSaveData(editCell.y, editCell.x, val));
|
|
595
|
-
const style = getElStyle(Object.assign(Object.assign({}, editCell), { x1: editCell.x, y1: editCell.y }), this.dimensionRow.state, this.dimensionCol.state);
|
|
596
|
-
return (h("revogr-edit", { onCellEdit: e => this.onCellEdit(e.detail), onCloseEdit: e => this.closeEdit(e), editCell: editable, column: this.columnService.columns[editCell.x], editor: this.columnService.getCellEditor(editCell.y, editCell.x, this.editors), style: style }));
|
|
597
|
-
}
|
|
598
|
-
render() {
|
|
599
|
-
const range = this.selectionStoreService.ranged;
|
|
600
|
-
const selectionFocus = this.selectionStoreService.focused;
|
|
601
|
-
const els = [];
|
|
602
|
-
if ((range || selectionFocus) && this.useClipboard) {
|
|
603
|
-
els.push(this.clipboardService.renderClipboard());
|
|
604
|
-
}
|
|
605
|
-
if (range) {
|
|
606
|
-
els.push(...this.renderRange(range));
|
|
607
|
-
}
|
|
608
|
-
const editCell = this.renderEditCell();
|
|
609
|
-
if (editCell) {
|
|
610
|
-
els.push(editCell);
|
|
611
|
-
}
|
|
612
|
-
if (selectionFocus && !this.readonly && !editCell && this.range) {
|
|
613
|
-
els.push(this.autoFillService.renderAutofill(range, selectionFocus));
|
|
614
|
-
}
|
|
615
|
-
if (this.canDrag) {
|
|
616
|
-
els.push(h("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, onInternalRowDragStart: e => this.onRowDragStart(e) }));
|
|
617
|
-
}
|
|
618
|
-
return (h(Host, { onDblClick: () => this.doEdit(), onMouseDown: (e) => this.onElementMouseDown(e) }, els, h("slot", { name: "data" })));
|
|
619
|
-
}
|
|
620
|
-
onElementMouseDown(e) {
|
|
621
|
-
// Ignore focus if clicked input
|
|
622
|
-
if (isEditInput(e.target)) {
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
const data = this.getData();
|
|
626
|
-
if (e.defaultPrevented) {
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
// Regular cell click
|
|
630
|
-
const focusCell = getCurrentCell({ x: e.x, y: e.y }, data);
|
|
631
|
-
this.selectionStoreService.focus(focusCell, this.range && e.shiftKey);
|
|
632
|
-
// Initiate autofill selection
|
|
633
|
-
if (this.range) {
|
|
634
|
-
this.autoFillService.selectionStart(e, data);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
doEdit(val = '', isCancel = false) {
|
|
638
|
-
var _a;
|
|
639
|
-
if (this.canEdit()) {
|
|
640
|
-
const editCell = this.selectionStore.get('focus');
|
|
641
|
-
const data = this.columnService.getSaveData(editCell.y, editCell.x);
|
|
642
|
-
(_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { isCancel,
|
|
643
|
-
val }));
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
closeEdit(e) {
|
|
647
|
-
this.doEdit(undefined, true);
|
|
648
|
-
if (e === null || e === void 0 ? void 0 : e.detail) {
|
|
649
|
-
this.focusNext();
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
async focusNext() {
|
|
653
|
-
const canFocus = await this.keyboardService.keyChangeSelection(new KeyboardEvent('keydown', {
|
|
654
|
-
code: codesLetter.ARROW_DOWN,
|
|
655
|
-
}), this.range);
|
|
656
|
-
if (!canFocus) {
|
|
657
|
-
this.closeEdit();
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
clearCell() {
|
|
661
|
-
if (this.selectionStoreService.ranged && !isRangeSingleCell(this.selectionStoreService.ranged)) {
|
|
662
|
-
const data = this.columnService.getRangeStaticData(this.selectionStoreService.ranged, '');
|
|
663
|
-
this.autoFillService.onRangeApply(data, this.selectionStoreService.ranged);
|
|
664
|
-
}
|
|
665
|
-
else if (this.canEdit()) {
|
|
666
|
-
const focused = this.selectionStoreService.focused;
|
|
667
|
-
this.onCellEdit({ rgRow: focused.y, rgCol: focused.x, val: '' }, true);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
/** Edit finished, close cell and save */
|
|
671
|
-
onCellEdit(e, clear = false) {
|
|
672
|
-
const dataToSave = this.columnService.getSaveData(e.rgRow, e.rgCol, e.val);
|
|
673
|
-
this.internalCellEdit.emit(dataToSave);
|
|
674
|
-
// if not clear navigate to next cell after edit
|
|
675
|
-
if (!clear && !e.preventFocus) {
|
|
676
|
-
this.focusNext();
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
onRowDragStart({ detail }) {
|
|
680
|
-
detail.text = this.columnService.getCellData(detail.cell.y, detail.cell.x);
|
|
681
|
-
}
|
|
682
|
-
/** Check if edit possible */
|
|
683
|
-
canEdit() {
|
|
684
|
-
var _a;
|
|
685
|
-
if (this.readonly) {
|
|
686
|
-
return false;
|
|
687
|
-
}
|
|
688
|
-
const editCell = this.selectionStoreService.focused;
|
|
689
|
-
return editCell && !((_a = this.columnService) === null || _a === void 0 ? void 0 : _a.isReadOnly(editCell.y, editCell.x));
|
|
690
|
-
}
|
|
691
|
-
/** Collect data from element */
|
|
692
|
-
getData() {
|
|
693
|
-
return {
|
|
694
|
-
el: this.element,
|
|
695
|
-
rows: this.dimensionRow.state,
|
|
696
|
-
cols: this.dimensionCol.state,
|
|
697
|
-
lastCell: this.lastCell,
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
get element() { return getElement(this); }
|
|
701
|
-
static get watchers() { return {
|
|
702
|
-
"selectionStore": ["selectionServiceSet"],
|
|
703
|
-
"dimensionRow": ["createAutoFillService"],
|
|
704
|
-
"dimensionCol": ["createAutoFillService"],
|
|
705
|
-
"dataStore": ["columnServiceSet"],
|
|
706
|
-
"colData": ["columnServiceSet"]
|
|
707
|
-
}; }
|
|
708
|
-
};
|
|
709
|
-
OverlaySelection.style = revogrOverlayStyleCss;
|
|
710
|
-
|
|
711
|
-
export { OverlaySelection as revogr_overlay_selection };
|