@progress/kendo-vue-data-tools 10.0.1-develop.6 → 10.1.0-develop.1

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.
@@ -5,100 +5,111 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { getter as h } from "@progress/kendo-vue-common";
8
+ import { getter as g } from "@progress/kendo-vue-common";
9
9
  var E = /* @__PURE__ */ ((t) => (t.copy = "copy", t.cut = "cut", t.paste = "paste", t))(E || {});
10
- const L = (t, n, e, a) => {
11
- const s = h(a);
10
+ const F = (t, n, e, s) => {
11
+ const a = g(s);
12
12
  if (!n.length)
13
13
  return [];
14
- const l = t.data.findIndex((d) => s(d) === s(n[0].dataItem)) || 0, i = n.length < 2 ? e : n.length;
15
- return t.data.filter((d, o) => o >= l && o < l + i) || [];
16
- }, C = (t) => (t == null ? void 0 : t.map((e) => e.fields.map((a) => e.dataItem[a].toString()))) || [], K = (t, n) => {
17
- var d, o;
18
- const { event: e } = t, a = n.includes(`
14
+ const r = t.data.findIndex((i) => a(i) === a(n[0].dataItem)) || 0, o = n.length < 2 ? e : n.length;
15
+ return t.data.filter((i, c) => c >= r && c < r + o) || [];
16
+ }, L = (t) => (t == null ? void 0 : t.map((e) => e.fields.map((s) => e.dataItem[s].toString()))) || [], j = (t, n) => {
17
+ var i, c;
18
+ const { event: e } = t, s = n.includes(`
19
19
  `) ? `
20
- ` : null, s = (d = e.cellDelimiter) != null ? d : " ", l = (o = e.newLineDelimiter) != null ? o : `\r
21
- `, i = n.includes(l) ? l : a;
22
- return (i ? n.split(i) : [n]).map((c) => c.includes(s) ? c.split(s) : [c]);
23
- }, F = (t, n) => {
20
+ ` : null, a = (i = e.cellDelimiter) != null ? i : " ", r = (c = e.newLineDelimiter) != null ? c : `\r
21
+ `, o = n.includes(r) ? r : s;
22
+ return (o ? n.split(o) : [n]).map((d) => d.includes(a) ? d.split(a) : [d]);
23
+ }, K = (t, n) => {
24
24
  var e;
25
- return ((e = t.event.nativeEvent) == null ? void 0 : e.type) === "paste" ? K(t, n) : C(t.previousCopiedItems);
25
+ return ((e = t.event.nativeEvent) == null ? void 0 : e.type) === "paste" ? j(t, n) : L(t.previousCopiedItems);
26
26
  }, S = (t, n) => {
27
- var f, u, g;
28
- const { event: e } = t, a = e.dataItem, s = (u = (f = t.dataItemKey) != null ? f : e.dataItemKey) != null ? u : "", l = h(s), i = a && !a.selected && e.field ? [{ dataItem: e.dataItem, fields: [e.field] }] : w(t), r = i.length ? i[0].fields[0] : (g = e.columns[0].field) != null ? g : "", d = e.columns.map((I) => {
27
+ var u, p, h;
28
+ const { event: e } = t, s = e.dataItem, a = (p = (u = t.dataItemKey) != null ? u : e.dataItemKey) != null ? p : "", r = g(a), o = s && !s.selected && e.field ? [{ dataItem: e.dataItem, fields: [e.field] }] : b(t), l = o.length ? o[0].fields[0] : (h = e.columns[0].field) != null ? h : "", i = e.columns.map((I) => {
29
29
  var D;
30
30
  return (D = I.field) != null ? D : "";
31
- }), o = d.indexOf(r), c = F(t, n), p = L(t, i, c.length, s);
32
- return c.slice(0, p.length).map((I, D) => {
33
- const P = o + I.length, x = d.slice(o, P), y = { [s]: l(p[D]) };
34
- return x.forEach((T, b) => y[T] = I[b]), {
31
+ }), c = i.indexOf(l), d = K(t, n), f = F(t, o, d.length, a);
32
+ return d.slice(0, f.length).map((I, D) => {
33
+ const w = c + I.length, x = i.slice(c, w), y = { [a]: r(f[D]) };
34
+ return x.forEach((T, C) => y[T] = I[C]), {
35
35
  dataItem: y,
36
36
  fields: x
37
37
  };
38
38
  });
39
- }, $ = (t, n, e = " ") => {
39
+ }, P = (t, n) => {
40
+ const e = String(t != null ? t : "").replace(/[\t\r\n]/g, " ").split(n).join(" ");
41
+ return /^\s*[=+@\t\r]/.test(e) || typeof t != "number" && /^\s*-/.test(e) ? `'${e}` : e;
42
+ }, $ = (t, n, e = " ", s = !0) => {
40
43
  if (!n.length)
41
44
  return null;
42
45
  let a = "";
43
- return n.forEach((s, l, i) => a += `${t[s]}${l < i.length - 1 ? e : ""}`), a;
44
- }, v = (t, n, e) => {
45
- var i, r;
46
- const a = (i = e.cellDelimiter) != null ? i : " ", s = (r = e.newLineDelimiter) != null ? r : `\r
46
+ return n.forEach((r, o, l) => {
47
+ const i = s ? P(t[r], e) : t[r];
48
+ a += `${i}${o < l.length - 1 ? e : ""}`;
49
+ }), a;
50
+ }, O = (t, n, e) => {
51
+ var o, l;
52
+ const s = (o = e.cellDelimiter) != null ? o : " ", a = (l = e.newLineDelimiter) != null ? l : `\r
47
53
  `;
48
- return `${n.join(a)}${s}${t}`;
49
- }, w = (t) => {
50
- var d, o;
51
- const { event: n, selectedState: e, data: a } = t, s = (o = (d = t.dataItemKey) != null ? d : n.dataItemKey) != null ? o : "", l = h(s), i = {}, r = [];
52
- return Object.entries(e).forEach(([c, p]) => {
53
- i[c] = Array.isArray(p) ? p.map((m) => n.columns[m]).filter((m) => !m.declarationIndex || m.declarationIndex >= 0) : n.columns.filter((m) => !m.declarationIndex || m.declarationIndex >= 0);
54
- }), a == null || a.forEach((c) => {
54
+ return `${n.map((i) => e.preventFormulaInjection === !1 ? i : P(i, s)).join(s)}${a}${t}`;
55
+ }, b = (t) => {
56
+ var i, c;
57
+ const { event: n, selectedState: e, data: s } = t, a = (c = (i = t.dataItemKey) != null ? i : n.dataItemKey) != null ? c : "", r = g(a), o = {}, l = [];
58
+ return Object.entries(e).forEach(([d, f]) => {
59
+ o[d] = Array.isArray(f) ? f.map((m) => n.columns[m]).filter((m) => !m.declarationIndex || m.declarationIndex >= 0) : n.columns.filter((m) => !m.declarationIndex || m.declarationIndex >= 0);
60
+ }), s == null || s.forEach((d) => {
55
61
  var m;
56
- const p = (m = l(c)) != null ? m : "";
57
- i[p] && r.push({
58
- dataItem: c,
59
- fields: i[p].map((f) => {
60
- var u;
61
- return (u = f.field) != null ? u : "";
62
+ const f = (m = r(d)) != null ? m : "";
63
+ o[f] && l.push({
64
+ dataItem: d,
65
+ fields: o[f].map((u) => {
66
+ var p;
67
+ return (p = u.field) != null ? p : "";
62
68
  })
63
69
  });
64
- }), r;
65
- }, O = (t, n) => {
66
- var l, i;
67
- const e = (l = n.newLineDelimiter) != null ? l : `\r
68
- `, a = (i = n.cellDelimiter) != null ? i : " ";
69
- return t.map((r, d) => {
70
- var c;
71
- let o = (c = $(r.dataItem, r.fields, a)) != null ? c : "";
72
- return n.copyHeaders && d === 0 && (o = v(o, r.fields, n)), o ? [o] : [];
73
- }).join(e);
70
+ }), l;
74
71
  }, R = (t, n) => {
75
- var a;
72
+ var r, o;
73
+ const e = (r = n.newLineDelimiter) != null ? r : `\r
74
+ `, s = (o = n.cellDelimiter) != null ? o : " ";
75
+ return t.map((l, i) => {
76
+ var d;
77
+ let c = (d = $(
78
+ l.dataItem,
79
+ l.fields,
80
+ s,
81
+ n.preventFormulaInjection !== !1
82
+ )) != null ? d : "";
83
+ return n.copyHeaders && i === 0 && (c = O(c, l.fields, n)), c ? [c] : [];
84
+ }).join(e);
85
+ }, G = (t, n) => {
86
+ var s;
76
87
  let e = "";
77
88
  if (t.type === "paste") {
78
- const s = t.nativeEvent ? t.nativeEvent.clipboardData : "";
79
- e = s ? s.getData("text").trim() : "";
89
+ const a = t.nativeEvent ? t.nativeEvent.clipboardData : "";
90
+ e = a ? a.getData("text").trim() : "";
80
91
  } else
81
- e = O(n, t), (a = navigator.clipboard) == null || a.writeText(e);
92
+ e = R(n, t), (s = navigator.clipboard) == null || s.writeText(e);
82
93
  return e;
83
- }, G = (t) => {
84
- const { event: n } = t, e = w(t) || [], a = R(n, e) || "", s = n.type === "paste" ? S(t, a) || [] : [];
94
+ }, U = (t) => {
95
+ const { event: n } = t, e = b(t) || [], s = G(n, e) || "", a = n.type === "paste" ? S(t, s) || [] : [];
85
96
  return {
86
97
  copiedItems: e,
87
- pastedItems: s,
88
- clipboardData: a
98
+ pastedItems: a,
99
+ clipboardData: s
89
100
  };
90
101
  };
91
102
  export {
92
103
  E as ClipboardActionType,
93
- v as addHeaders,
94
- R as getClipboardData,
95
- K as getClipboardItemsToPaste,
96
- O as getClipboardText,
97
- F as getItemsToPaste,
98
- L as getItemsToUpdateOnPaste,
104
+ O as addHeaders,
105
+ G as getClipboardData,
106
+ j as getClipboardItemsToPaste,
107
+ R as getClipboardText,
108
+ K as getItemsToPaste,
109
+ F as getItemsToUpdateOnPaste,
99
110
  S as getPastedItems,
100
- C as getPreviouslyCopiedItemsData,
101
- w as getSelectedItems,
111
+ L as getPreviouslyCopiedItemsData,
112
+ b as getSelectedItems,
102
113
  $ as itemToString,
103
- G as populateClipboardData
114
+ U as populateClipboardData
104
115
  };