@revolist/revogrid 4.4.0-next.2 → 4.4.0-next.21
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/columnService.js +1 -1
- package/custom-element/consts.js +2 -1
- package/custom-element/consts.js.map +1 -1
- package/custom-element/localScrollService.js +1 -1
- package/custom-element/localScrollService.js.map +1 -1
- package/custom-element/revo-grid.js +163 -97
- package/custom-element/revo-grid.js.map +1 -1
- package/custom-element/revogr-clipboard.js +24 -5
- package/custom-element/revogr-clipboard.js.map +1 -1
- package/custom-element/revogr-edit2.js +12 -6
- package/custom-element/revogr-edit2.js.map +1 -1
- package/custom-element/revogr-focus2.js +1 -1
- package/custom-element/revogr-focus2.js.map +1 -1
- package/custom-element/revogr-header2.js +25 -11
- package/custom-element/revogr-header2.js.map +1 -1
- package/custom-element/revogr-overlay-selection2.js +99 -32
- package/custom-element/revogr-overlay-selection2.js.map +1 -1
- package/custom-element/revogr-row-headers2.js +1 -2
- package/custom-element/revogr-row-headers2.js.map +1 -1
- package/custom-element/revogr-viewport-scroll2.js +39 -6
- package/custom-element/revogr-viewport-scroll2.js.map +1 -1
- package/dist/cjs/{debounce-525dd66c.js → debounce-f50730b6.js} +1 -38
- package/dist/cjs/debounce-f50730b6.js.map +1 -0
- package/dist/cjs/dispatcher-20520c70.js +21 -0
- package/dist/cjs/dispatcher-20520c70.js.map +1 -0
- package/dist/cjs/events-030618fc.js +459 -0
- package/dist/cjs/events-030618fc.js.map +1 -0
- package/dist/cjs/filter.button-6badec7a.js +44 -0
- package/dist/cjs/filter.button-6badec7a.js.map +1 -0
- package/dist/cjs/{index-aad39b7b.js → index-ee2ef5ae.js} +96 -36
- package/dist/cjs/index-ee2ef5ae.js.map +1 -0
- package/dist/cjs/index-effc94b9.js +3944 -0
- package/dist/cjs/index-effc94b9.js.map +1 -0
- package/dist/cjs/isString-3dde8d95.js +38 -0
- package/dist/cjs/isString-3dde8d95.js.map +1 -0
- package/dist/cjs/keyCodes.utils-d665ebed.js +271 -0
- package/dist/cjs/keyCodes.utils-d665ebed.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/localScrollService-a81823c5.js +403 -0
- package/dist/cjs/localScrollService-a81823c5.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.entry.js +3858 -0
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.js +3 -3
- package/dist/cjs/revo-grid.cjs.js.map +1 -1
- package/dist/cjs/revogr-clipboard.cjs.entry.js +24 -6
- package/dist/cjs/revogr-clipboard.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_3.cjs.entry.js +1138 -0
- package/dist/cjs/revogr-data_3.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-edit_2.cjs.entry.js +325 -0
- package/dist/cjs/revogr-edit_2.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +6 -5
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-focus_5.cjs.entry.js +1231 -0
- package/dist/cjs/revogr-focus_5.cjs.entry.js.map +1 -0
- package/dist/cjs/{revo-grid_11.cjs.entry.js → viewport.helpers-70ccec8f.js} +13978 -25269
- package/dist/cjs/viewport.helpers-70ccec8f.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/clipboard/revogr-clipboard.d.ts +6 -2
- package/dist/collection/components/clipboard/revogr-clipboard.js +46 -5
- package/dist/collection/components/clipboard/revogr-clipboard.js.map +1 -1
- package/dist/collection/components/header/headerCellRenderer.d.ts +2 -1
- package/dist/collection/components/header/headerCellRenderer.js +1 -1
- package/dist/collection/components/header/headerCellRenderer.js.map +1 -1
- package/dist/collection/components/header/headerRenderer.d.ts +2 -2
- package/dist/collection/components/header/headerRenderer.js +1 -1
- package/dist/collection/components/header/headerRenderer.js.map +1 -1
- package/dist/collection/components/header/revogr-header.d.ts +15 -1
- package/dist/collection/components/header/revogr-header.js +34 -8
- package/dist/collection/components/header/revogr-header.js.map +1 -1
- package/dist/collection/components/overlay/autofill.service.d.ts +7 -3
- package/dist/collection/components/overlay/autofill.service.js +32 -12
- package/dist/collection/components/overlay/autofill.service.js.map +1 -1
- package/dist/collection/components/overlay/clipboard.service.d.ts +1 -1
- package/dist/collection/components/overlay/clipboard.service.js +2 -2
- package/dist/collection/components/overlay/clipboard.service.js.map +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +2 -6
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/overlay/revogr-edit.d.ts +8 -0
- package/dist/collection/components/overlay/revogr-edit.js +34 -9
- package/dist/collection/components/overlay/revogr-edit.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-selection.d.ts +32 -10
- package/dist/collection/components/overlay/revogr-overlay-selection.js +80 -12
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-style.css +71 -4
- package/dist/collection/components/revoGrid/revo-grid.d.ts +15 -4
- package/dist/collection/components/revoGrid/revo-grid.js +60 -19
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.scrolling.service.d.ts +6 -2
- package/dist/collection/components/revoGrid/viewport.scrolling.service.js +26 -4
- package/dist/collection/components/revoGrid/viewport.scrolling.service.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.section.d.ts +3 -2
- package/dist/collection/components/revoGrid/viewport.section.js +8 -4
- package/dist/collection/components/revoGrid/viewport.section.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.service.d.ts +4 -0
- package/dist/collection/components/revoGrid/viewport.service.js +15 -3
- package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
- package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +3 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.d.ts +16 -5
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +64 -9
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
- package/dist/collection/components/selectionFocus/revogr-focus-style.css +1 -1
- package/dist/collection/components.d.ts +110 -6
- package/dist/collection/interfaces.d.ts +4 -1
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.d.ts +3 -2
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +2 -2
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js.map +1 -1
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.d.ts +2 -2
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +1 -1
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js.map +1 -1
- package/dist/collection/plugins/sorting/sorting.plugin.d.ts +21 -13
- package/dist/collection/plugins/sorting/sorting.plugin.js +77 -70
- package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -1
- package/dist/collection/serve/controller.js +183 -0
- package/dist/collection/services/localScrollService.js +1 -1
- package/dist/collection/services/localScrollService.js.map +1 -1
- package/dist/collection/services/resizable.directive.d.ts +8 -7
- package/dist/collection/services/resizable.directive.js +13 -36
- package/dist/collection/services/resizable.directive.js.map +1 -1
- package/dist/collection/services/resizable.element.d.ts +4 -0
- package/dist/collection/services/resizable.element.js +39 -0
- package/dist/collection/services/resizable.element.js.map +1 -0
- package/dist/collection/stencil-public-runtime.d.ts +1 -0
- package/dist/collection/store/viewPort/viewport.store.js +0 -1
- package/dist/collection/store/viewPort/viewport.store.js.map +1 -1
- package/dist/collection/utils/consts.d.ts +1 -0
- package/dist/collection/utils/consts.js +1 -0
- package/dist/collection/utils/consts.js.map +1 -1
- package/dist/collection/utils/events.d.ts +2 -1
- package/dist/collection/utils/events.js +18 -2
- package/dist/collection/utils/events.js.map +1 -1
- package/dist/collection/utils/mobile.d.ts +1 -0
- package/dist/collection/utils/mobile.js +7 -0
- package/dist/collection/utils/mobile.js.map +1 -0
- package/dist/esm/{debounce-301fd4d2.js → debounce-820b5a8b.js} +2 -34
- package/dist/esm/debounce-820b5a8b.js.map +1 -0
- package/dist/esm/dispatcher-9e9c0233.js +19 -0
- package/dist/esm/dispatcher-9e9c0233.js.map +1 -0
- package/dist/esm/events-31272e5e.js +454 -0
- package/dist/esm/events-31272e5e.js.map +1 -0
- package/dist/esm/filter.button-21ce90ef.js +38 -0
- package/dist/esm/filter.button-21ce90ef.js.map +1 -0
- package/dist/esm/{index-5e90b19b.js → index-05947c5f.js} +97 -37
- package/dist/esm/index-05947c5f.js.map +1 -0
- package/dist/esm/index-728bf6e3.js +3889 -0
- package/dist/esm/index-728bf6e3.js.map +1 -0
- package/dist/esm/isString-d539060a.js +36 -0
- package/dist/esm/isString-d539060a.js.map +1 -0
- package/dist/esm/keyCodes.utils-c0064460.js +265 -0
- package/dist/esm/keyCodes.utils-c0064460.js.map +1 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/localScrollService-884d8952.js +400 -0
- package/dist/esm/localScrollService-884d8952.js.map +1 -0
- package/dist/esm/revo-grid.entry.js +3854 -0
- package/dist/esm/revo-grid.entry.js.map +1 -0
- package/dist/esm/revo-grid.js +4 -4
- package/dist/esm/revo-grid.js.map +1 -1
- package/dist/esm/revogr-clipboard.entry.js +24 -6
- package/dist/esm/revogr-clipboard.entry.js.map +1 -1
- package/dist/esm/revogr-data_3.entry.js +1132 -0
- package/dist/esm/revogr-data_3.entry.js.map +1 -0
- package/dist/esm/revogr-edit_2.entry.js +320 -0
- package/dist/esm/revogr-edit_2.entry.js.map +1 -0
- package/dist/esm/revogr-filter-panel.entry.js +3 -2
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/revogr-focus_5.entry.js +1223 -0
- package/dist/esm/revogr-focus_5.entry.js.map +1 -0
- package/dist/esm/{revo-grid_11.entry.js → viewport.helpers-c08e729e.js} +13790 -25093
- package/dist/esm/viewport.helpers-c08e729e.js.map +1 -0
- package/dist/revo-grid/debounce-820b5a8b.js +5 -0
- package/dist/revo-grid/debounce-820b5a8b.js.map +1 -0
- package/dist/revo-grid/dispatcher-9e9c0233.js +5 -0
- package/dist/revo-grid/dispatcher-9e9c0233.js.map +1 -0
- package/dist/revo-grid/events-31272e5e.js +5 -0
- package/dist/revo-grid/events-31272e5e.js.map +1 -0
- package/dist/revo-grid/filter.button-21ce90ef.js +5 -0
- package/dist/revo-grid/filter.button-21ce90ef.js.map +1 -0
- package/dist/revo-grid/index-05947c5f.js +6 -0
- package/dist/revo-grid/index-05947c5f.js.map +1 -0
- package/dist/revo-grid/index-728bf6e3.js +5 -0
- package/dist/revo-grid/index-728bf6e3.js.map +1 -0
- package/dist/revo-grid/isString-d539060a.js +5 -0
- package/dist/revo-grid/isString-d539060a.js.map +1 -0
- package/dist/revo-grid/keyCodes.utils-c0064460.js +5 -0
- package/dist/revo-grid/keyCodes.utils-c0064460.js.map +1 -0
- package/dist/revo-grid/localScrollService-884d8952.js +5 -0
- package/dist/revo-grid/localScrollService-884d8952.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.js +5 -0
- package/dist/revo-grid/revo-grid.entry.js.map +1 -0
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_3.entry.js +5 -0
- package/dist/revo-grid/revogr-data_3.entry.js.map +1 -0
- package/dist/revo-grid/revogr-edit_2.entry.js +5 -0
- package/dist/revo-grid/revogr-edit_2.entry.js.map +1 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/revogr-focus_5.entry.js +5 -0
- package/dist/revo-grid/revogr-focus_5.entry.js.map +1 -0
- package/dist/revo-grid/viewport.helpers-c08e729e.js +5 -0
- package/dist/revo-grid/viewport.helpers-c08e729e.js.map +1 -0
- package/dist/types/components/clipboard/revogr-clipboard.d.ts +6 -2
- package/dist/types/components/header/headerCellRenderer.d.ts +2 -1
- package/dist/types/components/header/headerRenderer.d.ts +2 -2
- package/dist/types/components/header/revogr-header.d.ts +15 -1
- package/dist/types/components/overlay/autofill.service.d.ts +7 -3
- package/dist/types/components/overlay/clipboard.service.d.ts +1 -1
- package/dist/types/components/overlay/revogr-edit.d.ts +8 -0
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +32 -10
- package/dist/types/components/revoGrid/revo-grid.d.ts +15 -4
- package/dist/types/components/revoGrid/viewport.scrolling.service.d.ts +6 -2
- package/dist/types/components/revoGrid/viewport.section.d.ts +3 -2
- package/dist/types/components/revoGrid/viewport.service.d.ts +4 -0
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +16 -5
- package/dist/types/components.d.ts +110 -6
- package/dist/types/interfaces.d.ts +4 -1
- package/dist/types/plugins/groupingColumn/columnGroupsRenderer.d.ts +3 -2
- package/dist/types/plugins/groupingColumn/headerGroupRenderer.d.ts +2 -2
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +21 -13
- package/dist/types/services/resizable.directive.d.ts +8 -7
- package/dist/types/services/resizable.element.d.ts +4 -0
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/dist/types/utils/consts.d.ts +1 -0
- package/dist/types/utils/events.d.ts +2 -1
- package/dist/types/utils/mobile.d.ts +1 -0
- package/package.json +4 -3
- package/dist/cjs/debounce-525dd66c.js.map +0 -1
- package/dist/cjs/index-aad39b7b.js.map +0 -1
- package/dist/cjs/revo-grid_11.cjs.entry.js.map +0 -1
- package/dist/esm/debounce-301fd4d2.js.map +0 -1
- package/dist/esm/index-5e90b19b.js.map +0 -1
- package/dist/esm/revo-grid_11.entry.js.map +0 -1
- package/dist/revo-grid/debounce-301fd4d2.js +0 -5
- package/dist/revo-grid/debounce-301fd4d2.js.map +0 -1
- package/dist/revo-grid/index-5e90b19b.js +0 -6
- package/dist/revo-grid/index-5e90b19b.js.map +0 -1
- package/dist/revo-grid/revo-grid_11.entry.js +0 -5
- package/dist/revo-grid/revo-grid_11.entry.js.map +0 -1
- /package/dist/collection/{utilsExternal/generate-data.js → serve/data.js} +0 -0
|
@@ -0,0 +1,1223 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-05947c5f.js';
|
|
5
|
+
import { A as getItemByPosition, n as getItemByIndex, g as getSourceItem, F as FOCUS_CLASS, E as EDIT_INPUT_WR, w as timeout, R as RESIZE_INTERVAL, C as CELL_HANDLER_CLASS, M as MOBILE_CLASS, S as SELECTION_BORDER_CLASS, D as DataStore, B as ROW_HEADER_TYPE, U as UUID, z as getScrollbarWidth, T as TMP_SELECTION_BG_CLASS } from './index-728bf6e3.js';
|
|
6
|
+
import { C as ColumnService, L as LocalScrollService } from './localScrollService-884d8952.js';
|
|
7
|
+
import { n as getRange, o as isRangeSingleCell, H as HEADER_SLOT, l as lodash } from './viewport.helpers-c08e729e.js';
|
|
8
|
+
import { i as isCtrlKey, c as codesLetter, a as isClear, b as isEnterKey, d as isLetterKey } from './keyCodes.utils-c0064460.js';
|
|
9
|
+
import { d as debounce_1 } from './debounce-820b5a8b.js';
|
|
10
|
+
import { g as getFromEvent, v as verifyTouchTarget, V as ViewportStore, c as calculateRowHeaderSize } from './events-31272e5e.js';
|
|
11
|
+
import './isString-d539060a.js';
|
|
12
|
+
|
|
13
|
+
/** Calculate cell based on x, y position */
|
|
14
|
+
function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
15
|
+
const { top, left, height, width } = el.getBoundingClientRect();
|
|
16
|
+
let cellY = y - top;
|
|
17
|
+
// limit to element height
|
|
18
|
+
if (cellY >= height) {
|
|
19
|
+
cellY = height - 1;
|
|
20
|
+
}
|
|
21
|
+
let cellX = x - left;
|
|
22
|
+
// limit to element width
|
|
23
|
+
if (cellX >= width) {
|
|
24
|
+
cellX = width - 1;
|
|
25
|
+
}
|
|
26
|
+
const rgRow = getItemByPosition(rows, cellY);
|
|
27
|
+
const rgCol = getItemByPosition(cols, cellX);
|
|
28
|
+
// before first
|
|
29
|
+
if (rgCol.itemIndex < 0) {
|
|
30
|
+
rgCol.itemIndex = 0;
|
|
31
|
+
}
|
|
32
|
+
// before first
|
|
33
|
+
if (rgRow.itemIndex < 0) {
|
|
34
|
+
rgRow.itemIndex = 0;
|
|
35
|
+
}
|
|
36
|
+
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
37
|
+
}
|
|
38
|
+
function getCoordinate(range, focus, changes, isMulti = false) {
|
|
39
|
+
const updateCoordinate = (c) => {
|
|
40
|
+
const start = { x: range.x, y: range.y };
|
|
41
|
+
const end = isMulti ? { x: range.x1, y: range.y1 } : start;
|
|
42
|
+
const point = end[c] > focus[c] ? end : start;
|
|
43
|
+
point[c] += changes[c];
|
|
44
|
+
return { start, end };
|
|
45
|
+
};
|
|
46
|
+
if (changes.x) {
|
|
47
|
+
return updateCoordinate('x');
|
|
48
|
+
}
|
|
49
|
+
if (changes.y) {
|
|
50
|
+
return updateCoordinate('y');
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/** check if out of range */
|
|
55
|
+
function isAfterLast({ x, y }, { lastCell }) {
|
|
56
|
+
return x >= lastCell.x || y >= lastCell.y;
|
|
57
|
+
}
|
|
58
|
+
/** check if out of range */
|
|
59
|
+
function isBeforeFirst({ x, y }) {
|
|
60
|
+
return x < 0 || y < 0;
|
|
61
|
+
}
|
|
62
|
+
/** Compare cells, only 1 coordinate difference is possible */
|
|
63
|
+
// export function getDirectionCoordinate(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
64
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
65
|
+
// for (let k of c) {
|
|
66
|
+
// if (initial[k] !== last[k]) {
|
|
67
|
+
// return { [k]: 1 };
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
// return null;
|
|
71
|
+
// }
|
|
72
|
+
// export function getLargestAxis(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
73
|
+
// const cell: Partial<Cell> = {};
|
|
74
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
75
|
+
// for (let k of c) {
|
|
76
|
+
// cell[k] = Math.abs(initial[k] - last[k]);
|
|
77
|
+
// }
|
|
78
|
+
// if (cell.x > cell.y) {
|
|
79
|
+
// return { x: 1 };
|
|
80
|
+
// }
|
|
81
|
+
// if (cell.y > cell.x) {
|
|
82
|
+
// return { y: 1 };
|
|
83
|
+
// }
|
|
84
|
+
// return null;
|
|
85
|
+
// }
|
|
86
|
+
function styleByCellProps(styles) {
|
|
87
|
+
return {
|
|
88
|
+
left: `${styles.left}px`,
|
|
89
|
+
top: `${styles.top}px`,
|
|
90
|
+
width: `${styles.width}px`,
|
|
91
|
+
height: `${styles.height}px`,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
95
|
+
const top = getItemByIndex(dimensionRow, y).start;
|
|
96
|
+
const left = getItemByIndex(dimensionCol, x).start;
|
|
97
|
+
const bottom = getItemByIndex(dimensionRow, y1).end;
|
|
98
|
+
const right = getItemByIndex(dimensionCol, x1).end;
|
|
99
|
+
return {
|
|
100
|
+
left,
|
|
101
|
+
right,
|
|
102
|
+
top,
|
|
103
|
+
bottom,
|
|
104
|
+
width: right - left,
|
|
105
|
+
height: bottom - top,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function getElStyle(range, dimensionRow, dimensionCol) {
|
|
109
|
+
const styles = getCell(range, dimensionRow, dimensionCol);
|
|
110
|
+
return styleByCellProps(styles);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const revogrFocusStyleCss = ".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-focus.focused-cell{box-shadow:-1px 0 0 #0d63e8 inset, 1px 0 0 #0d63e8 inset, 0 -1px 0 #0d63e8 inset, 0 1px 0 #0d63e8 inset;position:absolute;pointer-events:none;z-index:9;display:block !important}";
|
|
114
|
+
|
|
115
|
+
const RevogrFocus$1 = class {
|
|
116
|
+
constructor(hostRef) {
|
|
117
|
+
registerInstance(this, hostRef);
|
|
118
|
+
this.beforeFocusRender = createEvent(this, "before-focus-render", 7);
|
|
119
|
+
this.afterFocus = createEvent(this, "afterfocus", 7);
|
|
120
|
+
this.selectionStore = undefined;
|
|
121
|
+
this.dimensionRow = undefined;
|
|
122
|
+
this.dimensionCol = undefined;
|
|
123
|
+
this.dataStore = undefined;
|
|
124
|
+
this.colData = undefined;
|
|
125
|
+
this.colType = undefined;
|
|
126
|
+
this.rowType = undefined;
|
|
127
|
+
this.focusTemplate = null;
|
|
128
|
+
}
|
|
129
|
+
changed(e, focus) {
|
|
130
|
+
e === null || e === void 0 ? void 0 : e.scrollIntoView({
|
|
131
|
+
block: 'nearest',
|
|
132
|
+
inline: 'nearest',
|
|
133
|
+
});
|
|
134
|
+
const model = getSourceItem(this.dataStore, focus.y);
|
|
135
|
+
const column = getSourceItem(this.colData, focus.x);
|
|
136
|
+
this.afterFocus.emit({
|
|
137
|
+
model,
|
|
138
|
+
column
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
componentDidRender() {
|
|
142
|
+
const currentFocus = this.selectionStore.get('focus');
|
|
143
|
+
currentFocus && this.el && this.changed(this.el, currentFocus);
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
const editCell = this.selectionStore.get('edit');
|
|
147
|
+
if (editCell) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const data = this.selectionStore.get('focus');
|
|
151
|
+
if (data) {
|
|
152
|
+
const event = this.beforeFocusRender.emit({
|
|
153
|
+
range: Object.assign(Object.assign({}, data), { x1: data.x, y1: data.y }),
|
|
154
|
+
rowType: this.rowType,
|
|
155
|
+
colType: this.colType,
|
|
156
|
+
});
|
|
157
|
+
if (event.defaultPrevented) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const { detail } = event;
|
|
161
|
+
const style = getElStyle(detail.range, this.dimensionRow.state, this.dimensionCol.state);
|
|
162
|
+
const extra = this.focusTemplate && this.focusTemplate(h, detail);
|
|
163
|
+
return h(Host, { class: FOCUS_CLASS, style: style }, extra);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
get el() { return getElement(this); }
|
|
167
|
+
};
|
|
168
|
+
RevogrFocus$1.style = revogrFocusStyleCss;
|
|
169
|
+
|
|
170
|
+
class SelectionStoreService {
|
|
171
|
+
constructor(store, config) {
|
|
172
|
+
this.store = store;
|
|
173
|
+
this.config = config;
|
|
174
|
+
this.store = store;
|
|
175
|
+
}
|
|
176
|
+
get edited() {
|
|
177
|
+
return this.store.get('edit');
|
|
178
|
+
}
|
|
179
|
+
get focused() {
|
|
180
|
+
return this.store.get('focus');
|
|
181
|
+
}
|
|
182
|
+
get ranged() {
|
|
183
|
+
return this.store.get('range');
|
|
184
|
+
}
|
|
185
|
+
changeRange(range) {
|
|
186
|
+
return this.config.changeRange(range);
|
|
187
|
+
}
|
|
188
|
+
focus(cell, isMulti = false) {
|
|
189
|
+
if (!cell) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
let end = cell;
|
|
193
|
+
// range edit
|
|
194
|
+
if (isMulti) {
|
|
195
|
+
let start = this.store.get('focus');
|
|
196
|
+
if (start) {
|
|
197
|
+
return this.config.changeRange(getRange(start, end));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// single focus
|
|
201
|
+
return this.config.focus(cell, end);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// is edit input
|
|
206
|
+
function isEditInput(el) {
|
|
207
|
+
return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const DIRECTION_CODES = [
|
|
211
|
+
codesLetter.TAB,
|
|
212
|
+
codesLetter.ARROW_UP,
|
|
213
|
+
codesLetter.ARROW_DOWN,
|
|
214
|
+
codesLetter.ARROW_LEFT,
|
|
215
|
+
codesLetter.ARROW_RIGHT,
|
|
216
|
+
];
|
|
217
|
+
class KeyboardService {
|
|
218
|
+
constructor(sv) {
|
|
219
|
+
this.sv = sv;
|
|
220
|
+
this.ctrlDown = false;
|
|
221
|
+
}
|
|
222
|
+
async keyDown(e, canRange) {
|
|
223
|
+
if (isCtrlKey(e.keyCode, navigator.platform)) {
|
|
224
|
+
this.ctrlDown = true;
|
|
225
|
+
}
|
|
226
|
+
// IF EDIT MODE
|
|
227
|
+
if (this.sv.selectionStoreService.edited) {
|
|
228
|
+
switch (e.code) {
|
|
229
|
+
case codesLetter.ESCAPE:
|
|
230
|
+
this.sv.cancelEdit();
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
// IF NOT EDIT MODE
|
|
236
|
+
// pressed clear key
|
|
237
|
+
if (this.sv.selectionStoreService.ranged && isClear(e.code)) {
|
|
238
|
+
this.sv.clearCell();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
// below works with focus only
|
|
242
|
+
if (!this.sv.selectionStoreService.focused) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
// tab key means same as arrow right
|
|
246
|
+
if (codesLetter.TAB === e.code) {
|
|
247
|
+
this.keyChangeSelection(e, canRange);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// pressed enter
|
|
251
|
+
if (isEnterKey(e.code)) {
|
|
252
|
+
this.sv.applyEdit();
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
// copy operation
|
|
256
|
+
if (this.isCopy(e)) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
// cut operation
|
|
260
|
+
if (this.isCut(e)) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// paste operation
|
|
264
|
+
if (this.isPaste(e)) {
|
|
265
|
+
this.sv.internalPaste();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
// select all
|
|
269
|
+
if (this.isAll(e)) {
|
|
270
|
+
if (canRange) {
|
|
271
|
+
this.selectAll(e);
|
|
272
|
+
}
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
// pressed letter key
|
|
276
|
+
if (isLetterKey(e.keyCode)) {
|
|
277
|
+
this.sv.applyEdit(e.key);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
// pressed arrow, change selection position
|
|
281
|
+
if (await this.keyChangeSelection(e, canRange)) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
selectAll(e) {
|
|
286
|
+
const range = this.sv.selectionStore.get('range');
|
|
287
|
+
const focus = this.sv.selectionStore.get('focus');
|
|
288
|
+
// if no range or focus - do nothing
|
|
289
|
+
if (!range || !focus) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
e.preventDefault();
|
|
293
|
+
this.sv.selectAll();
|
|
294
|
+
}
|
|
295
|
+
async keyChangeSelection(e, canRange) {
|
|
296
|
+
const data = this.changeDirectionKey(e, canRange);
|
|
297
|
+
if (!data) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
// this interval needed for several cases
|
|
301
|
+
// grid could be resized before next click
|
|
302
|
+
// at this case to avoid screen jump we use this interval
|
|
303
|
+
await timeout(RESIZE_INTERVAL + 30);
|
|
304
|
+
const range = this.sv.selectionStore.get('range');
|
|
305
|
+
const focus = this.sv.selectionStore.get('focus');
|
|
306
|
+
return this.keyPositionChange(data.changes, range, focus, data.isMulti);
|
|
307
|
+
}
|
|
308
|
+
keyPositionChange(changes, range, focus, isMulti = false) {
|
|
309
|
+
if (!range || !focus) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
const data = getCoordinate(range, focus, changes, isMulti);
|
|
313
|
+
if (!data) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
if (isMulti) {
|
|
317
|
+
const eData = this.sv.getData();
|
|
318
|
+
if (isAfterLast(data.end, eData) || isBeforeFirst(data.start)) {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
const range = getRange(data.start, data.end);
|
|
322
|
+
return this.sv.range(range);
|
|
323
|
+
}
|
|
324
|
+
return this.sv.focusNext(data.start, changes);
|
|
325
|
+
}
|
|
326
|
+
keyUp(e) {
|
|
327
|
+
if (isCtrlKey(e.keyCode, navigator.platform)) {
|
|
328
|
+
this.ctrlDown = false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
isCut(e) {
|
|
332
|
+
return this.ctrlDown && e.code == codesLetter.X;
|
|
333
|
+
}
|
|
334
|
+
isCopy(e) {
|
|
335
|
+
return this.ctrlDown && e.code == codesLetter.C;
|
|
336
|
+
}
|
|
337
|
+
isPaste(e) {
|
|
338
|
+
return this.ctrlDown && e.code == codesLetter.V;
|
|
339
|
+
}
|
|
340
|
+
isAll(e) {
|
|
341
|
+
return this.ctrlDown && e.code == codesLetter.A;
|
|
342
|
+
}
|
|
343
|
+
/** Monitor key direction changes */
|
|
344
|
+
changeDirectionKey(e, canRange) {
|
|
345
|
+
const isMulti = canRange && e.shiftKey;
|
|
346
|
+
if (DIRECTION_CODES.includes(e.code)) {
|
|
347
|
+
e.preventDefault();
|
|
348
|
+
}
|
|
349
|
+
switch (e.code) {
|
|
350
|
+
case codesLetter.ARROW_UP:
|
|
351
|
+
return { changes: { y: -1 }, isMulti };
|
|
352
|
+
case codesLetter.ARROW_DOWN:
|
|
353
|
+
return { changes: { y: 1 }, isMulti };
|
|
354
|
+
case codesLetter.ARROW_LEFT:
|
|
355
|
+
return { changes: { x: -1 }, isMulti };
|
|
356
|
+
case codesLetter.TAB:
|
|
357
|
+
case codesLetter.ARROW_RIGHT:
|
|
358
|
+
return { changes: { x: 1 }, isMulti };
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
var AutoFillType;
|
|
364
|
+
(function (AutoFillType) {
|
|
365
|
+
AutoFillType["selection"] = "Selection";
|
|
366
|
+
AutoFillType["autoFill"] = "AutoFill";
|
|
367
|
+
})(AutoFillType || (AutoFillType = {}));
|
|
368
|
+
class AutoFillService {
|
|
369
|
+
constructor(sv) {
|
|
370
|
+
this.sv = sv;
|
|
371
|
+
this.autoFillType = null;
|
|
372
|
+
this.autoFillInitial = null;
|
|
373
|
+
this.autoFillStart = null;
|
|
374
|
+
this.autoFillLast = null;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Render autofill box
|
|
378
|
+
* @param range
|
|
379
|
+
* @param selectionFocus
|
|
380
|
+
*/
|
|
381
|
+
renderAutofill(range, selectionFocus) {
|
|
382
|
+
let handlerStyle;
|
|
383
|
+
if (range) {
|
|
384
|
+
handlerStyle = getCell(range, this.sv.dimensionRow.state, this.sv.dimensionCol.state);
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
handlerStyle = getCell(Object.assign(Object.assign({}, selectionFocus), { x1: selectionFocus.x, y1: selectionFocus.y }), this.sv.dimensionRow.state, this.sv.dimensionCol.state);
|
|
388
|
+
}
|
|
389
|
+
return (h("div", { class: {
|
|
390
|
+
[CELL_HANDLER_CLASS]: true,
|
|
391
|
+
[MOBILE_CLASS]: true,
|
|
392
|
+
}, style: { left: `${handlerStyle.right}px`, top: `${handlerStyle.bottom}px` }, onMouseDown: (e) => this.autoFillHandler(e), onTouchStart: (e) => this.autoFillHandler(e) }));
|
|
393
|
+
}
|
|
394
|
+
autoFillHandler(e, type = AutoFillType.autoFill) {
|
|
395
|
+
let target = null;
|
|
396
|
+
if (e.target instanceof Element) {
|
|
397
|
+
target = e.target;
|
|
398
|
+
}
|
|
399
|
+
if (!target) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
this.selectionStart(target, this.sv.getData(), type);
|
|
403
|
+
e.preventDefault();
|
|
404
|
+
}
|
|
405
|
+
get isAutoFill() {
|
|
406
|
+
return !!this.autoFillType;
|
|
407
|
+
}
|
|
408
|
+
/** Process mouse move events */
|
|
409
|
+
selectionMouseMove(e) {
|
|
410
|
+
// initiate mouse move debounce if not present
|
|
411
|
+
if (!this.onMouseMoveAutofill) {
|
|
412
|
+
this.onMouseMoveAutofill = debounce_1((e, data) => this.doAutofillMouseMove(e, data), 5);
|
|
413
|
+
}
|
|
414
|
+
if (this.isAutoFill) {
|
|
415
|
+
this.onMouseMoveAutofill(e, this.sv.getData());
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
getFocus() {
|
|
419
|
+
let focus = this.sv.selectionStoreService.focused;
|
|
420
|
+
const range = this.sv.selectionStoreService.ranged;
|
|
421
|
+
// there was an issue that it was taking last cell from range but focus was out
|
|
422
|
+
if (!focus && range) {
|
|
423
|
+
focus = { x: range.x, y: range.y };
|
|
424
|
+
}
|
|
425
|
+
return focus || null;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Autofill logic:
|
|
429
|
+
* on mouse move apply based on previous direction (if present)
|
|
430
|
+
*/
|
|
431
|
+
doAutofillMouseMove(event, data) {
|
|
432
|
+
// if no initial - not started
|
|
433
|
+
if (!this.autoFillInitial) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
const x = getFromEvent(event, 'clientX', MOBILE_CLASS);
|
|
437
|
+
const y = getFromEvent(event, 'clientY', MOBILE_CLASS);
|
|
438
|
+
// skip touch
|
|
439
|
+
if (x === null || y === null) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const current = getCurrentCell({ x, y }, data);
|
|
443
|
+
// first time or direction equal to start(same as first time)
|
|
444
|
+
if (!this.autoFillLast) {
|
|
445
|
+
if (!this.autoFillLast) {
|
|
446
|
+
this.autoFillLast = this.autoFillStart;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
// check if not the latest, if latest - do nothing
|
|
450
|
+
if (isAfterLast(current, data)) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
this.autoFillLast = current;
|
|
454
|
+
const isSame = current.x === this.autoFillInitial.x && current.y === this.autoFillInitial.y;
|
|
455
|
+
// if same as initial - clear
|
|
456
|
+
if (isSame) {
|
|
457
|
+
this.sv.setTempRange(null);
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
this.sv.setTempRange({
|
|
461
|
+
area: getRange(this.autoFillInitial, this.autoFillLast),
|
|
462
|
+
type: this.autoFillType,
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Range selection started
|
|
468
|
+
* Mode @param type:
|
|
469
|
+
* Can be triggered from MouseDown selection on element
|
|
470
|
+
* Or can be triggered on corner square drag
|
|
471
|
+
*/
|
|
472
|
+
selectionStart(target, data, type = AutoFillType.selection) {
|
|
473
|
+
/** Get cell by autofill element */
|
|
474
|
+
const { top, left } = target.getBoundingClientRect();
|
|
475
|
+
this.autoFillInitial = this.getFocus();
|
|
476
|
+
this.autoFillType = type;
|
|
477
|
+
this.autoFillStart = getCurrentCell({ x: left, y: top }, data);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Clear current range selection
|
|
481
|
+
* on mouse up and mouse leave events
|
|
482
|
+
*/
|
|
483
|
+
clearAutoFillSelection() {
|
|
484
|
+
// Apply autofill values on mouse up if present
|
|
485
|
+
if (this.autoFillInitial) {
|
|
486
|
+
// Get latest
|
|
487
|
+
this.autoFillInitial = this.getFocus();
|
|
488
|
+
// Apply range data if present
|
|
489
|
+
if (this.autoFillType === AutoFillType.autoFill) {
|
|
490
|
+
const range = getRange(this.autoFillInitial, this.autoFillLast);
|
|
491
|
+
if (range) {
|
|
492
|
+
const { defaultPrevented: stopApply, detail: { range: newRange } } = this.sv.clearRangeDataApply({
|
|
493
|
+
range,
|
|
494
|
+
});
|
|
495
|
+
if (!stopApply) {
|
|
496
|
+
this.applyRangeWithData(newRange);
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
// if prevented - clear temp range
|
|
500
|
+
this.sv.setTempRange(null);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
this.applyRangeOnly(this.autoFillInitial, this.autoFillLast);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
this.autoFillType = null;
|
|
509
|
+
this.autoFillInitial = null;
|
|
510
|
+
this.autoFillLast = null;
|
|
511
|
+
this.autoFillStart = null;
|
|
512
|
+
}
|
|
513
|
+
/** Trigger range apply events and handle responses */
|
|
514
|
+
onRangeApply(data, range) {
|
|
515
|
+
const models = {};
|
|
516
|
+
for (let rowIndex in data) {
|
|
517
|
+
models[rowIndex] = getSourceItem(this.sv.dataStore, parseInt(rowIndex, 10));
|
|
518
|
+
}
|
|
519
|
+
const { defaultPrevented: stopRange, detail, } = this.sv.rangeDataApply({
|
|
520
|
+
data,
|
|
521
|
+
models,
|
|
522
|
+
type: this.sv.dataStore.get('type'),
|
|
523
|
+
});
|
|
524
|
+
if (!stopRange) {
|
|
525
|
+
this.sv.columnService.applyRangeData(detail.data);
|
|
526
|
+
}
|
|
527
|
+
this.sv.setRange(range);
|
|
528
|
+
}
|
|
529
|
+
/** Apply range and copy data during range application */
|
|
530
|
+
applyRangeWithData(newRange) {
|
|
531
|
+
const oldRange = this.sv.selectionStoreService.ranged;
|
|
532
|
+
const rangeData = {
|
|
533
|
+
type: this.sv.dataStore.get('type'),
|
|
534
|
+
newData: {},
|
|
535
|
+
mapping: {},
|
|
536
|
+
newRange,
|
|
537
|
+
oldRange,
|
|
538
|
+
};
|
|
539
|
+
const { mapping, changed } = this.sv.columnService.getRangeData(rangeData, this.sv.columnService.columns);
|
|
540
|
+
rangeData.newData = changed;
|
|
541
|
+
rangeData.mapping = mapping;
|
|
542
|
+
let e = this.sv.selectionChanged(rangeData);
|
|
543
|
+
// if default prevented - clear range
|
|
544
|
+
if (e.defaultPrevented) {
|
|
545
|
+
this.sv.setTempRange(null);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
e = this.sv.rangeCopy(rangeData);
|
|
549
|
+
if (e.defaultPrevented) {
|
|
550
|
+
this.sv.setRange(newRange);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
this.onRangeApply(rangeData.newData, newRange);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Update range selection only,
|
|
557
|
+
* no data change (mouse selection)
|
|
558
|
+
*/
|
|
559
|
+
applyRangeOnly(start, end) {
|
|
560
|
+
// no changes to apply
|
|
561
|
+
if (!start || !end) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const newRange = getRange(start, end);
|
|
565
|
+
this.sv.setRange(newRange);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
class ClipboardService {
|
|
570
|
+
constructor(sv) {
|
|
571
|
+
this.sv = sv;
|
|
572
|
+
}
|
|
573
|
+
renderClipboard(readonly = false) {
|
|
574
|
+
return h("revogr-clipboard", { readonly: readonly, onCopyRegion: e => this.onCopy(e.detail), onClearRegion: () => this.sv.rangeClear(), ref: e => (this.clipboard = e), onPasteRegion: e => this.onPaste(e.detail) });
|
|
575
|
+
}
|
|
576
|
+
getRegion() {
|
|
577
|
+
const focus = this.sv.selectionStoreService.focused;
|
|
578
|
+
let range = this.sv.selectionStoreService.ranged;
|
|
579
|
+
if (!range) {
|
|
580
|
+
range = getRange(focus, focus);
|
|
581
|
+
}
|
|
582
|
+
return range;
|
|
583
|
+
}
|
|
584
|
+
onCopy(e) {
|
|
585
|
+
const range = this.getRegion();
|
|
586
|
+
const canCopyEvent = this.sv.beforeCopy(range);
|
|
587
|
+
if (canCopyEvent.defaultPrevented) {
|
|
588
|
+
return false;
|
|
589
|
+
}
|
|
590
|
+
const data = this.sv.rangeCopy(range);
|
|
591
|
+
this.clipboard.doCopy(e, data);
|
|
592
|
+
return true;
|
|
593
|
+
}
|
|
594
|
+
onPaste(data) {
|
|
595
|
+
const focus = this.sv.selectionStoreService.focused;
|
|
596
|
+
const isEditing = this.sv.selectionStoreService.edited !== null;
|
|
597
|
+
if (!focus || isEditing) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
let { changed, range } = this.sv.columnService.getTransformedDataToApply(focus, data);
|
|
601
|
+
const { defaultPrevented: canPaste } = this.sv.beforePaste(changed, range);
|
|
602
|
+
if (canPaste) {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
this.sv.rangeApply(changed, range);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
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:14px;height:14px;margin-left:-13px;margin-top:-13px;z-index:10;cursor:crosshair}revogr-overlay-selection .autofill-handle::before{content:\"\";position:absolute;right:0;bottom:0;width:10px;height:10px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection.mobile .autofill-handle{position:absolute;width:30px;height:30px;margin-left:-29px;margin-top:-29px;z-index:10;cursor:crosshair}revogr-overlay-selection.mobile .autofill-handle::before{content:\"\";position:absolute;right:0;bottom:0;width:12px;height:12px;background:#0d63e8;border:1px solid white;box-sizing:border-box}revogr-overlay-selection .selection-border-range{position:absolute;pointer-events:none;z-index:9;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 .selection-border-range .range-handlers{height:100%;background-color:transparent;width:75%;max-width:50px;min-width:20px;left:50%;transform:translateX(-50%);position:absolute}revogr-overlay-selection .selection-border-range .range-handlers>span{pointer-events:auto;height:20px;width:20px;position:absolute;left:50%;transform:translateX(-50%)}revogr-overlay-selection .selection-border-range .range-handlers>span:before,revogr-overlay-selection .selection-border-range .range-handlers>span:after{position:absolute;border-radius:5px;width:15px;height:5px;left:50%;transform:translateX(-50%);background-color:rgba(0, 0, 0, 0.2)}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child{top:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:first-child:before{content:\"\";top:0}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child{bottom:-7px}revogr-overlay-selection .selection-border-range .range-handlers>span:last-child:after{content:\"\";bottom:0}revogr-overlay-selection revogr-edit{z-index:10}";
|
|
610
|
+
|
|
611
|
+
const OverlaySelection = class {
|
|
612
|
+
constructor(hostRef) {
|
|
613
|
+
registerInstance(this, hostRef);
|
|
614
|
+
this.internalCopy = createEvent(this, "internalCopy", 7);
|
|
615
|
+
this.internalPaste = createEvent(this, "internalPaste", 7);
|
|
616
|
+
this.internalCellEdit = createEvent(this, "internalCellEdit", 7);
|
|
617
|
+
this.beforeFocusCell = createEvent(this, "beforeFocusCell", 7);
|
|
618
|
+
this.setEdit = createEvent(this, "setEdit", 7);
|
|
619
|
+
this.beforeApplyRange = createEvent(this, "before-apply-range", 7);
|
|
620
|
+
this.beforeSetRange = createEvent(this, "before-set-range", 7);
|
|
621
|
+
this.beforeEditRender = createEvent(this, "before-edit-render", 7);
|
|
622
|
+
this.setRange = createEvent(this, "setRange", 7);
|
|
623
|
+
this.selectAll = createEvent(this, "selectall", 7);
|
|
624
|
+
this.cancelEdit = createEvent(this, "cancelEdit", 7);
|
|
625
|
+
this.setTempRange = createEvent(this, "setTempRange", 7);
|
|
626
|
+
this.applyFocus = createEvent(this, "applyFocus", 7);
|
|
627
|
+
this.focusCell = createEvent(this, "focusCell", 7);
|
|
628
|
+
this.beforeRangeDataApply = createEvent(this, "beforeRangeDataApply", 7);
|
|
629
|
+
this.internalSelectionChanged = createEvent(this, "internalSelectionChanged", 7);
|
|
630
|
+
this.beforeRangeCopyApply = createEvent(this, "beforeRangeCopyApply", 7);
|
|
631
|
+
this.internalRangeDataApply = createEvent(this, "internalRangeDataApply", 7);
|
|
632
|
+
this.rangeClipboardCopy = createEvent(this, "rangeClipboardCopy", 7);
|
|
633
|
+
this.rangeClipboardPaste = createEvent(this, "rangeClipboardPaste", 7);
|
|
634
|
+
this.beforeCellSave = createEvent(this, "before-cell-save", 7);
|
|
635
|
+
this.keyboardService = null;
|
|
636
|
+
this.autoFillService = null;
|
|
637
|
+
this.clipboardService = null;
|
|
638
|
+
this.revogrEdit = null;
|
|
639
|
+
this.readonly = undefined;
|
|
640
|
+
this.range = undefined;
|
|
641
|
+
this.canDrag = undefined;
|
|
642
|
+
this.useClipboard = undefined;
|
|
643
|
+
this.selectionStore = undefined;
|
|
644
|
+
this.dimensionRow = undefined;
|
|
645
|
+
this.dimensionCol = undefined;
|
|
646
|
+
this.dataStore = undefined;
|
|
647
|
+
this.colData = undefined;
|
|
648
|
+
this.lastCell = undefined;
|
|
649
|
+
this.editors = undefined;
|
|
650
|
+
this.applyChangesOnClose = false;
|
|
651
|
+
this.additionalData = undefined;
|
|
652
|
+
this.isMobileDevice = undefined;
|
|
653
|
+
}
|
|
654
|
+
// --------------------------------------------------------------------------
|
|
655
|
+
//
|
|
656
|
+
// Listeners
|
|
657
|
+
//
|
|
658
|
+
// --------------------------------------------------------------------------
|
|
659
|
+
onMouseMove(e) {
|
|
660
|
+
if (this.selectionStoreService.focused) {
|
|
661
|
+
this.autoFillService.selectionMouseMove(e);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/** Action finished inside of the document */
|
|
665
|
+
/** Pointer left document, clear any active operation */
|
|
666
|
+
onMouseUp() {
|
|
667
|
+
this.autoFillService.clearAutoFillSelection();
|
|
668
|
+
}
|
|
669
|
+
/** Row drag started */
|
|
670
|
+
onCellDrag(e) {
|
|
671
|
+
var _a;
|
|
672
|
+
(_a = this.orderEditor) === null || _a === void 0 ? void 0 : _a.dragStart(e.detail);
|
|
673
|
+
}
|
|
674
|
+
/** Get keyboard down from element */
|
|
675
|
+
onKeyUp(e) {
|
|
676
|
+
var _a;
|
|
677
|
+
(_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyUp(e);
|
|
678
|
+
}
|
|
679
|
+
/** Get keyboard down from element */
|
|
680
|
+
onKeyDown(e) {
|
|
681
|
+
var _a;
|
|
682
|
+
if (e.defaultPrevented) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
(_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range);
|
|
686
|
+
}
|
|
687
|
+
// selection & keyboard
|
|
688
|
+
selectionServiceSet(s) {
|
|
689
|
+
this.selectionStoreService = new SelectionStoreService(s, {
|
|
690
|
+
changeRange: range => this.triggerRangeEvent(range),
|
|
691
|
+
focus: (focus, end) => this.doFocus(focus, end),
|
|
692
|
+
});
|
|
693
|
+
this.keyboardService = new KeyboardService({
|
|
694
|
+
selectionStoreService: this.selectionStoreService,
|
|
695
|
+
selectionStore: s,
|
|
696
|
+
range: r => this.selectionStoreService.changeRange(r),
|
|
697
|
+
focusNext: (f, next) => this.doFocus(f, f, next),
|
|
698
|
+
applyEdit: val => {
|
|
699
|
+
if (this.readonly) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
this.doEdit(val);
|
|
703
|
+
},
|
|
704
|
+
cancelEdit: async () => {
|
|
705
|
+
await this.revogrEdit.cancel();
|
|
706
|
+
this.closeEdit();
|
|
707
|
+
},
|
|
708
|
+
clearCell: () => !this.readonly && this.clearCell(),
|
|
709
|
+
internalPaste: () => !this.readonly && this.internalPaste.emit(),
|
|
710
|
+
getData: () => this.getData(),
|
|
711
|
+
selectAll: () => this.selectAll.emit(),
|
|
712
|
+
});
|
|
713
|
+
this.createAutoFillService();
|
|
714
|
+
this.createClipboardService();
|
|
715
|
+
}
|
|
716
|
+
// autofill
|
|
717
|
+
createAutoFillService() {
|
|
718
|
+
this.autoFillService = new AutoFillService({
|
|
719
|
+
selectionStoreService: this.selectionStoreService,
|
|
720
|
+
dimensionRow: this.dimensionRow,
|
|
721
|
+
dimensionCol: this.dimensionCol,
|
|
722
|
+
columnService: this.columnService,
|
|
723
|
+
dataStore: this.dataStore,
|
|
724
|
+
clearRangeDataApply: e => this.beforeRangeDataApply.emit(Object.assign(Object.assign({}, e), this.types)),
|
|
725
|
+
setTempRange: e => this.setTempRange.emit(e),
|
|
726
|
+
selectionChanged: e => this.internalSelectionChanged.emit(e),
|
|
727
|
+
rangeCopy: e => this.beforeRangeCopyApply.emit(e),
|
|
728
|
+
rangeDataApply: e => this.internalRangeDataApply.emit(e),
|
|
729
|
+
setRange: e => this.triggerRangeEvent(e),
|
|
730
|
+
getData: () => this.getData(),
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
// columns
|
|
734
|
+
columnServiceSet() {
|
|
735
|
+
var _a;
|
|
736
|
+
(_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
737
|
+
this.columnService = new ColumnService(this.dataStore, this.colData);
|
|
738
|
+
this.createAutoFillService();
|
|
739
|
+
this.createClipboardService();
|
|
740
|
+
}
|
|
741
|
+
// clipboard
|
|
742
|
+
createClipboardService() {
|
|
743
|
+
this.clipboardService = new ClipboardService({
|
|
744
|
+
selectionStoreService: this.selectionStoreService,
|
|
745
|
+
columnService: this.columnService,
|
|
746
|
+
dataStore: this.dataStore,
|
|
747
|
+
rangeApply: (d, r) => this.autoFillService.onRangeApply(d, r),
|
|
748
|
+
rangeCopy: range => {
|
|
749
|
+
if (!range) {
|
|
750
|
+
return undefined;
|
|
751
|
+
}
|
|
752
|
+
const { data, mapping } = this.columnService.copyRangeArray(range, this.dataStore);
|
|
753
|
+
const event = this.rangeClipboardCopy.emit(Object.assign({ range,
|
|
754
|
+
data,
|
|
755
|
+
mapping }, this.types));
|
|
756
|
+
if (event.defaultPrevented) {
|
|
757
|
+
return undefined;
|
|
758
|
+
}
|
|
759
|
+
return event.detail.data;
|
|
760
|
+
},
|
|
761
|
+
rangeClear: () => !this.readonly && this.clearCell(),
|
|
762
|
+
beforeCopy: range => this.internalCopy.emit(range),
|
|
763
|
+
beforePaste: (data, range) => {
|
|
764
|
+
return this.rangeClipboardPaste.emit(Object.assign({ data,
|
|
765
|
+
range }, this.types));
|
|
766
|
+
},
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
connectedCallback() {
|
|
770
|
+
this.columnServiceSet();
|
|
771
|
+
this.selectionServiceSet(this.selectionStore);
|
|
772
|
+
}
|
|
773
|
+
disconnectedCallback() {
|
|
774
|
+
var _a;
|
|
775
|
+
(_a = this.columnService) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
776
|
+
}
|
|
777
|
+
renderRange(range) {
|
|
778
|
+
const style = getElStyle(range, this.dimensionRow.state, this.dimensionCol.state);
|
|
779
|
+
return [
|
|
780
|
+
h("div", { class: SELECTION_BORDER_CLASS, style: style }, this.isMobileDevice && h("div", { class: "range-handlers" }, h("span", { class: MOBILE_CLASS }), h("span", { class: MOBILE_CLASS })))
|
|
781
|
+
];
|
|
782
|
+
}
|
|
783
|
+
renderEditCell() {
|
|
784
|
+
// if can edit
|
|
785
|
+
const editCell = this.selectionStore.get('edit');
|
|
786
|
+
if (this.readonly || !editCell) {
|
|
787
|
+
return null;
|
|
788
|
+
}
|
|
789
|
+
const val = editCell.val || this.columnService.getCellData(editCell.y, editCell.x);
|
|
790
|
+
const editable = Object.assign(Object.assign({}, editCell), this.columnService.getSaveData(editCell.y, editCell.x, val));
|
|
791
|
+
const renderEvent = this.beforeEditRender.emit(Object.assign({ range: Object.assign(Object.assign({}, editCell), { x1: editCell.x, y1: editCell.y }) }, this.types));
|
|
792
|
+
if (renderEvent.defaultPrevented) {
|
|
793
|
+
return null;
|
|
794
|
+
}
|
|
795
|
+
const { detail: { range }, } = renderEvent;
|
|
796
|
+
const style = getElStyle(range, this.dimensionRow.state, this.dimensionCol.state);
|
|
797
|
+
return (h("revogr-edit", { ref: el => {
|
|
798
|
+
this.revogrEdit = el;
|
|
799
|
+
}, onCellEdit: e => {
|
|
800
|
+
const saveEv = this.beforeCellSave.emit(e.detail);
|
|
801
|
+
if (!saveEv.defaultPrevented) {
|
|
802
|
+
this.cellEdit(saveEv.detail);
|
|
803
|
+
}
|
|
804
|
+
// if not clear navigate to next cell after edit
|
|
805
|
+
if (!saveEv.detail.preventFocus) {
|
|
806
|
+
this.focusNext();
|
|
807
|
+
}
|
|
808
|
+
}, onCloseEdit: e => this.closeEdit(e), editCell: editable, saveOnClose: this.applyChangesOnClose, column: this.columnService.columns[editCell.x], editor: this.columnService.getCellEditor(editCell.y, editCell.x, this.editors), additionalData: this.additionalData, style: style }));
|
|
809
|
+
}
|
|
810
|
+
render() {
|
|
811
|
+
const els = [];
|
|
812
|
+
const editCell = this.renderEditCell();
|
|
813
|
+
if (editCell) {
|
|
814
|
+
els.push(editCell);
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
const range = this.selectionStoreService.ranged;
|
|
818
|
+
const selectionFocus = this.selectionStoreService.focused;
|
|
819
|
+
if ((range || selectionFocus) && this.useClipboard) {
|
|
820
|
+
els.push(this.clipboardService.renderClipboard(this.readonly));
|
|
821
|
+
}
|
|
822
|
+
if (range) {
|
|
823
|
+
els.push(...this.renderRange(range));
|
|
824
|
+
}
|
|
825
|
+
if (selectionFocus && !this.readonly && this.range) {
|
|
826
|
+
els.push(this.autoFillService.renderAutofill(range, selectionFocus));
|
|
827
|
+
}
|
|
828
|
+
if (this.canDrag) {
|
|
829
|
+
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) }));
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
return (h(Host, { class: { mobile: this.isMobileDevice },
|
|
833
|
+
// run edit on dblclick
|
|
834
|
+
onDblClick: (e) => {
|
|
835
|
+
// if dblclick prevented outside edit will not start
|
|
836
|
+
if (!e.defaultPrevented) {
|
|
837
|
+
this.doEdit();
|
|
838
|
+
}
|
|
839
|
+
}, onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, els, h("slot", { name: "data" })));
|
|
840
|
+
}
|
|
841
|
+
doFocus(focus, end, next) {
|
|
842
|
+
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
843
|
+
if (defaultPrevented) {
|
|
844
|
+
return false;
|
|
845
|
+
}
|
|
846
|
+
const evData = Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next }, this.types);
|
|
847
|
+
const applyEvent = this.applyFocus.emit(evData);
|
|
848
|
+
if (applyEvent.defaultPrevented) {
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
const { range } = applyEvent.detail;
|
|
852
|
+
return !this.focusCell.emit(Object.assign({ focus: {
|
|
853
|
+
x: range.x,
|
|
854
|
+
y: range.y,
|
|
855
|
+
}, end: {
|
|
856
|
+
x: range.x1,
|
|
857
|
+
y: range.y1,
|
|
858
|
+
} }, applyEvent.detail)).defaultPrevented;
|
|
859
|
+
}
|
|
860
|
+
triggerRangeEvent(range) {
|
|
861
|
+
const type = this.types.rowType;
|
|
862
|
+
const applyEvent = this.beforeApplyRange.emit(Object.assign({ range: Object.assign({}, range) }, this.types));
|
|
863
|
+
if (applyEvent.defaultPrevented) {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
const data = this.columnService.getRangeTransformedToProps(applyEvent.detail.range, this.dataStore);
|
|
867
|
+
let e = this.beforeSetRange.emit(data);
|
|
868
|
+
e = this.setRange.emit(Object.assign(Object.assign({}, applyEvent.detail.range), { type }));
|
|
869
|
+
if (e.defaultPrevented) {
|
|
870
|
+
return false;
|
|
871
|
+
}
|
|
872
|
+
return !e.defaultPrevented;
|
|
873
|
+
}
|
|
874
|
+
onElementMouseDown(e, touch = false) {
|
|
875
|
+
// Ignore focus if clicked input
|
|
876
|
+
if (isEditInput(e.target)) {
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
const data = this.getData();
|
|
880
|
+
if (e.defaultPrevented) {
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
const x = getFromEvent(e, 'clientX');
|
|
884
|
+
const y = getFromEvent(e, 'clientY');
|
|
885
|
+
// skip touch
|
|
886
|
+
if (x === null || y === null) {
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
// Regular cell click
|
|
890
|
+
const focusCell = getCurrentCell({ x, y }, data);
|
|
891
|
+
this.selectionStoreService.focus(focusCell, this.range && e.shiftKey);
|
|
892
|
+
// Initiate autofill selection
|
|
893
|
+
if (this.range) {
|
|
894
|
+
this.autoFillService.selectionStart(e.target, data);
|
|
895
|
+
if (!touch) {
|
|
896
|
+
e.preventDefault();
|
|
897
|
+
}
|
|
898
|
+
else if (verifyTouchTarget(e.touches[0], MOBILE_CLASS)) {
|
|
899
|
+
e.preventDefault();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Start cell editing
|
|
905
|
+
*/
|
|
906
|
+
doEdit(val = '') {
|
|
907
|
+
var _a;
|
|
908
|
+
if (this.canEdit()) {
|
|
909
|
+
const editCell = this.selectionStore.get('focus');
|
|
910
|
+
const data = this.columnService.getSaveData(editCell.y, editCell.x);
|
|
911
|
+
(_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Close editor event triggered
|
|
916
|
+
* @param details - if requires focus next
|
|
917
|
+
*/
|
|
918
|
+
closeEdit(e) {
|
|
919
|
+
this.cancelEdit.emit();
|
|
920
|
+
if (e === null || e === void 0 ? void 0 : e.detail) {
|
|
921
|
+
this.focusNext();
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
/** Edit finished, close cell and save */
|
|
925
|
+
cellEdit(e) {
|
|
926
|
+
const dataToSave = this.columnService.getSaveData(e.rgRow, e.rgCol, e.val);
|
|
927
|
+
this.internalCellEdit.emit(dataToSave);
|
|
928
|
+
}
|
|
929
|
+
async focusNext() {
|
|
930
|
+
const canFocus = await this.keyboardService.keyChangeSelection(new KeyboardEvent('keydown', {
|
|
931
|
+
code: codesLetter.ARROW_DOWN,
|
|
932
|
+
}), this.range);
|
|
933
|
+
if (!canFocus) {
|
|
934
|
+
this.closeEdit();
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
clearCell() {
|
|
938
|
+
if (this.selectionStoreService.ranged && !isRangeSingleCell(this.selectionStoreService.ranged)) {
|
|
939
|
+
const data = this.columnService.getRangeStaticData(this.selectionStoreService.ranged, '');
|
|
940
|
+
this.autoFillService.onRangeApply(data, this.selectionStoreService.ranged);
|
|
941
|
+
}
|
|
942
|
+
else if (this.canEdit()) {
|
|
943
|
+
const focused = this.selectionStoreService.focused;
|
|
944
|
+
const cell = this.columnService.getSaveData(focused.y, focused.x);
|
|
945
|
+
this.cellEdit({
|
|
946
|
+
rgRow: focused.y,
|
|
947
|
+
rgCol: focused.x,
|
|
948
|
+
val: '',
|
|
949
|
+
type: cell.type,
|
|
950
|
+
prop: cell.prop,
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
onRowDragStart({ detail }) {
|
|
955
|
+
detail.text = this.columnService.getCellData(detail.cell.y, detail.cell.x);
|
|
956
|
+
}
|
|
957
|
+
/** Check if edit possible */
|
|
958
|
+
canEdit() {
|
|
959
|
+
var _a;
|
|
960
|
+
if (this.readonly) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
const editCell = this.selectionStoreService.focused;
|
|
964
|
+
return editCell && !((_a = this.columnService) === null || _a === void 0 ? void 0 : _a.isReadOnly(editCell.y, editCell.x));
|
|
965
|
+
}
|
|
966
|
+
get types() {
|
|
967
|
+
return {
|
|
968
|
+
rowType: this.dataStore.get('type'),
|
|
969
|
+
colType: this.columnService.type,
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
/** Collect data from element */
|
|
973
|
+
getData() {
|
|
974
|
+
return {
|
|
975
|
+
el: this.element,
|
|
976
|
+
rows: this.dimensionRow.state,
|
|
977
|
+
cols: this.dimensionCol.state,
|
|
978
|
+
lastCell: this.lastCell,
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
get element() { return getElement(this); }
|
|
982
|
+
static get watchers() { return {
|
|
983
|
+
"selectionStore": ["selectionServiceSet"],
|
|
984
|
+
"dimensionRow": ["createAutoFillService"],
|
|
985
|
+
"dimensionCol": ["createAutoFillService"],
|
|
986
|
+
"dataStore": ["columnServiceSet"],
|
|
987
|
+
"colData": ["columnServiceSet"]
|
|
988
|
+
}; }
|
|
989
|
+
};
|
|
990
|
+
OverlaySelection.style = revogrOverlayStyleCss;
|
|
991
|
+
|
|
992
|
+
const RowHeaderRender = s => (__, { rowIndex: i }) => s + i;
|
|
993
|
+
|
|
994
|
+
const RevogrRowHeaders = class {
|
|
995
|
+
constructor(hostRef) {
|
|
996
|
+
registerInstance(this, hostRef);
|
|
997
|
+
this.scrollViewport = createEvent(this, "scrollViewport", 3);
|
|
998
|
+
this.elementToScroll = createEvent(this, "elementToScroll", 3);
|
|
999
|
+
this.height = undefined;
|
|
1000
|
+
this.dataPorts = undefined;
|
|
1001
|
+
this.headerProp = undefined;
|
|
1002
|
+
this.uiid = undefined;
|
|
1003
|
+
this.rowClass = undefined;
|
|
1004
|
+
this.resize = undefined;
|
|
1005
|
+
this.rowHeaderColumn = undefined;
|
|
1006
|
+
this.additionalData = undefined;
|
|
1007
|
+
}
|
|
1008
|
+
render() {
|
|
1009
|
+
const dataViews = [];
|
|
1010
|
+
const viewport = new ViewportStore('colPinStart');
|
|
1011
|
+
/** render viewports rows */
|
|
1012
|
+
let totalLength = 1;
|
|
1013
|
+
for (let data of this.dataPorts) {
|
|
1014
|
+
const itemCount = data.dataStore.get('items').length;
|
|
1015
|
+
// initiate row data
|
|
1016
|
+
const dataStore = new DataStore(data.type);
|
|
1017
|
+
dataStore.updateData(data.dataStore.get('source'));
|
|
1018
|
+
// initiate column data
|
|
1019
|
+
const colData = new DataStore('colPinStart');
|
|
1020
|
+
const column = Object.assign({ cellTemplate: RowHeaderRender(totalLength) }, this.rowHeaderColumn);
|
|
1021
|
+
colData.updateData([column]);
|
|
1022
|
+
const viewData = Object.assign(Object.assign({}, data), { rowClass: this.rowClass, dataStore: dataStore.store, colData: colData.store, viewportCol: viewport.store, readonly: true, range: false });
|
|
1023
|
+
dataViews.push(h("revogr-data", Object.assign({}, viewData)));
|
|
1024
|
+
totalLength += itemCount;
|
|
1025
|
+
}
|
|
1026
|
+
const colSize = calculateRowHeaderSize(totalLength, this.rowHeaderColumn);
|
|
1027
|
+
viewport.setViewport({
|
|
1028
|
+
realCount: 1,
|
|
1029
|
+
virtualSize: 0,
|
|
1030
|
+
items: [
|
|
1031
|
+
{
|
|
1032
|
+
size: colSize,
|
|
1033
|
+
start: 0,
|
|
1034
|
+
end: colSize,
|
|
1035
|
+
itemIndex: 0,
|
|
1036
|
+
},
|
|
1037
|
+
],
|
|
1038
|
+
});
|
|
1039
|
+
const parent = `${this.uiid}-rowHeaders`;
|
|
1040
|
+
const viewportScroll = {
|
|
1041
|
+
[UUID]: parent,
|
|
1042
|
+
contentHeight: this.height,
|
|
1043
|
+
contentWidth: 0,
|
|
1044
|
+
style: { minWidth: `${colSize}px` },
|
|
1045
|
+
ref: (el) => this.elementToScroll.emit(el),
|
|
1046
|
+
onScrollViewport: (e) => this.scrollViewport.emit(e.detail),
|
|
1047
|
+
};
|
|
1048
|
+
const viewportHeader = Object.assign(Object.assign({}, this.headerProp), { colData: typeof this.rowHeaderColumn === 'object' ? [this.rowHeaderColumn] : [], viewportCol: viewport.store, canResize: false, type: ROW_HEADER_TYPE, parent, slot: HEADER_SLOT });
|
|
1049
|
+
return (h(Host, { class: { [ROW_HEADER_TYPE]: true }, key: ROW_HEADER_TYPE }, h("revogr-viewport-scroll", Object.assign({}, viewportScroll), h("revogr-header", Object.assign({}, viewportHeader)), dataViews)));
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
const revogrScrollStyleCss = ".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-scroll-virtual[auto-hide]{position:absolute;z-index:100}revogr-scroll-virtual[auto-hide].vertical{right:0;top:0}revogr-scroll-virtual[auto-hide].vertical:hover{min-width:20px}revogr-scroll-virtual[auto-hide].horizontal{bottom:0;left:0}revogr-scroll-virtual[auto-hide].horizontal:hover{min-height:20px}revogr-scroll-virtual.vertical{overflow-y:auto;overflow-x:hidden;height:100%}revogr-scroll-virtual.vertical>div{width:1px}revogr-scroll-virtual.horizontal{overflow-x:auto;overflow-y:hidden;width:100%}revogr-scroll-virtual.horizontal>div{height:1px}";
|
|
1054
|
+
|
|
1055
|
+
const RevogrScrollVirtual = class {
|
|
1056
|
+
constructor(hostRef) {
|
|
1057
|
+
registerInstance(this, hostRef);
|
|
1058
|
+
this.scrollVirtual = createEvent(this, "scrollVirtual", 7);
|
|
1059
|
+
this.scrollSize = 0;
|
|
1060
|
+
this.isAutoHide = false;
|
|
1061
|
+
this.autoHideTimeout = 0;
|
|
1062
|
+
this.dimension = 'rgRow';
|
|
1063
|
+
this.viewportStore = undefined;
|
|
1064
|
+
this.dimensionStore = undefined;
|
|
1065
|
+
}
|
|
1066
|
+
async setScroll(e) {
|
|
1067
|
+
var _a;
|
|
1068
|
+
if (this.dimension !== e.dimension) {
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
(_a = this.scrollService) === null || _a === void 0 ? void 0 : _a.setScroll(e);
|
|
1072
|
+
}
|
|
1073
|
+
// update on delta in case we don't know existing position or external change
|
|
1074
|
+
async changeScroll(e) {
|
|
1075
|
+
if (e.delta) {
|
|
1076
|
+
switch (e.dimension) {
|
|
1077
|
+
case 'rgCol':
|
|
1078
|
+
e.coordinate = this.element.scrollLeft + e.delta;
|
|
1079
|
+
break;
|
|
1080
|
+
case 'rgRow':
|
|
1081
|
+
e.coordinate = this.element.scrollTop + e.delta;
|
|
1082
|
+
break;
|
|
1083
|
+
}
|
|
1084
|
+
this.setScroll(e);
|
|
1085
|
+
}
|
|
1086
|
+
return e;
|
|
1087
|
+
}
|
|
1088
|
+
set size(s) {
|
|
1089
|
+
if (this.dimension === 'rgRow') {
|
|
1090
|
+
this.element.style.minWidth = `${s}px`;
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
this.element.style.minHeight = `${s}px`;
|
|
1094
|
+
}
|
|
1095
|
+
get size() {
|
|
1096
|
+
if (this.dimension === 'rgRow') {
|
|
1097
|
+
return this.element.clientHeight;
|
|
1098
|
+
}
|
|
1099
|
+
return this.element.clientWidth;
|
|
1100
|
+
}
|
|
1101
|
+
connectedCallback() {
|
|
1102
|
+
this.scrollService = new LocalScrollService({
|
|
1103
|
+
beforeScroll: e => this.scrollVirtual.emit(e),
|
|
1104
|
+
afterScroll: e => {
|
|
1105
|
+
const type = e.dimension === 'rgRow' ? 'scrollTop' : 'scrollLeft';
|
|
1106
|
+
this.element[type] = e.coordinate;
|
|
1107
|
+
},
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
disconnectedCallback() {
|
|
1111
|
+
clearTimeout(this.autoHideTimeout);
|
|
1112
|
+
}
|
|
1113
|
+
componentWillLoad() {
|
|
1114
|
+
this.scrollSize = getScrollbarWidth(document);
|
|
1115
|
+
this.isAutoHide = !this.scrollSize;
|
|
1116
|
+
}
|
|
1117
|
+
componentDidRender() {
|
|
1118
|
+
const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';
|
|
1119
|
+
if (this.element[type] > this.size) {
|
|
1120
|
+
this.size = this.scrollSize;
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
this.size = 0;
|
|
1124
|
+
}
|
|
1125
|
+
this.scrollService.setParams({
|
|
1126
|
+
contentSize: this.dimensionStore.get('realSize'),
|
|
1127
|
+
clientSize: this.size,
|
|
1128
|
+
virtualSize: this.viewportStore.get('virtualSize'),
|
|
1129
|
+
}, this.dimension);
|
|
1130
|
+
}
|
|
1131
|
+
onScroll(e) {
|
|
1132
|
+
var _a;
|
|
1133
|
+
let type = 'scrollLeft';
|
|
1134
|
+
if (this.dimension === 'rgRow') {
|
|
1135
|
+
type = 'scrollTop';
|
|
1136
|
+
}
|
|
1137
|
+
if (this.isAutoHide) {
|
|
1138
|
+
this.size = 20;
|
|
1139
|
+
this.autoHideTimeout = this.autoHide(this.autoHideTimeout);
|
|
1140
|
+
}
|
|
1141
|
+
const target = e.target;
|
|
1142
|
+
(_a = this.scrollService) === null || _a === void 0 ? void 0 : _a.scroll(target[type] || 0, this.dimension);
|
|
1143
|
+
}
|
|
1144
|
+
autoHide(timeout) {
|
|
1145
|
+
clearTimeout(timeout);
|
|
1146
|
+
return setTimeout(() => {
|
|
1147
|
+
this.size = 0;
|
|
1148
|
+
}, 6000);
|
|
1149
|
+
}
|
|
1150
|
+
render() {
|
|
1151
|
+
const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
|
|
1152
|
+
return (h(Host, Object.assign({}, { 'auto-hide': this.isAutoHide }, { onScroll: (e) => this.onScroll(e) }), h("div", { style: { [sizeType]: `${this.extContentSize(this.viewportStore.get('virtualSize'), this.dimensionStore.get('realSize'))}px` } })));
|
|
1153
|
+
}
|
|
1154
|
+
extContentSize(vsize, contentSize) {
|
|
1155
|
+
return LocalScrollService.getVirtualContentSize(contentSize, this.size, vsize);
|
|
1156
|
+
}
|
|
1157
|
+
get element() { return getElement(this); }
|
|
1158
|
+
};
|
|
1159
|
+
RevogrScrollVirtual.style = revogrScrollStyleCss;
|
|
1160
|
+
|
|
1161
|
+
const revogrTempRangeStyleCss = ".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}.temp-bg-range{display:block !important;position:absolute;pointer-events:none;z-index:9;border:1px solid rgb(255, 94, 0);box-sizing:border-box}.temp-bg-range.Selection{border:1px dashed gray}.temp-bg-range>div{width:1px;height:1px;position:absolute}.temp-bg-range>div.top{top:-1px}.temp-bg-range>div.bottom{bottom:-1px}.temp-bg-range>div.left{left:-1px}.temp-bg-range>div.right{right:-1px}";
|
|
1162
|
+
|
|
1163
|
+
const RevogrFocus = class {
|
|
1164
|
+
constructor(hostRef) {
|
|
1165
|
+
registerInstance(this, hostRef);
|
|
1166
|
+
this.onChange = lodash.throttle((e) => this.doChange(e), 300);
|
|
1167
|
+
this.selectionStore = undefined;
|
|
1168
|
+
this.dimensionRow = undefined;
|
|
1169
|
+
this.dimensionCol = undefined;
|
|
1170
|
+
}
|
|
1171
|
+
doChange(e) {
|
|
1172
|
+
e === null || e === void 0 ? void 0 : e.scrollIntoView({
|
|
1173
|
+
block: 'nearest',
|
|
1174
|
+
inline: 'nearest',
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
componentDidRender() {
|
|
1178
|
+
if (this.el) {
|
|
1179
|
+
this.onChange(this.el);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
render() {
|
|
1183
|
+
const data = this.selectionStore.get('tempRange');
|
|
1184
|
+
const type = this.selectionStore.get('tempRangeType');
|
|
1185
|
+
if (!data) {
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
let directionY = 'bottom';
|
|
1189
|
+
let derectionX = 'right';
|
|
1190
|
+
const range = this.getRange();
|
|
1191
|
+
if (!range) {
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
if (data.y < range.y) {
|
|
1195
|
+
directionY = 'top';
|
|
1196
|
+
}
|
|
1197
|
+
if (data.x < range.x) {
|
|
1198
|
+
derectionX = 'left';
|
|
1199
|
+
}
|
|
1200
|
+
const directionClass = `${derectionX} ${directionY}`;
|
|
1201
|
+
const style = getElStyle(data, this.dimensionRow.state, this.dimensionCol.state);
|
|
1202
|
+
return (h(Host, { class: {
|
|
1203
|
+
[TMP_SELECTION_BG_CLASS]: true,
|
|
1204
|
+
[type || '']: true,
|
|
1205
|
+
}, style: style, hidden: false }, h("div", { class: directionClass, ref: (e) => (this.el = e) })));
|
|
1206
|
+
}
|
|
1207
|
+
getRange() {
|
|
1208
|
+
const range = this.selectionStore.get('range');
|
|
1209
|
+
if (range) {
|
|
1210
|
+
return range;
|
|
1211
|
+
}
|
|
1212
|
+
const focus = this.selectionStore.get('focus');
|
|
1213
|
+
if (!focus) {
|
|
1214
|
+
return null;
|
|
1215
|
+
}
|
|
1216
|
+
return Object.assign(Object.assign({}, focus), { x1: focus.x, y1: focus.y });
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
RevogrFocus.style = revogrTempRangeStyleCss;
|
|
1220
|
+
|
|
1221
|
+
export { RevogrFocus$1 as revogr_focus, OverlaySelection as revogr_overlay_selection, RevogrRowHeaders as revogr_row_headers, RevogrScrollVirtual as revogr_scroll_virtual, RevogrFocus as revogr_temp_range };
|
|
1222
|
+
|
|
1223
|
+
//# sourceMappingURL=revogr-focus_5.entry.js.map
|