@endge/ui-vue 0.25.1 → 0.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
- import { r as f, h as c, H as S, c as l, p as O, f as F, N as L, O as p, P as H, Q as T, U as W, W as m, X as A, Y as u, V as B, D as P, Z as V, _ as D, $ as N, a0 as $, o as b, t as K, a1 as U, l as X, a2 as Y, R as G, a3 as _ } from "./main-BP5C1P4E.js";
2
- import { v as Z, g as C } from "./events-BvSmBueA-Doh7RyHn.js";
3
- import { i as z, a as j, b as Q, c as q, d as J, e as ee, f as te, g as ie, h as se } from "./edit.utils-Dnnbd0xG-DNaocRiD.js";
1
+ import { r as v, h as c, H as b, c as a, u as O, f as E, O as L, P as p, Q as H, U as T, W, X as m, Y as A, Z as u, V as B, s as P, _ as V, $ as D, a0 as K, a1 as $, q as S, t as N, a2 as U, m as G, a3 as X, n as Y, a4 as _ } from "./main-DaAnRozo.js";
2
+ import { v as q, g as C } from "./events-BvSmBueA-Doh7RyHn.js";
3
+ import { i as z, a as k, b as Q, c as Z, d as J, e as ee, f as te, g as ie, h as se } from "./edit.utils-3ZbhQCv_-CBOvR_lX.js";
4
4
  import { H as oe } from "./viewport.helpers-CoCAvmZs-f555rwPU.js";
5
- import { L as ne, a as re, g as le, t as ae } from "./throttle-CaUDyxyU-CoHkeYqM.js";
5
+ import { L as ne, a as re, g as le, t as ae } from "./throttle-3rhqdcLy-E1CC2r0m.js";
6
6
  /*!
7
7
  * Built by Revolist OU ❤️
8
8
  */
