@progress/kendo-react-data-tools 7.5.0-develop.17 → 7.5.0-develop.18

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.
@@ -6,129 +6,130 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import { getter as _, mapTree as N, extendDataItem as B, Keys as O, hasRelativeStackingContext as M } from "@progress/kendo-react-common";
10
- import { TABLE_PREVENT_SELECTION_ELEMENT as F, TABLE_ROW_INDEX_ATTRIBUTE as G, TABLE_COL_INDEX_ATTRIBUTE as U } from "./constants.mjs";
11
- const X = "items", x = {}, b = (e, t) => !e || Array.isArray(e) && e.length === 0 ? [t] : e.findIndex((o) => o === t) > -1 ? e.filter((o) => o !== t) : [...e, t], J = (e) => {
9
+ import { getter as _, mapTree as k, extendDataItem as B, Keys as i, hasRelativeStackingContext as O } from "@progress/kendo-react-common";
10
+ import { TABLE_PREVENT_SELECTION_ELEMENT as M, TABLE_ROW_INDEX_ATTRIBUTE as F, TABLE_COL_INDEX_ATTRIBUTE as G } from "./constants.mjs";
11
+ const U = "items", x = {}, X = (e, t) => !e || Array.isArray(e) && e.length === 0 ? [t] : e.findIndex((d) => d === t) > -1 ? e.filter((d) => d !== t) : [...e, t], J = (e) => {
12
12
  let t = e;
13
13
  for (; t; ) {
14
- if (t.hasAttribute(F))
14
+ if (t.hasAttribute(M))
15
15
  return !0;
16
16
  t = t.parentElement;
17
17
  }
18
18
  return !1;
19
19
  }, A = (e, t) => {
20
- let n = e;
21
- for (; n; ) {
22
- if (n.tagName === t)
23
- return n;
24
- if (n.tagName === "TABLE")
20
+ let o = e;
21
+ for (; o; ) {
22
+ if (o.tagName === t)
23
+ return o;
24
+ if (o.tagName === "TABLE")
25
25
  return null;
26
- n = n.parentElement;
26
+ o = o.parentElement;
27
27
  }
28
28
  return null;
29
- }, k = (e) => {
29
+ }, b = (e) => {
30
30
  if (!e)
31
31
  return;
32
- const t = e.getAttribute(G);
32
+ const t = e.getAttribute(F);
33
33
  return t ? parseInt(t, 10) : void 0;
34
34
  }, V = (e) => {
35
35
  if (!e)
36
36
  return;
37
- const t = e.getAttribute(U);
37
+ const t = e.getAttribute(G);
38
38
  return t ? parseInt(t, 10) : void 0;
39
39
  }, Q = (e) => {
40
- const t = e.subItemsField || X, n = _(e.dataItemKey);
41
- return N(
40
+ const t = e.subItemsField || U, o = _(e.dataItemKey);
41
+ return k(
42
42
  e.data,
43
43
  t,
44
- (o) => B(o, t, {
45
- [e.selectedField]: e.selectedState[n(o)]
44
+ (d) => B(d, t, {
45
+ [e.selectedField]: e.selectedState[o(d)]
46
46
  })
47
47
  );
48
48
  }, Y = (e) => {
49
- const { event: t, dataItemKey: n, selectedState: o } = e, { syntheticEvent: c, nativeEvent: r, dataItems: E, componentId: a, mode: T, cell: f, selectedField: w } = t, { target: g, ctrlKey: p, metaKey: C, altKey: I, shiftKey: D } = r;
50
- if (c.isDefaultPrevented() || r.keyCode !== O.enter)
51
- return o;
52
- const y = A(g, "TD"), i = A(g, "TR"), s = V(y), m = k(i);
53
- let d = {};
54
- return y && i && m !== void 0 && s !== void 0 && (d = H({
55
- selectedState: o,
56
- dataItemKey: n,
49
+ const { event: t, dataItemKey: o, selectedState: d } = e, { syntheticEvent: a, nativeEvent: n, dataItems: E, componentId: c, mode: T, cell: g, selectedField: p } = t, { target: C, ctrlKey: w, metaKey: S, altKey: I, shiftKey: h } = n;
50
+ if (a.isDefaultPrevented() && !h || n.keyCode !== i.space && n.keyCode !== i.enter && n.keyCode !== i.right && n.keyCode !== i.left && n.keyCode !== i.up && n.keyCode !== i.down)
51
+ return d;
52
+ a.preventDefault();
53
+ const D = A(C, "TD"), m = A(C, "TR");
54
+ let r = V(D), u = b(m), s = {};
55
+ return D && m && u !== void 0 && r !== void 0 && (n.keyCode === i.right && r++, n.keyCode === i.left && r--, n.keyCode === i.down && u++, n.keyCode === i.up && u--, s = H({
56
+ selectedState: d,
57
+ dataItemKey: o,
57
58
  event: {
58
- ctrlKey: p,
59
- metaKey: C,
59
+ ctrlKey: w,
60
+ metaKey: S,
60
61
  altKey: I,
61
- shiftKey: D,
62
+ shiftKey: h,
62
63
  dataItems: E,
63
- cell: f,
64
+ cell: g,
64
65
  mode: T,
65
- selectedField: w,
66
- componentId: a,
67
- startColIndex: s,
68
- endColIndex: s,
69
- startRowIndex: m,
70
- endRowIndex: m,
66
+ selectedField: p,
67
+ componentId: c,
68
+ startColIndex: r,
69
+ endColIndex: r,
70
+ startRowIndex: u,
71
+ endRowIndex: u,
71
72
  isDrag: !1,
72
- syntheticEvent: c,
73
- nativeEvent: r,
73
+ syntheticEvent: a,
74
+ nativeEvent: n,
74
75
  target: t.target,
75
76
  dataItem: null
76
77
  }
77
- })), d;
78
+ })), s;
78
79
  }, H = (e) => {
79
- const { event: t, dataItemKey: n, selectedState: o } = e, {
80
- dataItems: c,
81
- startRowIndex: r,
80
+ const { event: t, dataItemKey: o, selectedState: d } = e, {
81
+ dataItems: a,
82
+ startRowIndex: n,
82
83
  endRowIndex: E,
83
- startColIndex: a,
84
+ startColIndex: c,
84
85
  endColIndex: T,
85
- cell: f,
86
- isDrag: w,
87
- ctrlKey: g,
88
- shiftKey: p,
89
- metaKey: C,
86
+ cell: g,
87
+ isDrag: p,
88
+ ctrlKey: C,
89
+ shiftKey: w,
90
+ metaKey: S,
90
91
  componentId: I,
91
- mode: D,
92
- dataItem: y
93
- } = t, i = _(n);
94
- let s = {};
95
- const m = y !== null;
96
- if (D === "single") {
97
- const d = c.slice(r, r + 1)[0], u = i(d);
92
+ mode: h,
93
+ dataItem: D
94
+ } = t, m = _(o);
95
+ let r = {};
96
+ const u = D !== null;
97
+ if (h === "single") {
98
+ const s = a.slice(n, n + 1)[0], f = m(s);
98
99
  x[I] = {
99
- rowIndex: r,
100
- colIndex: a
101
- }, s[u] = f ? [a] : !0;
102
- } else if (w || !p && !g && !C && !m) {
103
- w || (x[I] = {
104
- rowIndex: r,
105
- colIndex: a
100
+ rowIndex: n,
101
+ colIndex: c
102
+ }, r[f] = g ? [c] : !0;
103
+ } else if (p || !w && !C && !S && !u) {
104
+ p || (x[I] = {
105
+ rowIndex: n,
106
+ colIndex: c
106
107
  });
107
- const d = [];
108
- for (let l = a; l <= T; l++)
109
- d.push(l);
110
- c.slice(r, E + 1).forEach((l) => {
111
- const h = i(l);
112
- s[h] = f ? [...d] : !0;
108
+ const s = [];
109
+ for (let l = c; l <= T; l++)
110
+ s.push(l);
111
+ a.slice(n, E + 1).forEach((l) => {
112
+ const R = m(l);
113
+ r[R] = g ? [...s] : !0;
113
114
  });
114
- } else if (g || C || m) {
115
+ } else if (C || S || u) {
115
116
  x[I] = {
116
- rowIndex: r,
117
- colIndex: a
117
+ rowIndex: n,
118
+ colIndex: c
118
119
  };
119
- const u = c.slice(r, E + 1)[0], l = i(u);
120
- s = { ...o }, s[l] = f && !m ? b(s[l], a) : !s[l];
121
- } else if (p) {
122
- const d = x[I] && x[I].rowIndex || 0, u = x[I] && x[I].colIndex || 0, l = Math.min(d, r, E), h = Math.max(d, r, E), v = Math.min(u, a, T), K = Math.max(u, a, T), R = [];
123
- for (let S = v; S <= K; S++)
124
- R.push(S);
125
- c.slice(l, h + 1).forEach((S) => {
126
- const L = i(S);
127
- s[L] = f ? [...R] : !0;
120
+ const f = a.slice(n, E + 1)[0], l = m(f);
121
+ r = { ...d }, r[l] = g && !u ? X(r[l], c) : !r[l];
122
+ } else if (w) {
123
+ const s = x[I] && x[I].rowIndex || 0, f = x[I] && x[I].colIndex || 0, l = Math.min(s, n, E), R = Math.max(s, n, E), K = Math.min(f, c, T), L = Math.max(f, c, T), v = [];
124
+ for (let y = K; y <= L; y++)
125
+ v.push(y);
126
+ a.slice(l, R + 1).forEach((y) => {
127
+ const N = m(y);
128
+ r[N] = g ? [...v] : !0;
128
129
  });
129
130
  }
130
- return s;
131
- }, W = M(), Z = (e) => {
131
+ return r;
132
+ }, W = O(), Z = (e) => {
132
133
  if (!e || !W)
133
134
  return null;
134
135
  let t = e.parentElement;
@@ -147,14 +148,14 @@ const X = "items", x = {}, b = (e, t) => !e || Array.isArray(e) && e.length ===
147
148
  }
148
149
  return { left: 0, top: 0 };
149
150
  }, P = (e) => {
150
- const t = e ? typeof e.enabled == "boolean" ? e.enabled : !0 : !1, n = e ? !!e.drag : !1, o = e && e.mode ? e.mode : "multiple", c = !!(e && e.cell);
151
- return { enabled: t, drag: n, mode: o, cell: c };
151
+ const t = e ? typeof e.enabled == "boolean" ? e.enabled : !0 : !1, o = e ? !!e.drag : !1, d = e && e.mode ? e.mode : "multiple", a = !!(e && e.cell);
152
+ return { enabled: t, drag: o, mode: d, cell: a };
152
153
  };
153
154
  export {
154
155
  A as closestTagName,
155
156
  V as getColumnIndex,
156
157
  $ as getOffset,
157
- k as getRowIndex,
158
+ b as getRowIndex,
158
159
  H as getSelectedState,
159
160
  Y as getSelectedStateFromKeyDown,
160
161
  P as getSelectionOptions,