@revolist/revogrid 4.0.10 → 4.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{column.service-e83d9809.js → column.service-bc269420.js} +23 -9
- package/dist/cjs/column.service-bc269420.js.map +1 -0
- package/dist/cjs/{events-7ccd6894.js → events-f8893bba.js} +15 -5
- package/dist/cjs/events-f8893bba.js.map +1 -0
- package/dist/cjs/{header-cell-renderer-8ba9b56d.js → header-cell-renderer-57acd2f7.js} +2 -2
- package/dist/cjs/{header-cell-renderer-8ba9b56d.js.map → header-cell-renderer-57acd2f7.js.map} +1 -1
- package/dist/cjs/{key.utils-dc4ac217.js → key.utils-59b9b528.js} +13 -1
- package/dist/cjs/key.utils-59b9b528.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.entry.js +29 -13
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +176 -131
- package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +28 -11
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +2 -2
- package/dist/collection/components/data/column.service.js.map +1 -1
- package/dist/collection/components/data/revogr-data.js +1 -1
- package/dist/collection/components/editors/edit.utils.js +4 -0
- package/dist/collection/components/editors/edit.utils.js.map +1 -1
- package/dist/collection/components/editors/revogr-edit.js +30 -12
- package/dist/collection/components/editors/revogr-edit.js.map +1 -1
- package/dist/collection/components/order/revogr-order-editor.js +4 -1
- package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
- package/dist/collection/components/overlay/autofill.service.js +36 -24
- package/dist/collection/components/overlay/autofill.service.js.map +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +7 -7
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/overlay/revogr-overlay-selection.js +107 -59
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
- package/dist/collection/components/overlay/selection.utils.js +37 -9
- package/dist/collection/components/overlay/selection.utils.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid-style.css +8 -3
- package/dist/collection/components/revoGrid/revo-grid.js +26 -11
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.helpers.js +22 -8
- package/dist/collection/components/revoGrid/viewport.helpers.js.map +1 -1
- package/dist/collection/components/revoGrid/viewport.service.js +1 -0
- package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
- package/dist/collection/serve/controller.js +86 -18
- package/dist/collection/store/selection/index.js +0 -1
- package/dist/collection/store/selection/index.js.map +1 -1
- package/dist/collection/types/interfaces.js +4 -0
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/collection/utils/events.js +11 -1
- package/dist/collection/utils/events.js.map +1 -1
- package/dist/collection/utils/row-header-utils.js +2 -2
- package/dist/collection/utils/row-header-utils.js.map +1 -1
- package/dist/esm/{column.service-f4922a8d.js → column.service-195345ab.js} +23 -9
- package/dist/esm/column.service-195345ab.js.map +1 -0
- package/dist/esm/{events-3dd8ee7c.js → events-3e39de50.js} +15 -5
- package/dist/esm/events-3e39de50.js.map +1 -0
- package/dist/esm/{header-cell-renderer-ac962570.js → header-cell-renderer-7c76465d.js} +2 -2
- package/dist/esm/{header-cell-renderer-ac962570.js.map → header-cell-renderer-7c76465d.js.map} +1 -1
- package/dist/esm/{key.utils-4586a3d6.js → key.utils-2836e8ae.js} +12 -2
- package/dist/esm/key.utils-2836e8ae.js.map +1 -0
- package/dist/esm/revo-grid.entry.js +29 -13
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +177 -132
- package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js +28 -11
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +2 -2
- package/dist/revo-grid/column.service-195345ab.js +5 -0
- package/dist/revo-grid/column.service-195345ab.js.map +1 -0
- package/dist/revo-grid/{events-3dd8ee7c.js → events-3e39de50.js} +2 -2
- package/dist/revo-grid/events-3e39de50.js.map +1 -0
- package/dist/revo-grid/{header-cell-renderer-ac962570.js → header-cell-renderer-7c76465d.js} +2 -2
- package/dist/revo-grid/key.utils-2836e8ae.js +5 -0
- package/dist/revo-grid/key.utils-2836e8ae.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/types/components/data/column.service.d.ts +2 -2
- package/dist/types/components/editors/edit.utils.d.ts +2 -0
- package/dist/types/components/order/revogr-order-editor.d.ts +3 -0
- package/dist/types/components/overlay/autofill.service.d.ts +9 -6
- package/dist/types/components/overlay/keyboard.service.d.ts +2 -3
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +38 -15
- package/dist/types/components/overlay/selection.utils.d.ts +12 -4
- package/dist/types/components/revoGrid/revo-grid.d.ts +4 -1
- package/dist/types/components/revoGrid/viewport.helpers.d.ts +11 -2
- package/dist/types/components.d.ts +26 -2
- package/dist/types/store/selection/index.d.ts +0 -1
- package/dist/types/types/interfaces.d.ts +444 -23
- package/dist/types/types/selection.d.ts +1 -1
- package/dist/types/utils/events.d.ts +4 -1
- package/dist/types/utils/row-header-utils.d.ts +1 -1
- package/hydrate/index.js +296 -179
- package/package.json +5 -6
- package/standalone/column.service.js.map +1 -1
- package/standalone/revo-grid.js +28 -11
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-edit2.js +37 -11
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-focus2.js +1 -1
- package/standalone/revogr-order-editor2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +142 -150
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +2 -2
- package/standalone/revogr-row-headers2.js.map +1 -1
- package/standalone/revogr-temp-range2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +22 -8
- package/standalone/revogr-viewport-scroll2.js.map +1 -1
- package/standalone/selection.utils.js +72 -9
- package/standalone/selection.utils.js.map +1 -1
- package/dist/cjs/column.service-e83d9809.js.map +0 -1
- package/dist/cjs/events-7ccd6894.js.map +0 -1
- package/dist/cjs/key.utils-dc4ac217.js.map +0 -1
- package/dist/collection/store/selection/selection.store.service.js +0 -39
- package/dist/collection/store/selection/selection.store.service.js.map +0 -1
- package/dist/esm/column.service-f4922a8d.js.map +0 -1
- package/dist/esm/events-3dd8ee7c.js.map +0 -1
- package/dist/esm/key.utils-4586a3d6.js.map +0 -1
- package/dist/revo-grid/column.service-f4922a8d.js +0 -5
- package/dist/revo-grid/column.service-f4922a8d.js.map +0 -1
- package/dist/revo-grid/events-3dd8ee7c.js.map +0 -1
- package/dist/revo-grid/key.utils-4586a3d6.js +0 -5
- package/dist/revo-grid/key.utils-4586a3d6.js.map +0 -1
- package/dist/types/store/selection/selection.store.service.d.ts +0 -17
- /package/dist/revo-grid/{header-cell-renderer-ac962570.js.map → header-cell-renderer-7c76465d.js.map} +0 -0
|
@@ -3,81 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { g as getRange, C as ColumnService, a as isRangeSingleCell } from './column.service.js';
|
|
6
|
-
import { c as codesLetter, i as isClear, a as isEnterKey, b as isCopy, e as isCut, f as isPaste, g as isAll, h as isLetterKey, d as defineCustomElement$2 } from './revogr-edit2.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { c as codesLetter, i as isClear, a as isEnterKey, b as isCopy, e as isCut, f as isPaste, g as isAll, h as isLetterKey, j as isEditInput, d as defineCustomElement$2 } from './revogr-edit2.js';
|
|
7
|
+
import { R as RESIZE_INTERVAL, k as CELL_HANDLER_CLASS, l as MOBILE_CLASS, S as SELECTION_BORDER_CLASS } from './consts.js';
|
|
8
|
+
import { b as getCoordinate, i as isAfterLast, c as isBeforeFirst, d as getCell, g as getPropertyFromEvent, e as getCurrentCell, a as getElStyle, f as getFocusCellBasedOnEvent, v as verifyTouchTarget } from './selection.utils.js';
|
|
9
9
|
import { t as timeout } from './index2.js';
|
|
10
10
|
import { d as debounce_1 } from './debounce.js';
|
|
11
11
|
import { b as getSourceItem } from './data.store.js';
|
|
12
12
|
import { d as defineCustomElement$3 } from './revogr-clipboard2.js';
|
|
13
13
|
import { d as defineCustomElement$1 } from './revogr-order-editor2.js';
|
|
14
14
|
|
|
15
|
-
class SelectionStoreService {
|
|
16
|
-
constructor(store, config) {
|
|
17
|
-
this.store = store;
|
|
18
|
-
this.config = config;
|
|
19
|
-
this.store = store;
|
|
20
|
-
}
|
|
21
|
-
get edited() {
|
|
22
|
-
return this.store.get('edit');
|
|
23
|
-
}
|
|
24
|
-
get focused() {
|
|
25
|
-
return this.store.get('focus');
|
|
26
|
-
}
|
|
27
|
-
get ranged() {
|
|
28
|
-
return this.store.get('range');
|
|
29
|
-
}
|
|
30
|
-
changeRange(range) {
|
|
31
|
-
return this.config.changeRange(range);
|
|
32
|
-
}
|
|
33
|
-
focus(cell, isMulti = false) {
|
|
34
|
-
if (!cell) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
let end = cell;
|
|
38
|
-
// range edit
|
|
39
|
-
if (isMulti) {
|
|
40
|
-
let start = this.store.get('focus');
|
|
41
|
-
if (start) {
|
|
42
|
-
return this.config.changeRange(getRange(start, end));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// single focus
|
|
46
|
-
return this.config.focus(cell, end);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function isTouch(e) {
|
|
51
|
-
return !!e.touches;
|
|
52
|
-
}
|
|
53
|
-
function verifyTouchTarget(touchEvent, focusClass) {
|
|
54
|
-
if (focusClass && touchEvent) {
|
|
55
|
-
if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
function getFromEvent(e, prop, focusClass // for touch events
|
|
62
|
-
) {
|
|
63
|
-
if (isTouch(e)) {
|
|
64
|
-
if (e.touches.length > 0) {
|
|
65
|
-
const touchEvent = e.touches[0];
|
|
66
|
-
if (!verifyTouchTarget(touchEvent, focusClass)) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
return touchEvent[prop] || 0;
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
return e[prop] || 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// is edit input
|
|
77
|
-
function isEditInput(el) {
|
|
78
|
-
return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
15
|
const DIRECTION_CODES = [
|
|
82
16
|
codesLetter.TAB,
|
|
83
17
|
codesLetter.ARROW_UP,
|
|
@@ -89,9 +23,9 @@ class KeyboardService {
|
|
|
89
23
|
constructor(sv) {
|
|
90
24
|
this.sv = sv;
|
|
91
25
|
}
|
|
92
|
-
async keyDown(e, canRange) {
|
|
26
|
+
async keyDown(e, canRange, isEditMode, { range, focus }) {
|
|
93
27
|
// IF EDIT MODE
|
|
94
|
-
if (
|
|
28
|
+
if (isEditMode) {
|
|
95
29
|
switch (e.code) {
|
|
96
30
|
case codesLetter.ESCAPE:
|
|
97
31
|
this.sv.cancel();
|
|
@@ -101,12 +35,12 @@ class KeyboardService {
|
|
|
101
35
|
}
|
|
102
36
|
// IF NOT EDIT MODE
|
|
103
37
|
// pressed clear key
|
|
104
|
-
if (
|
|
38
|
+
if (range && isClear(e.code)) {
|
|
105
39
|
this.sv.clearCell();
|
|
106
40
|
return;
|
|
107
41
|
}
|
|
108
42
|
// below works with focus only
|
|
109
|
-
if (!
|
|
43
|
+
if (!focus) {
|
|
110
44
|
return;
|
|
111
45
|
}
|
|
112
46
|
// tab key means same as arrow right
|
|
@@ -182,7 +116,7 @@ class KeyboardService {
|
|
|
182
116
|
}
|
|
183
117
|
if (isMulti) {
|
|
184
118
|
const eData = this.sv.getData();
|
|
185
|
-
if (isAfterLast(data.end, eData) || isBeforeFirst(data.start)) {
|
|
119
|
+
if (isAfterLast(data.end, eData.lastCell) || isBeforeFirst(data.start)) {
|
|
186
120
|
return false;
|
|
187
121
|
}
|
|
188
122
|
const range = getRange(data.start, data.end);
|
|
@@ -234,7 +168,10 @@ class AutoFillService {
|
|
|
234
168
|
return (h("div", { class: {
|
|
235
169
|
[CELL_HANDLER_CLASS]: true,
|
|
236
170
|
[MOBILE_CLASS]: true,
|
|
237
|
-
}, style: {
|
|
171
|
+
}, style: {
|
|
172
|
+
left: `${handlerStyle.right}px`,
|
|
173
|
+
top: `${handlerStyle.bottom}px`,
|
|
174
|
+
}, onMouseDown: (e) => this.autoFillHandler(e), onTouchStart: (e) => this.autoFillHandler(e) }));
|
|
238
175
|
}
|
|
239
176
|
autoFillHandler(e, type = "AutoFill" /* AutoFillType.autoFill */) {
|
|
240
177
|
let target = null;
|
|
@@ -250,7 +187,9 @@ class AutoFillService {
|
|
|
250
187
|
get isAutoFill() {
|
|
251
188
|
return !!this.autoFillType;
|
|
252
189
|
}
|
|
253
|
-
/**
|
|
190
|
+
/**
|
|
191
|
+
* Process mouse move events
|
|
192
|
+
*/
|
|
254
193
|
selectionMouseMove(e) {
|
|
255
194
|
// initiate mouse move debounce if not present
|
|
256
195
|
if (!this.onMouseMoveAutofill) {
|
|
@@ -260,9 +199,7 @@ class AutoFillService {
|
|
|
260
199
|
this.onMouseMoveAutofill(e, this.sv.getData());
|
|
261
200
|
}
|
|
262
201
|
}
|
|
263
|
-
getFocus() {
|
|
264
|
-
let focus = this.sv.selectionStoreService.focused;
|
|
265
|
-
const range = this.sv.selectionStoreService.ranged;
|
|
202
|
+
getFocus(focus, range) {
|
|
266
203
|
// there was an issue that it was taking last cell from range but focus was out
|
|
267
204
|
if (!focus && range) {
|
|
268
205
|
focus = { x: range.x, y: range.y };
|
|
@@ -278,8 +215,8 @@ class AutoFillService {
|
|
|
278
215
|
if (!this.autoFillInitial) {
|
|
279
216
|
return;
|
|
280
217
|
}
|
|
281
|
-
const x =
|
|
282
|
-
const y =
|
|
218
|
+
const x = getPropertyFromEvent(event, 'clientX', MOBILE_CLASS);
|
|
219
|
+
const y = getPropertyFromEvent(event, 'clientY', MOBILE_CLASS);
|
|
283
220
|
// skip touch
|
|
284
221
|
if (x === null || y === null) {
|
|
285
222
|
return;
|
|
@@ -292,11 +229,12 @@ class AutoFillService {
|
|
|
292
229
|
}
|
|
293
230
|
}
|
|
294
231
|
// check if not the latest, if latest - do nothing
|
|
295
|
-
if (isAfterLast(current, data)) {
|
|
232
|
+
if (isAfterLast(current, data.lastCell)) {
|
|
296
233
|
return;
|
|
297
234
|
}
|
|
298
235
|
this.autoFillLast = current;
|
|
299
|
-
const isSame = current.x === this.autoFillInitial.x &&
|
|
236
|
+
const isSame = current.x === this.autoFillInitial.x &&
|
|
237
|
+
current.y === this.autoFillInitial.y;
|
|
300
238
|
// if same as initial - clear
|
|
301
239
|
if (isSame) {
|
|
302
240
|
this.sv.setTempRange(null);
|
|
@@ -317,39 +255,48 @@ class AutoFillService {
|
|
|
317
255
|
selectionStart(target, data, type = "Selection" /* AutoFillType.selection */) {
|
|
318
256
|
/** Get cell by autofill element */
|
|
319
257
|
const { top, left } = target.getBoundingClientRect();
|
|
320
|
-
this.autoFillInitial = this.getFocus();
|
|
258
|
+
this.autoFillInitial = this.getFocus(data.focus, data.range);
|
|
321
259
|
this.autoFillType = type;
|
|
322
260
|
this.autoFillStart = getCurrentCell({ x: left, y: top }, data);
|
|
323
261
|
}
|
|
324
262
|
/**
|
|
325
|
-
* Clear current range selection
|
|
326
|
-
* on mouse up and mouse leave events
|
|
263
|
+
* Clear current range selection on mouse up and mouse leave events
|
|
327
264
|
*/
|
|
328
|
-
clearAutoFillSelection() {
|
|
329
|
-
//
|
|
265
|
+
clearAutoFillSelection(focus, oldRange) {
|
|
266
|
+
// If autofill was active, apply autofill values
|
|
330
267
|
if (this.autoFillInitial) {
|
|
331
|
-
//
|
|
332
|
-
this.autoFillInitial = this.getFocus();
|
|
333
|
-
// Apply range data if
|
|
268
|
+
// Fetch latest focus
|
|
269
|
+
this.autoFillInitial = this.getFocus(focus, oldRange);
|
|
270
|
+
// Apply range data if autofill mode is active
|
|
334
271
|
if (this.autoFillType === "AutoFill" /* AutoFillType.autoFill */) {
|
|
335
272
|
const range = getRange(this.autoFillInitial, this.autoFillLast);
|
|
273
|
+
// If range is present, apply data
|
|
336
274
|
if (range) {
|
|
337
|
-
const { defaultPrevented: stopApply, detail: { range: newRange } } = this.sv.clearRangeDataApply({
|
|
275
|
+
const { defaultPrevented: stopApply, detail: { range: newRange }, } = this.sv.clearRangeDataApply({
|
|
338
276
|
range,
|
|
339
277
|
});
|
|
278
|
+
// If data apply was not prevented, apply new range
|
|
340
279
|
if (!stopApply) {
|
|
341
|
-
this.applyRangeWithData(newRange);
|
|
280
|
+
this.applyRangeWithData(newRange, oldRange);
|
|
342
281
|
}
|
|
343
282
|
else {
|
|
344
|
-
//
|
|
283
|
+
// If data apply was prevented, clear temporary range
|
|
345
284
|
this.sv.setTempRange(null);
|
|
346
285
|
}
|
|
347
286
|
}
|
|
348
287
|
}
|
|
349
288
|
else {
|
|
289
|
+
// If not autofill mode, apply range only
|
|
350
290
|
this.applyRangeOnly(this.autoFillInitial, this.autoFillLast);
|
|
351
291
|
}
|
|
352
292
|
}
|
|
293
|
+
// Reset autofill state
|
|
294
|
+
this.resetAutoFillState();
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Reset autofill state
|
|
298
|
+
*/
|
|
299
|
+
resetAutoFillState() {
|
|
353
300
|
this.autoFillType = null;
|
|
354
301
|
this.autoFillInitial = null;
|
|
355
302
|
this.autoFillLast = null;
|
|
@@ -369,8 +316,7 @@ class AutoFillService {
|
|
|
369
316
|
this.sv.setRange(range);
|
|
370
317
|
}
|
|
371
318
|
/** Apply range and copy data during range application */
|
|
372
|
-
applyRangeWithData(newRange) {
|
|
373
|
-
const oldRange = this.sv.selectionStoreService.ranged;
|
|
319
|
+
applyRangeWithData(newRange, oldRange) {
|
|
374
320
|
const rangeData = {
|
|
375
321
|
type: this.sv.dataStore.get('type'),
|
|
376
322
|
colType: this.sv.columnService.type,
|
|
@@ -460,44 +406,60 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
460
406
|
// #endregion
|
|
461
407
|
// #region Listeners
|
|
462
408
|
onMouseMove(e) {
|
|
463
|
-
if (this.
|
|
409
|
+
if (this.selectionStore.get('focus')) {
|
|
464
410
|
this.autoFillService.selectionMouseMove(e);
|
|
465
411
|
}
|
|
466
412
|
}
|
|
467
|
-
/**
|
|
468
|
-
|
|
413
|
+
/**
|
|
414
|
+
* Action finished inside of the document.
|
|
415
|
+
* Pointer left document, clear any active operation.
|
|
416
|
+
*/
|
|
469
417
|
onMouseUp() {
|
|
470
|
-
|
|
418
|
+
// Clear auto fill selection
|
|
419
|
+
// when pointer left document,
|
|
420
|
+
// clear any active operation.
|
|
421
|
+
this.autoFillService.clearAutoFillSelection(this.selectionStore.get('focus'), this.selectionStore.get('range'));
|
|
471
422
|
}
|
|
472
|
-
/**
|
|
423
|
+
/**
|
|
424
|
+
* Row drag started.
|
|
425
|
+
* This event is fired when drag action started on cell.
|
|
426
|
+
*/
|
|
473
427
|
onCellDrag(e) {
|
|
474
428
|
var _a;
|
|
429
|
+
// Invoke drag start on order editor.
|
|
475
430
|
(_a = this.orderEditor) === null || _a === void 0 ? void 0 : _a.dragStart(e.detail);
|
|
476
431
|
}
|
|
477
|
-
/**
|
|
432
|
+
/**
|
|
433
|
+
* Get keyboard down from element.
|
|
434
|
+
* This event is fired when keyboard key is released.
|
|
435
|
+
*/
|
|
478
436
|
onKeyUp(e) {
|
|
437
|
+
// Emit before key up event.
|
|
479
438
|
this.beforeKeyUp.emit(e);
|
|
480
439
|
}
|
|
481
|
-
/**
|
|
440
|
+
/**
|
|
441
|
+
* Get keyboard down from element.
|
|
442
|
+
* This event is fired when keyboard key is pressed.
|
|
443
|
+
*/
|
|
482
444
|
onKeyDown(e) {
|
|
483
445
|
var _a;
|
|
446
|
+
// Emit before key down event and check if default prevention is set.
|
|
484
447
|
const proxy = this.beforeKeyDown.emit(e);
|
|
485
448
|
if (e.defaultPrevented || proxy.defaultPrevented) {
|
|
486
449
|
return;
|
|
487
450
|
}
|
|
488
|
-
|
|
451
|
+
// Invoke key down on keyboard service.
|
|
452
|
+
(_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range, !!this.selectionStore.get('edit'), {
|
|
453
|
+
focus: this.selectionStore.get('focus'),
|
|
454
|
+
range: this.selectionStore.get('range'),
|
|
455
|
+
});
|
|
489
456
|
}
|
|
490
457
|
// #endregion
|
|
491
458
|
/** Selection & Keyboard */
|
|
492
459
|
selectionServiceSet(s) {
|
|
493
|
-
this.selectionStoreService = new SelectionStoreService(s, {
|
|
494
|
-
changeRange: range => this.triggerRangeEvent(range),
|
|
495
|
-
focus: (focus, end) => this.doFocus(focus, end),
|
|
496
|
-
});
|
|
497
460
|
this.keyboardService = new KeyboardService({
|
|
498
|
-
selectionStoreService: this.selectionStoreService,
|
|
499
461
|
selectionStore: s,
|
|
500
|
-
range: r => this.
|
|
462
|
+
range: r => this.triggerRangeEvent(r),
|
|
501
463
|
focusNext: (f, next) => this.doFocus(f, f, next),
|
|
502
464
|
change: val => {
|
|
503
465
|
if (this.readonly) {
|
|
@@ -519,7 +481,6 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
519
481
|
/** Autofill */
|
|
520
482
|
createAutoFillService() {
|
|
521
483
|
this.autoFillService = new AutoFillService({
|
|
522
|
-
selectionStoreService: this.selectionStoreService,
|
|
523
484
|
dimensionRow: this.dimensionRow,
|
|
524
485
|
dimensionCol: this.dimensionCol,
|
|
525
486
|
columnService: this.columnService,
|
|
@@ -595,10 +556,10 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
595
556
|
nodes.push(editCell);
|
|
596
557
|
}
|
|
597
558
|
else {
|
|
598
|
-
const range = this.
|
|
599
|
-
const
|
|
559
|
+
const range = this.selectionStore.get('range');
|
|
560
|
+
const focus = this.selectionStore.get('focus');
|
|
600
561
|
// Clipboard
|
|
601
|
-
if ((range ||
|
|
562
|
+
if ((range || focus) && this.useClipboard) {
|
|
602
563
|
nodes.push(h("revogr-clipboard", { readonly: this.readonly, onCopyregion: e => this.onCopy(e.detail), onClearregion: () => !this.readonly && this.clearCell(), ref: e => (this.clipboard = e), onPasteregion: e => this.onPaste(e.detail) }));
|
|
603
564
|
}
|
|
604
565
|
// Range
|
|
@@ -606,23 +567,19 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
606
567
|
nodes.push(...this.renderRange(range));
|
|
607
568
|
}
|
|
608
569
|
// Autofill
|
|
609
|
-
if (
|
|
610
|
-
nodes.push(this.autoFillService.renderAutofill(range,
|
|
570
|
+
if (focus && !this.readonly && this.range) {
|
|
571
|
+
nodes.push(this.autoFillService.renderAutofill(range, focus));
|
|
611
572
|
}
|
|
612
573
|
// Order
|
|
613
574
|
if (this.canDrag) {
|
|
614
575
|
nodes.push(h("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, onRowdragstartinit: e => this.rowDragStart(e) }));
|
|
615
576
|
}
|
|
616
577
|
}
|
|
617
|
-
return (h(Host, { key: '
|
|
618
|
-
// Open Editor on DblClick
|
|
619
|
-
onDblClick: (e) => {
|
|
620
|
-
// DblClick prevented outside - Editor will not open
|
|
621
|
-
if (!e.defaultPrevented) {
|
|
622
|
-
this.doEdit();
|
|
623
|
-
}
|
|
624
|
-
}, onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, h("slot", { key: '89b9bec7824739ea11fadeecbf3908ac74e85c96', name: "data" })));
|
|
578
|
+
return (h(Host, { key: '9dbb6247aebf4ad00c1c8c78852191671be33a11', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, h("slot", { key: '7769092a5029c5a49da8c2d6f36eb9f17b461bc2', name: "data" })));
|
|
625
579
|
}
|
|
580
|
+
/**
|
|
581
|
+
* Executes the focus operation on the specified range of cells.
|
|
582
|
+
*/
|
|
626
583
|
doFocus(focus, end, next) {
|
|
627
584
|
const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
|
|
628
585
|
if (defaultPrevented) {
|
|
@@ -656,31 +613,48 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
656
613
|
}
|
|
657
614
|
return !e.defaultPrevented;
|
|
658
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* Open Editor on DblClick
|
|
618
|
+
*/
|
|
619
|
+
onElementDblClick(e) {
|
|
620
|
+
// DblClick prevented outside - Editor will not open
|
|
621
|
+
// Get data from the component
|
|
622
|
+
const data = this.getData();
|
|
623
|
+
const focusCell = getFocusCellBasedOnEvent(e, data);
|
|
624
|
+
if (!focusCell) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
this.doEdit();
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Handle mouse down event on Host element
|
|
631
|
+
*/
|
|
659
632
|
onElementMouseDown(e, touch = false) {
|
|
633
|
+
// Get the target element from the event object
|
|
634
|
+
const targetElement = e.target;
|
|
660
635
|
// Ignore focus if clicked input
|
|
661
|
-
if (isEditInput(
|
|
636
|
+
if (isEditInput(targetElement)) {
|
|
662
637
|
return;
|
|
663
638
|
}
|
|
639
|
+
// Get data from the component
|
|
664
640
|
const data = this.getData();
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
const x = getFromEvent(e, 'clientX');
|
|
669
|
-
const y = getFromEvent(e, 'clientY');
|
|
670
|
-
// skip touch
|
|
671
|
-
if (x === null || y === null) {
|
|
641
|
+
const focusCell = getFocusCellBasedOnEvent(e, data);
|
|
642
|
+
if (!focusCell) {
|
|
672
643
|
return;
|
|
673
644
|
}
|
|
674
|
-
//
|
|
675
|
-
|
|
676
|
-
this.selectionStoreService.focus(focusCell, this.range && e.shiftKey);
|
|
645
|
+
// Set focus on the current cell
|
|
646
|
+
this.focus(focusCell, this.range && e.shiftKey);
|
|
677
647
|
// Initiate autofill selection
|
|
678
648
|
if (this.range) {
|
|
679
|
-
this.autoFillService.selectionStart(
|
|
649
|
+
this.autoFillService.selectionStart(targetElement, this.getData());
|
|
650
|
+
// Prevent default behavior for mouse events,
|
|
651
|
+
// but only if target element is not a mobile input
|
|
680
652
|
if (!touch) {
|
|
681
653
|
e.preventDefault();
|
|
682
654
|
}
|
|
683
655
|
else if (verifyTouchTarget(e.touches[0], MOBILE_CLASS)) {
|
|
656
|
+
// Prevent default behavior for touch events
|
|
657
|
+
// if target element is a mobile input
|
|
684
658
|
e.preventDefault();
|
|
685
659
|
}
|
|
686
660
|
}
|
|
@@ -691,8 +665,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
691
665
|
doEdit(val = '') {
|
|
692
666
|
var _a;
|
|
693
667
|
if (this.canEdit()) {
|
|
694
|
-
const
|
|
695
|
-
const data = this.columnService.getSaveData(
|
|
668
|
+
const focus = this.selectionStore.get('focus');
|
|
669
|
+
const data = this.columnService.getSaveData(focus.y, focus.x);
|
|
696
670
|
(_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
|
|
697
671
|
}
|
|
698
672
|
}
|
|
@@ -715,8 +689,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
715
689
|
this.cellEditApply.emit(dataToSave);
|
|
716
690
|
}
|
|
717
691
|
getRegion() {
|
|
718
|
-
const focus = this.
|
|
719
|
-
let range = this.
|
|
692
|
+
const focus = this.selectionStore.get('focus');
|
|
693
|
+
let range = this.selectionStore.get('range');
|
|
720
694
|
if (!range) {
|
|
721
695
|
range = getRange(focus, focus);
|
|
722
696
|
}
|
|
@@ -742,8 +716,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
742
716
|
return true;
|
|
743
717
|
}
|
|
744
718
|
onPaste(data) {
|
|
745
|
-
const focus = this.
|
|
746
|
-
const isEditing = this.
|
|
719
|
+
const focus = this.selectionStore.get('focus');
|
|
720
|
+
const isEditing = this.selectionStore.get('edit') !== null;
|
|
747
721
|
if (!focus || isEditing) {
|
|
748
722
|
return;
|
|
749
723
|
}
|
|
@@ -763,13 +737,13 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
763
737
|
}
|
|
764
738
|
}
|
|
765
739
|
clearCell() {
|
|
766
|
-
if (this.
|
|
767
|
-
!isRangeSingleCell(this.
|
|
768
|
-
const data = this.columnService.getRangeStaticData(this.
|
|
769
|
-
this.autoFillService.onRangeApply(data, this.
|
|
740
|
+
if (this.selectionStore.get('range') &&
|
|
741
|
+
!isRangeSingleCell(this.selectionStore.get('range'))) {
|
|
742
|
+
const data = this.columnService.getRangeStaticData(this.selectionStore.get('range'), '');
|
|
743
|
+
this.autoFillService.onRangeApply(data, this.selectionStore.get('range'));
|
|
770
744
|
}
|
|
771
745
|
else if (this.canEdit()) {
|
|
772
|
-
const focused = this.
|
|
746
|
+
const focused = this.selectionStore.get('focus');
|
|
773
747
|
const cell = this.columnService.getSaveData(focused.y, focused.x);
|
|
774
748
|
this.cellEdit({
|
|
775
749
|
rgRow: focused.y,
|
|
@@ -791,8 +765,24 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
791
765
|
if (this.readonly) {
|
|
792
766
|
return false;
|
|
793
767
|
}
|
|
794
|
-
const
|
|
795
|
-
return
|
|
768
|
+
const focus = this.selectionStore.get('focus');
|
|
769
|
+
return focus && !((_a = this.columnService) === null || _a === void 0 ? void 0 : _a.isReadOnly(focus.y, focus.x));
|
|
770
|
+
}
|
|
771
|
+
get edited() {
|
|
772
|
+
return this.selectionStore.get('edit');
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Sets the focus on a cell and optionally edits a range.
|
|
776
|
+
*/
|
|
777
|
+
focus(cell, isRangeEdit = false) {
|
|
778
|
+
if (!cell)
|
|
779
|
+
return false;
|
|
780
|
+
const end = cell;
|
|
781
|
+
const start = this.selectionStore.get('focus');
|
|
782
|
+
if (isRangeEdit && start) {
|
|
783
|
+
return this.triggerRangeEvent(getRange(start, end));
|
|
784
|
+
}
|
|
785
|
+
return this.doFocus(cell, end);
|
|
796
786
|
}
|
|
797
787
|
get types() {
|
|
798
788
|
return {
|
|
@@ -809,6 +799,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class OverlaySelection
|
|
|
809
799
|
rows: this.dimensionRow.state,
|
|
810
800
|
cols: this.dimensionCol.state,
|
|
811
801
|
lastCell: this.lastCell,
|
|
802
|
+
focus: this.selectionStore.get('focus'),
|
|
803
|
+
range: this.selectionStore.get('range'),
|
|
812
804
|
};
|
|
813
805
|
}
|
|
814
806
|
get element() { return this; }
|
|
@@ -871,6 +863,6 @@ function defineCustomElement() {
|
|
|
871
863
|
} });
|
|
872
864
|
}
|
|
873
865
|
|
|
874
|
-
export { OverlaySelection as O, defineCustomElement as d
|
|
866
|
+
export { OverlaySelection as O, defineCustomElement as d };
|
|
875
867
|
|
|
876
868
|
//# sourceMappingURL=revogr-overlay-selection2.js.map
|