9
9
  const _e = class {
10
10
  constructor(t) {
11
- f(this, t);
11
+ v(this, t);
12
12
  }
13
13
  render() {
14
- return c(S, { key: "3d66475a019010c24b6c610ccc047e01c35178f9" }, c("a", { key: "777afddffef0309a697b9c14ee73c0001ac22b71", href: "https://rv-grid.com/guide/attribution", target: "_blank", rel: "noopener noreferrer", title: "Made with ❤️ by Revolist OU Team", class: "value" }, "RevoGrid"));
14
+ return c(b, { key: "3d66475a019010c24b6c610ccc047e01c35178f9" }, c("a", { key: "777afddffef0309a697b9c14ee73c0001ac22b71", href: "https://rv-grid.com/guide/attribution", target: "_blank", rel: "noopener noreferrer", title: "Made with ❤️ by Revolist OU Team", class: "value" }, "RevoGrid"));
15
15
  }
16
- }, je = class {
16
+ }, ke = class {
17
17
  constructor(t) {
18
- f(this, t), this.nodes = [], this.update = 1;
18
+ v(this, t), this.nodes = [], this.update = 1;
19
19
  }
20
20
  /**
21
21
  * Refreshes the extra component. Useful if you want to manually
@@ -50,26 +50,26 @@ function M(t, e) {
50
50
  }
51
51
  return i;
52
52
  }
53
- function k(t, e) {
53
+ function j(t, e) {
54
54
  if (t.defaultPrevented)
55
55
  return null;
56
56
  const i = C(t, "clientX"), s = C(t, "clientY");
57
57
  if (i === null || s === null)
58
58
  return null;
59
- const o = E({ x: i, y: s }, e);
59
+ const o = F({ x: i, y: s }, e);
60
60
  return w(o, e.lastCell) ? null : o;
61
61
  }
62
- function E({ x: t, y: e }, { el: i, rows: s, cols: o }) {
63
- const { top: n, left: r, height: a, width: h } = i.getBoundingClientRect();
62
+ function F({ x: t, y: e }, { el: i, rows: s, cols: o }) {
63
+ const { top: n, left: r, height: l, width: h } = i.getBoundingClientRect();
64
64
  let d = e - n, g = t - r;
65
- d >= a && (d = a - 1), g >= h && (g = h - 1);
66
- const v = _(s, d + (s.renderOffset || 0)), R = _(o, g + (o.renderOffset || 0));
67
- return R.itemIndex < 0 && (R.itemIndex = 0), v.itemIndex < 0 && (v.itemIndex = 0), { x: R.itemIndex, y: v.itemIndex };
65
+ d >= l && (d = l - 1), g >= h && (g = h - 1);
66
+ const f = _(s, d + (s.renderOffset || 0)), R = _(o, g + (o.renderOffset || 0));
67
+ return R.itemIndex < 0 && (R.itemIndex = 0), f.itemIndex < 0 && (f.itemIndex = 0), { x: R.itemIndex, y: f.itemIndex };
68
68
  }
69
69
  function ce(t, e, i, s = !1) {
70
70
  const o = (n, r = 0) => {
71
- const a = { x: t.x, y: t.y }, h = s ? { x: t.x1, y: t.y1 } : a, d = h[n] > e[n] ? h : a;
72
- return d[n] += r, { start: a, end: h };
71
+ const l = { x: t.x, y: t.y }, h = s ? { x: t.x1, y: t.y1 } : l, d = h[n] > e[n] ? h : l;
72
+ return d[n] += r, { start: l, end: h };
73
73
  };
74
74
  return i.x ? o("x", i.x) : i.y ? o("y", i.y) : null;
75
75
  }
@@ -88,19 +88,19 @@ function x(t) {
88
88
  };
89
89
  }
90
90
  function y({ x: t, y: e, x1: i, y1: s }, o, n) {
91
- const r = o.renderOffset || 0, a = n.renderOffset || 0, h = b(o, e).start - r, d = b(n, t).start - a, g = b(o, s).end - r, v = b(n, i).end - a;
91
+ const r = o.renderOffset || 0, l = n.renderOffset || 0, h = S(o, e).start - r, d = S(n, t).start - l, g = S(o, s).end - r, f = S(n, i).end - l;
92
92
  return {
93
93
  left: d,
94
- right: v,
94
+ right: f,
95
95
  top: h,
96
96
  bottom: g,
97
- width: v - d,
97
+ width: f - d,
98
98
  height: g - h
99
99
  };
100
100
  }
101
- const he = () => "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}", de = class {
101
+ const he = () => "revogr-focus.focused-cell{box-shadow:-1px 0 0 var(--rg-theme-selection-border) inset, 1px 0 0 var(--rg-theme-selection-border) inset, 0 -1px 0 var(--rg-theme-selection-border) inset, 0 1px 0 var(--rg-theme-selection-border) inset;position:absolute;pointer-events:none;z-index:9;display:block !important}", de = class {
102
102
  constructor(e) {
103
- f(this, e), this.beforeFocusRender = l(this, "beforefocusrender", 7), this.beforeScrollIntoView = l(this, "beforescrollintoview", 7), this.afterFocus = l(this, "afterfocus", 7), this.focusTemplate = null, this.activeFocus = null;
103
+ v(this, e), this.beforeFocusRender = a(this, "beforefocusrender", 7), this.beforeScrollIntoView = a(this, "beforescrollintoview", 7), this.afterFocus = a(this, "afterfocus", 7), this.focusTemplate = null, this.activeFocus = null;
104
104
  }
105
105
  componentDidRender() {
106
106
  var e, i;
@@ -137,14 +137,14 @@ const he = () => "revogr-focus.focused-cell{box-shadow:-1px 0 0 #0d63e8 inset, 1
137
137
  });
138
138
  if (o.defaultPrevented)
139
139
  return c("slot", null);
140
- const { detail: n } = o, r = y(n.range, o.detail.rowDimension, o.detail.colDimension), a = x(r), h = (e = this.focusTemplate) === null || e === void 0 ? void 0 : e.call(this, c, n), d = {
140
+ const { detail: n } = o, r = y(n.range, o.detail.rowDimension, o.detail.colDimension), l = x(r), h = (e = this.focusTemplate) === null || e === void 0 ? void 0 : e.call(this, c, n), d = {
141
141
  class: { [$]: !0 },
142
- style: a
142
+ style: l
143
143
  };
144
- return c(S, Object.assign({}, d), c("slot", null), h);
144
+ return c(b, Object.assign({}, d), c("slot", null), h);
145
145
  }
146
146
  get el() {
147
- return F(this);
147
+ return E(this);
148
148
  }
149
149
  };
150
150
  de.style = he();
@@ -157,17 +157,21 @@ const ue = [
157
157
  ];
158
158
  class ge {
159
159
  constructor(e) {
160
- this.sv = e;
160
+ this.sv = e, this.keyChangeQueue = Promise.resolve(!1), this.keyChangeGeneration = 0, this.applyingKeyChange = !1;
161
+ }
162
+ /** Cancel delayed directional input after focus or edit context changes externally. */
163
+ invalidatePendingChanges() {
164
+ this.applyingKeyChange || (this.keyChangeGeneration += 1);
161
165
  }
162
166
  /**
163
167
  * Appends printable key input that arrives after edit mode was requested
164
168
  * but before the editor input has mounted or received focus.
165
169
  */
166
170
  appendPendingEditValue(e) {
167
- if (j(e) || e.key.length !== 1 || e.target instanceof HTMLElement && z(e.target))
171
+ if (k(e) || e.key.length !== 1 || e.target instanceof HTMLElement && z(e.target))
168
172
  return !1;
169
173
  const i = this.sv.selectionStore.get("edit");
170
- return typeof (i == null ? void 0 : i.val) != "string" ? !1 : (this.sv.selectionStore.set("edit", Object.assign(Object.assign({}, i), { val: `${i.val}${e.key}` })), !0);
174
+ return typeof (i == null ? void 0 : i.val) != "string" ? !1 : (e.preventDefault(), this.sv.selectionStore.set("edit", Object.assign(Object.assign({}, i), { val: `${i.val}${e.key}` })), !0);
171
175
  }
172
176
  async keyDown(e, i, s, { range: o, focus: n }) {
173
177
  if (s) {
@@ -188,7 +192,7 @@ class ge {
188
192
  return;
189
193
  }
190
194
  if (n) {
191
- if (q(e.code)) {
195
+ if (Z(e.code)) {
192
196
  this.keyChangeSelection(e, i);
193
197
  return;
194
198
  }
@@ -205,8 +209,8 @@ class ge {
205
209
  i && this.selectAll(e);
206
210
  return;
207
211
  }
208
- if (!j(e) && e.key.length === 1) {
209
- this.sv.change(e.key);
212
+ if (!k(e) && e.key.length === 1) {
213
+ this.sv.change(e.key) && e.preventDefault();
210
214
  return;
211
215
  }
212
216
  await this.keyChangeSelection(e, i);
@@ -221,9 +225,24 @@ class ge {
221
225
  const s = this.changeDirectionKey(e, i);
222
226
  if (!s)
223
227
  return !1;
224
- await K(G + 30);
225
- const o = this.sv.selectionStore.get("range"), n = this.sv.selectionStore.get("focus");
226
- return this.keyPositionChange(s.changes, o, n, s.isMulti);
228
+ const o = this.keyChangeGeneration;
229
+ await N(Y + 30);
230
+ const n = async () => {
231
+ if (o !== this.keyChangeGeneration)
232
+ return !1;
233
+ const l = this.sv.selectionStore.get("range"), h = this.sv.selectionStore.get("focus");
234
+ this.applyingKeyChange = !0;
235
+ let d;
236
+ try {
237
+ d = this.keyPositionChange(s.changes, l, h, s.isMulti);
238
+ } finally {
239
+ this.applyingKeyChange = !1;
240
+ }
241
+ return await new Promise((g) => requestAnimationFrame(() => {
242
+ requestAnimationFrame(() => g());
243
+ })), d;
244
+ }, r = this.keyChangeQueue.then(n, n);
245
+ return this.keyChangeQueue = r.catch(() => !1), r;
227
246
  }
228
247
  keyPositionChange(e, i, s, o = !1) {
229
248
  if (!i || !s)
@@ -261,7 +280,7 @@ class ge {
261
280
  }
262
281
  }
263
282
  }
264
- class fe {
283
+ class ve {
265
284
  constructor(e) {
266
285
  this.sv = e, this.autoFillType = null, this.autoFillInitial = null, this.autoFillStart = null, this.autoFillLast = null;
267
286
  }
@@ -291,7 +310,7 @@ class fe {
291
310
  * Process mouse move events
292
311
  */
293
312
  selectionMouseMove(e) {
294
- this.onMouseMoveAutofill || (this.onMouseMoveAutofill = X((i, s) => this.doAutofillMouseMove(i, s), 5)), this.isAutoFill && this.onMouseMoveAutofill(e, this.sv.getData());
313
+ this.onMouseMoveAutofill || (this.onMouseMoveAutofill = G((i, s) => this.doAutofillMouseMove(i, s), 5)), this.isAutoFill && this.onMouseMoveAutofill(e, this.sv.getData());
295
314
  }
296
315
  getFocus(e, i) {
297
316
  return !e && i && (e = { x: i.x, y: i.y }), e || null;
@@ -306,15 +325,15 @@ class fe {
306
325
  const s = C(e, "clientX", p), o = C(e, "clientY", p);
307
326
  if (s === null || o === null)
308
327
  return;
309
- const n = E({ x: s, y: o }, i);
328
+ const n = F({ x: s, y: o }, i);
310
329
  if (this.autoFillLast || this.autoFillLast || (this.autoFillLast = this.autoFillStart), w(n, i.lastCell))
311
330
  return;
312
331
  if (this.autoFillLast = n, n.x === this.autoFillInitial.x && n.y === this.autoFillInitial.y)
313
332
  this.sv.setTempRange(null);
314
333
  else {
315
- const a = m(this.autoFillInitial, this.autoFillLast);
334
+ const l = m(this.autoFillInitial, this.autoFillLast);
316
335
  this.sv.setTempRange({
317
- area: a,
336
+ area: l,
318
337
  type: this.autoFillType
319
338
  });
320
339
  }
@@ -327,7 +346,7 @@ class fe {
327
346
  */
328
347
  selectionStart(e, i, s = "Selection") {
329
348
  const { top: o, left: n } = e.getBoundingClientRect();
330
- this.autoFillInitial = this.getFocus(i.focus, i.range), this.autoFillType = s, this.autoFillStart = E({ x: n, y: o }, i);
349
+ this.autoFillInitial = this.getFocus(i.focus, i.range), this.autoFillType = s, this.autoFillStart = F({ x: n, y: o }, i);
331
350
  }
332
351
  /**
333
352
  * Clear current range selection on mouse up and mouse leave events
@@ -397,7 +416,7 @@ class fe {
397
416
  this.sv.setRange(s);
398
417
  }
399
418
  }
400
- function ve(t, e) {
419
+ function fe(t, e) {
401
420
  var i;
402
421
  if (!pe(e))
403
422
  return null;
@@ -416,9 +435,9 @@ function me(t) {
416
435
  function ye(t) {
417
436
  return !t || t.every((e) => e === "");
418
437
  }
419
- const Se = () => '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}', be = class {
438
+ const be = () => '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:var(--rg-theme-autofill-handle-bg);border:1px solid var(--rg-theme-autofill-handle-border);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:var(--rg-theme-autofill-handle-bg);border:1px solid var(--rg-theme-autofill-handle-border);box-sizing:border-box}revogr-overlay-selection .selection-border-range{position:absolute;pointer-events:none;z-index:9;background-color:var(--rg-theme-selection-bg)}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:var(--rg-theme-range-handle-bg)}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 .selection-border-range{box-shadow:-1px 0 0 var(--rg-theme-selection-border) inset, 1px 0 0 var(--rg-theme-selection-border) inset, 0 -1px 0 var(--rg-theme-selection-border) inset, 0 1px 0 var(--rg-theme-selection-border) inset}revogr-overlay-selection revogr-edit{z-index:10}', Se = class {
420
439
  constructor(t) {
421
- f(this, t), this.beforeCopyRegion = l(this, "beforecopyregion", 7), this.beforeRegionPaste = l(this, "beforepasteregion", 7), this.cellEditApply = l(this, "celleditapply", 7), this.beforeFocusCell = l(this, "beforecellfocusinit", 7), this.beforeNextViewportFocus = l(this, "beforenextvpfocus", 7), this.setEdit = l(this, "setedit", 7), this.beforeApplyRange = l(this, "beforeapplyrange", 7), this.beforeSetRange = l(this, "beforesetrange", 7), this.setRange = l(this, "setrange", 7), this.beforeEditRender = l(this, "beforeeditrender", 7), this.selectAll = l(this, "selectall", 7), this.cancelEdit = l(this, "canceledit", 7), this.setTempRange = l(this, "settemprange", 7), this.beforeSetTempRange = l(this, "beforesettemprange", 7), this.applyFocus = l(this, "applyfocus", 7), this.focusCell = l(this, "focuscell", 7), this.beforeRangeDataApply = l(this, "beforerangedataapply", 7), this.selectionChange = l(this, "selectionchangeinit", 7), this.beforeRangeCopyApply = l(this, "beforerangecopyapply", 7), this.rangeEditApply = l(this, "rangeeditapply", 7), this.rangeClipboardCopy = l(this, "clipboardrangecopy", 7), this.rangeClipboardPaste = l(this, "clipboardrangepaste", 7), this.beforeKeyDown = l(this, "beforekeydown", 7), this.beforeKeyUp = l(this, "beforekeyup", 7), this.beforeCellSave = l(this, "beforecellsave", 7), this.cellEditDone = l(this, "celledit", 7), this.applyChangesOnClose = !1, this.keyboardService = null, this.autoFillService = null, this.unsubscribeSelectionStore = [];
440
+ v(this, t), this.beforeCopyRegion = a(this, "beforecopyregion", 7), this.beforeRegionPaste = a(this, "beforepasteregion", 7), this.cellEditApply = a(this, "celleditapply", 7), this.beforeFocusCell = a(this, "beforecellfocusinit", 7), this.beforeNextViewportFocus = a(this, "beforenextvpfocus", 7), this.setEdit = a(this, "setedit", 7), this.beforeApplyRange = a(this, "beforeapplyrange", 7), this.beforeSetRange = a(this, "beforesetrange", 7), this.setRange = a(this, "setrange", 7), this.beforeEditRender = a(this, "beforeeditrender", 7), this.selectAll = a(this, "selectall", 7), this.cancelEdit = a(this, "canceledit", 7), this.setTempRange = a(this, "settemprange", 7), this.beforeSetTempRange = a(this, "beforesettemprange", 7), this.applyFocus = a(this, "applyfocus", 7), this.focusCell = a(this, "focuscell", 7), this.beforeRangeDataApply = a(this, "beforerangedataapply", 7), this.selectionChange = a(this, "selectionchangeinit", 7), this.beforeRangeCopyApply = a(this, "beforerangecopyapply", 7), this.rangeEditApply = a(this, "rangeeditapply", 7), this.rangeClipboardCopy = a(this, "clipboardrangecopy", 7), this.rangeClipboardPaste = a(this, "clipboardrangepaste", 7), this.beforeKeyDown = a(this, "beforekeydown", 7), this.beforeKeyUp = a(this, "beforekeyup", 7), this.beforeCellSave = a(this, "beforecellsave", 7), this.cellEditDone = a(this, "celledit", 7), this.applyChangesOnClose = !1, this.keyboardService = null, this.autoFillService = null, this.unsubscribeSelectionStore = [];
422
441
  }
423
442
  // #endregion
424
443
  // #region Listeners
@@ -466,26 +485,31 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
466
485
  * Selection & Keyboard
467
486
  */
468
487
  selectionServiceSet(t) {
469
- this.unsubscribeSelectionStore.forEach((e) => e()), this.unsubscribeSelectionStore.length = 0, this.unsubscribeSelectionStore.push(t.onChange("nextFocus", (e) => e && this.doFocus(e, e))), this.keyboardService = new ge({
488
+ var e;
489
+ (e = this.keyboardService) === null || e === void 0 || e.invalidatePendingChanges(), this.unsubscribeSelectionStore.forEach((i) => i()), this.unsubscribeSelectionStore.length = 0, this.unsubscribeSelectionStore.push(t.onChange("nextFocus", (i) => i && this.doFocus(i, i))), this.keyboardService = new ge({
470
490
  selectionStore: t,
471
- range: (e) => !!e && this.triggerRangeEvent(e),
472
- focus: (e, i, s) => s ? (this.beforeNextViewportFocus.emit(e), !1) : this.doFocus(e, e, i),
473
- change: (e) => {
474
- this.readonly || this.doEdit(e);
475
- },
491
+ range: (i) => !!i && this.triggerRangeEvent(i),
492
+ focus: (i, s, o) => o ? (this.beforeNextViewportFocus.emit(i), !1) : this.doFocus(i, i, s),
493
+ change: (i) => this.doEdit(i),
476
494
  cancel: async () => {
477
- var e;
478
- await ((e = this.revogrEdit) === null || e === void 0 ? void 0 : e.cancelChanges()), this.closeEdit();
495
+ var i;
496
+ await ((i = this.revogrEdit) === null || i === void 0 ? void 0 : i.cancelChanges()), this.closeEdit();
479
497
  },
480
498
  clearCell: () => !this.readonly && this.clearCell(),
481
499
  internalPaste: () => !this.readonly && this.beforeRegionPaste.emit(),
482
500
  getData: () => this.getData(),
483
501
  selectAll: () => this.selectAll.emit()
484
- }), this.createAutoFillService();
502
+ }), this.unsubscribeSelectionStore.push(t.onChange("focus", () => {
503
+ var i;
504
+ return (i = this.keyboardService) === null || i === void 0 ? void 0 : i.invalidatePendingChanges();
505
+ }), t.onChange("edit", () => {
506
+ var i;
507
+ return (i = this.keyboardService) === null || i === void 0 ? void 0 : i.invalidatePendingChanges();
508
+ })), this.createAutoFillService();
485
509
  }
486
510
  /** Autofill */
487
511
  createAutoFillService() {
488
- this.autoFillService = new fe({
512
+ this.autoFillService = new ve({
489
513
  dimensionRow: this.dimensionRow,
490
514
  dimensionCol: this.dimensionCol,
491
515
  columnService: this.columnService,
@@ -511,8 +535,8 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
511
535
  this.columnServiceSet(), this.selectionServiceSet(this.selectionStore);
512
536
  }
513
537
  disconnectedCallback() {
514
- var t;
515
- this.unsubscribeSelectionStore.forEach((e) => e()), this.unsubscribeSelectionStore.length = 0, (t = this.columnService) === null || t === void 0 || t.destroy();
538
+ var t, e;
539
+ (t = this.keyboardService) === null || t === void 0 || t.invalidatePendingChanges(), this.unsubscribeSelectionStore.forEach((i) => i()), this.unsubscribeSelectionStore.length = 0, (e = this.columnService) === null || e === void 0 || e.destroy();
516
540
  }
517
541
  async componentWillRender() {
518
542
  var t, e;
@@ -520,9 +544,7 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
520
544
  }
521
545
  renderRange(t) {
522
546
  const e = y(t, this.dimensionRow.state, this.dimensionCol.state), i = x(e);
523
- return [
524
- c("div", { class: H, style: i }, this.isMobileDevice && c("div", { class: "range-handlers" }, c("span", { class: p }), c("span", { class: p })))
525
- ];
547
+ return c("div", { class: H, style: i }, this.isMobileDevice && c("div", { class: "range-handlers" }, c("span", { class: p }), c("span", { class: p })));
526
548
  }
527
549
  renderEditor() {
528
550
  const t = this.selectionStore.get("edit");
@@ -549,10 +571,10 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
549
571
  e.push(i);
550
572
  else {
551
573
  const s = this.selectionStore.get("range"), o = this.selectionStore.get("focus");
552
- (s || o) && this.useClipboard && e.push(c("revogr-clipboard", { readonly: this.readonly, onCopyregion: (n) => this.onCopy(n.detail), onClearregion: () => !this.readonly && this.clearCell(), ref: (n) => this.clipboard = n, onPasteregion: (n) => this.onPaste(n.detail) })), s && e.push(...this.renderRange(s)), o && !this.readonly && this.range && e.push((t = this.autoFillService) === null || t === void 0 ? void 0 : t.renderAutofill(s, o, this.isMobileDevice)), this.canDrag && e.push(c("revogr-order-editor", { ref: (n) => this.orderEditor = n, dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, rowType: this.types.rowType, onRowdragstartinit: (n) => this.rowDragStart(n) }));
574
+ (s || o) && this.useClipboard && e.push(c("revogr-clipboard", { readonly: this.readonly, onCopyregion: (n) => this.onCopy(n.detail), onClearregion: () => !this.readonly && this.clearCell(), ref: (n) => this.clipboard = n, onPasteregion: (n) => this.onPaste(n.detail) })), s && e.push(this.renderRange(s)), o && !this.readonly && this.range && e.push((t = this.autoFillService) === null || t === void 0 ? void 0 : t.renderAutofill(s, o, this.isMobileDevice)), this.canDrag && e.push(c("revogr-order-editor", { ref: (n) => this.orderEditor = n, dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, rowType: this.types.rowType, onRowdragstartinit: (n) => this.rowDragStart(n) }));
553
575
  }
554
- return c(S, {
555
- key: "ff303c39d59e4ef217421fa11b9a80de07311b07",
576
+ return c(b, {
577
+ key: "230e2122c5c7065c072f02019d616a64949d54d0",
556
578
  class: { mobile: this.isMobileDevice },
557
579
  onDblClick: (s) => this.onElementDblClick(s),
558
580
  onMouseDown: (s) => this.onElementMouseDown(s),
@@ -560,34 +582,34 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
560
582
  onCloseedit: (s) => this.closeEdit(s),
561
583
  // it's done to be able to throw events from different levels, not just from editor
562
584
  onCelledit: (s) => this.onEditCell(s)
563
- }, e, c("slot", { key: "3cbe4c3ad7d447f779e9e20f73eec2e3107275e0", name: "data" }));
585
+ }, e, c("slot", { key: "47740a79c605258b4024384510358be927d000b7", name: "data" }));
564
586
  }
565
587
  /**
566
588
  * Executes the focus operation on the specified range of cells.
567
589
  */
568
- doFocus(t, e, i) {
569
- const { defaultPrevented: s } = this.beforeFocusCell.emit(this.columnService.getSaveData(t.y, t.x));
570
- if (s)
590
+ doFocus(t, e, i, s) {
591
+ const { defaultPrevented: o } = this.beforeFocusCell.emit(Object.assign(Object.assign({}, this.columnService.getSaveData(t.y, t.x)), { originalEvent: s }));
592
+ if (o)
571
593
  return !1;
572
- const o = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, t), { x1: e.x, y1: e.y }), next: i }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }), n = this.applyFocus.emit(o);
573
- if (n.defaultPrevented)
594
+ const n = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, t), { x1: e.x, y1: e.y }), next: i }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent: s }), r = this.applyFocus.emit(n);
595
+ if (r.defaultPrevented)
574
596
  return !1;
575
- const { range: r } = n.detail;
597
+ const { range: l } = r.detail;
576
598
  return !this.focusCell.emit(Object.assign({ focus: {
577
- x: r.x,
578
- y: r.y
599
+ x: l.x,
600
+ y: l.y
579
601
  }, end: {
580
- x: r.x1,
581
- y: r.y1
582
- } }, n.detail)).defaultPrevented;
602
+ x: l.x1,
603
+ y: l.y1
604
+ } }, r.detail)).defaultPrevented;
583
605
  }
584
- triggerRangeEvent(t) {
585
- const e = this.types.rowType, i = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, t) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
586
- if (i.defaultPrevented)
606
+ triggerRangeEvent(t, e) {
607
+ const i = this.types.rowType, s = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, t) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent: e }));
608
+ if (s.defaultPrevented)
587
609
  return !1;
588
- const s = this.columnService.getRangeTransformedToProps(i.detail.range, this.dataStore);
589
- let o = this.beforeSetRange.emit(s);
590
- return o.defaultPrevented || (o = this.setRange.emit(Object.assign(Object.assign({}, i.detail.range), { type: e })), o.defaultPrevented) ? !1 : !o.defaultPrevented;
610
+ const o = this.columnService.getRangeTransformedToProps(s.detail.range, this.dataStore);
611
+ let n = this.beforeSetRange.emit(o);
612
+ return n.defaultPrevented || (n = this.setRange.emit(Object.assign(Object.assign({}, s.detail.range), { type: i })), n.defaultPrevented) ? !1 : !n.defaultPrevented;
591
613
  }
592
614
  /**
593
615
  * Open Editor on DblClick
@@ -596,7 +618,7 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
596
618
  if (t.defaultPrevented)
597
619
  return;
598
620
  const e = this.getData();
599
- k(t, e) && this.doEdit();
621
+ j(t, e) && this.doEdit();
600
622
  }
601
623
  /**
602
624
  * Handle mouse down event on Host element
@@ -606,21 +628,20 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
606
628
  const s = t.target;
607
629
  if (z(s) || t.defaultPrevented)
608
630
  return;
609
- const o = this.getData(), n = k(t, o);
610
- n && (this.focus(n, this.range && t.shiftKey), this.range && (s && ((i = this.autoFillService) === null || i === void 0 || i.selectionStart(s, this.getData())), e ? Z(t.touches[0], p) && t.preventDefault() : t.preventDefault()));
631
+ const o = this.getData(), n = j(t, o);
632
+ n && (this.focus(n, this.range && t.shiftKey, t), this.range && (s && ((i = this.autoFillService) === null || i === void 0 || i.selectionStart(s, this.getData())), e ? q(t.touches[0], p) && t.preventDefault() : t.preventDefault()));
611
633
  }
612
634
  /**
613
635
  * Start cell editing
614
636
  */
615
637
  doEdit(t = "") {
616
- var e;
617
- if (this.canEdit()) {
618
- const i = this.selectionStore.get("focus");
619
- if (!i)
620
- return;
621
- const s = this.columnService.getSaveData(i.y, i.x);
622
- (e = this.setEdit) === null || e === void 0 || e.emit(Object.assign(Object.assign({}, s), { val: t }));
623
- }
638
+ if (!this.canEdit())
639
+ return !1;
640
+ const e = this.selectionStore.get("focus");
641
+ if (!e)
642
+ return !1;
643
+ const i = this.columnService.getSaveData(e.y, e.x);
644
+ return !this.setEdit.emit(Object.assign(Object.assign({}, i), { val: t })).defaultPrevented;
624
645
  }
625
646
  /**
626
647
  * Close editor event triggered
@@ -649,12 +670,12 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
649
670
  return !1;
650
671
  let o;
651
672
  if (i) {
652
- const { data: n, mapping: r } = this.columnService.copyRangeArray(i, this.dataStore), a = this.rangeClipboardCopy.emit(Object.assign({
673
+ const { data: n, mapping: r } = this.columnService.copyRangeArray(i, this.dataStore), l = this.rangeClipboardCopy.emit(Object.assign({
653
674
  range: i,
654
675
  data: n,
655
676
  mapping: r
656
677
  }, this.types));
657
- a.defaultPrevented || (o = a.detail.data);
678
+ l.defaultPrevented || (o = l.detail.data);
658
679
  }
659
680
  return (e = this.clipboard) === null || e === void 0 || e.doCopy(t, o), !0;
660
681
  }
@@ -663,14 +684,14 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
663
684
  const i = this.selectionStore.get("focus"), s = this.selectionStore.get("edit") !== null;
664
685
  if (!i || s)
665
686
  return;
666
- const o = ve(t, this.useClipboard), n = o ? this.getClipboardPasteTargetRange() : null;
667
- let { changed: r, range: a } = this.columnService.getTransformedDataToApply({
687
+ const o = fe(t, this.useClipboard), n = o ? this.getClipboardPasteTargetRange() : null;
688
+ let { changed: r, range: l } = this.columnService.getTransformedDataToApply({
668
689
  start: i,
669
690
  data: o || t,
670
691
  targetRange: n
671
692
  });
672
- const { defaultPrevented: h } = this.rangeClipboardPaste.emit(Object.assign({ data: r, models: M(r, this.dataStore), range: a }, this.types));
673
- h || (e = this.autoFillService) === null || e === void 0 || e.onRangeApply(r, a, a);
693
+ const { defaultPrevented: h } = this.rangeClipboardPaste.emit(Object.assign({ data: r, models: M(r, this.dataStore), range: l }, this.types));
694
+ h || (e = this.autoFillService) === null || e === void 0 || e.onRangeApply(r, l, l);
674
695
  }
675
696
  getClipboardPasteTargetRange() {
676
697
  const t = this.selectionStore.get("range");
@@ -684,12 +705,11 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
684
705
  }
685
706
  clearCell() {
686
707
  var t;
687
- const e = this.selectionStore.get("range");
688
- if (e && !A(e)) {
689
- const i = this.columnService.getRangeStaticData(e, "");
690
- (t = this.autoFillService) === null || t === void 0 || t.onRangeApply(i, e, e);
708
+ const e = this.selectionStore.get("range"), i = this.selectionStore.get("focus");
709
+ if (e && (!A(e) || !i)) {
710
+ const s = this.columnService.getRangeStaticData(e, "");
711
+ (t = this.autoFillService) === null || t === void 0 || t.onRangeApply(s, e, e);
691
712
  } else if (this.canEdit()) {
692
- const i = this.selectionStore.get("focus");
693
713
  if (!i)
694
714
  return;
695
715
  const s = this.columnService.getSaveData(i.y, i.x);
@@ -721,16 +741,16 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
721
741
  /**
722
742
  * Sets the focus on a cell and optionally edits a range.
723
743
  */
724
- focus(t, e = !1) {
744
+ focus(t, e = !1, i) {
725
745
  if (!t)
726
746
  return !1;
727
- const i = t, s = this.selectionStore.get("focus");
728
- if (e && s) {
729
- const o = m(s, i);
730
- if (o)
731
- return this.triggerRangeEvent(o);
747
+ const s = t, o = this.selectionStore.get("focus");
748
+ if (e && o) {
749
+ const n = m(o, s);
750
+ if (n)
751
+ return this.triggerRangeEvent(n, i);
732
752
  }
733
- return this.doFocus(t, i);
753
+ return this.doFocus(t, s, void 0, i);
734
754
  }
735
755
  get types() {
736
756
  return {
@@ -753,7 +773,7 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
753
773
  };
754
774
  }
755
775
  get element() {
756
- return F(this);
776
+ return E(this);
757
777
  }
758
778
  static get watchers() {
759
779
  return {
@@ -775,17 +795,17 @@ const Se = () => 'revogr-overlay-selection{display:block;position:relative;width
775
795
  };
776
796
  }
777
797
  };
778
- be.style = Se();
798
+ Se.style = be();
779
799
  const Ce = (t) => (e, { rowIndex: i }) => t + i, Ie = class {
780
800
  constructor(t) {
781
- f(this, t), this.scrollViewport = l(this, "scrollview", 3), this.elementToScroll = l(this, "ref", 3), this.jobsBeforeRender = [];
801
+ v(this, t), this.scrollViewport = a(this, "scrollview", 3), this.elementToScroll = a(this, "ref", 3), this.jobsBeforeRender = [];
782
802
  }
783
803
  render() {
784
804
  const t = [], e = new B("colPinStart");
785
805
  let i = 1;
786
806
  for (let r of this.dataPorts) {
787
- const a = r.dataStore.get("items").length, h = new P(r.type, Object.assign({}, r.dataStore.state)), d = new P("colPinStart"), g = Object.assign({ cellTemplate: Ce(i) }, this.rowHeaderColumn);
788
- d.updateData([g]), t.push(c("revogr-data", Object.assign({}, r, { colType: "rowHeaders", jobsBeforeRender: this.jobsBeforeRender, rowClass: this.rowClass, dataStore: h.store, colData: d.store, viewportCol: e.store, readonly: !0, range: !1 }))), i += a;
807
+ const l = r.dataStore.get("items").length, h = new P(r.type, Object.assign({}, r.dataStore.state)), d = new P("colPinStart"), g = Object.assign({ cellTemplate: Ce(i) }, this.rowHeaderColumn);
808
+ d.updateData([g]), t.push(c("revogr-data", Object.assign({}, r, { colType: "rowHeaders", jobsBeforeRender: this.jobsBeforeRender, rowClass: this.rowClass, dataStore: h.store, colData: d.store, viewportCol: e.store, readonly: !0, range: !1 }))), i += l;
789
809
  }
790
810
  const s = V(i, this.rowHeaderColumn);
791
811
  e.setViewport({
@@ -817,7 +837,7 @@ const Ce = (t) => (e, { rowIndex: i }) => t + i, Ie = class {
817
837
  // parent,
818
838
  slot: oe
819
839
  });
820
- return c(S, { class: { [D]: !0 }, key: D }, c("revogr-viewport-scroll", Object.assign({ key: "c401e82e02e4bdb7afb25f2f49c6776f2e115c81" }, o, { "row-header": !0 }), c("revogr-header", Object.assign({ key: "3c73d27bd96e23a34fc0cf47eda4d2e65751df98" }, n)), t));
840
+ return c(b, { class: { [D]: !0 }, key: D }, c("revogr-viewport-scroll", Object.assign({ key: "c401e82e02e4bdb7afb25f2f49c6776f2e115c81" }, o, { "row-header": !0 }), c("revogr-header", Object.assign({ key: "3c73d27bd96e23a34fc0cf47eda4d2e65751df98" }, n)), t));
821
841
  }
822
842
  };
823
843
  class we {
@@ -848,7 +868,7 @@ class we {
848
868
  }
849
869
  const xe = () => "revogr-scroll-virtual[autohide]{position:absolute;z-index:100 !important}revogr-scroll-virtual[autohide].vertical{top:0;right:0}revogr-scroll-virtual[autohide].vertical[visible]{min-width:20px !important}revogr-scroll-virtual[autohide].horizontal{bottom:0;left:0}revogr-scroll-virtual[autohide].horizontal[visible]{min-height:20px !important}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}", Re = class {
850
870
  constructor(t) {
851
- f(this, t), this.scrollVirtual = l(this, "scrollvirtual", 7), this.dimension = "rgRow", this.scrollSize = 0;
871
+ v(this, t), this.scrollVirtual = a(this, "scrollvirtual", 7), this.dimension = "rgRow", this.scrollSize = 0;
852
872
  }
853
873
  async setScroll(t) {
854
874
  var e;
@@ -882,7 +902,7 @@ const xe = () => "revogr-scroll-virtual[autohide]{position:absolute;z-index:100
882
902
  this.autohideScrollPlugin.clear();
883
903
  }
884
904
  componentWillLoad() {
885
- this.scrollSize = N(document);
905
+ this.scrollSize = K(document);
886
906
  }
887
907
  componentDidRender() {
888
908
  let t = 0;
@@ -906,18 +926,18 @@ const xe = () => "revogr-scroll-virtual[autohide]{position:absolute;z-index:100
906
926
  }
907
927
  render() {
908
928
  const t = le(this.realSize, this.dimension === "rgRow" ? this.element.clientHeight : this.element.clientWidth, this.clientSize);
909
- return c(S, { key: "7213817ef941eee4050b714266598ec0c2961ee9", onScroll: (e) => this.onScroll(e) }, c("div", { key: "501da49c63253ab943172494b9dbf5399be56cee", style: {
929
+ return c(b, { key: "7213817ef941eee4050b714266598ec0c2961ee9", onScroll: (e) => this.onScroll(e) }, c("div", { key: "501da49c63253ab943172494b9dbf5399be56cee", style: {
910
930
  [this.dimension === "rgRow" ? "height" : "width"]: `${t}px`
911
931
  } }));
912
932
  }
913
933
  get element() {
914
- return F(this);
934
+ return E(this);
915
935
  }
916
936
  };
917
937
  Re.style = xe();
918
- const De = () => ".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}", Oe = class {
938
+ const De = () => ".temp-bg-range{display:block !important;position:absolute;pointer-events:none;z-index:9;border:1px solid var(--rg-theme-temporary-range-border);box-sizing:border-box}.temp-bg-range.Selection{border:1px dashed var(--rg-theme-temporary-selection-border)}.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}", Oe = class {
919
939
  constructor(t) {
920
- f(this, t), this.onChange = ae((e) => this.doChange(e), 300);
940
+ v(this, t), this.onChange = ae((e) => this.doChange(e), 300);
921
941
  }
922
942
  doChange(t) {
923
943
  t == null || t.scrollIntoView({
@@ -937,15 +957,15 @@ const De = () => ".temp-bg-range{display:block !important;position:absolute;poin
937
957
  if (!o)
938
958
  return;
939
959
  t.y < o.y && (i = "top"), t.x < o.x && (s = "left");
940
- const n = `${s} ${i}`, r = y(t, this.dimensionRow.state, this.dimensionCol.state), a = x(r), h = {
960
+ const n = `${s} ${i}`, r = y(t, this.dimensionRow.state, this.dimensionCol.state), l = x(r), h = {
941
961
  class: {
942
- [Y]: !0,
962
+ [X]: !0,
943
963
  [e || ""]: !0
944
964
  },
945
- style: a,
965
+ style: l,
946
966
  hidden: !1
947
967
  };
948
- return c(S, Object.assign({}, h), c("div", { class: n, ref: (d) => this.el = d }));
968
+ return c(b, Object.assign({}, h), c("div", { class: n, ref: (d) => this.el = d }));
949
969
  }
950
970
  getRange() {
951
971
  const t = this.selectionStore.get("range");
@@ -958,9 +978,9 @@ const De = () => ".temp-bg-range{display:block !important;position:absolute;poin
958
978
  Oe.style = De();
959
979
  export {
960
980
  _e as revogr_attribution,
961
- je as revogr_extra,
981
+ ke as revogr_extra,
962
982
  de as revogr_focus,
963
- be as revogr_overlay_selection,
983
+ Se as revogr_overlay_selection,
964
984
  Ie as revogr_row_headers,
965
985
  Re as revogr_scroll_virtual,
966
986
  Oe as revogr_temp_range