@deviceinsight/ng-ui-scale-lib 9.26.0 → 10.0.0

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.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/dist/AccessEditModal-x6TMxYkb.js +90 -0
  3. package/dist/AccessEditModal-x6TMxYkb.js.map +1 -0
  4. package/dist/BundleManagementContainer-B49bT5K-.js +16 -0
  5. package/dist/BundleManagementContainer-B49bT5K-.js.map +1 -0
  6. package/dist/BundlesContainer-BHzbWPe9.js +914 -0
  7. package/dist/BundlesContainer-BHzbWPe9.js.map +1 -0
  8. package/dist/DatapointImport-BSFXGuOh.js +293 -0
  9. package/dist/DatapointImport-BSFXGuOh.js.map +1 -0
  10. package/dist/FileUploadInput-Ccq_3cug.js +45 -0
  11. package/dist/FileUploadInput-Ccq_3cug.js.map +1 -0
  12. package/dist/Files-BniY5cJF.js +347 -0
  13. package/dist/Files-BniY5cJF.js.map +1 -0
  14. package/dist/GlobalPowerBiReports-CayA5Bqf.js +103 -0
  15. package/dist/GlobalPowerBiReports-CayA5Bqf.js.map +1 -0
  16. package/dist/Graph-BqYDNKEo.js +53 -0
  17. package/dist/Graph-BqYDNKEo.js.map +1 -0
  18. package/dist/JsonSettingWidget-pI5gCFnm.js +53 -0
  19. package/dist/JsonSettingWidget-pI5gCFnm.js.map +1 -0
  20. package/dist/LicensesEditPage-Bef9P-VO.js +145 -0
  21. package/dist/LicensesEditPage-Bef9P-VO.js.map +1 -0
  22. package/dist/LicensesList-Bwb2a9OS.js +149 -0
  23. package/dist/LicensesList-Bwb2a9OS.js.map +1 -0
  24. package/dist/PropertiesEditPage-OrwneFF4.js +373 -0
  25. package/dist/PropertiesEditPage-OrwneFF4.js.map +1 -0
  26. package/dist/{PropertiesList-59c05fe4.js → PropertiesList-DRYRjsEu.js} +56 -58
  27. package/dist/PropertiesList-DRYRjsEu.js.map +1 -0
  28. package/dist/TemplateEditPage-B9v3VwGH.js +508 -0
  29. package/dist/TemplateEditPage-B9v3VwGH.js.map +1 -0
  30. package/dist/TemplateTextInput-CZFJ0oAT.js +45 -0
  31. package/dist/TemplateTextInput-CZFJ0oAT.js.map +1 -0
  32. package/dist/TemplatesListPage-BIZ0egkq.js +330 -0
  33. package/dist/TemplatesListPage-BIZ0egkq.js.map +1 -0
  34. package/dist/UserGroupAssignments-Wk1S9obw.js +297 -0
  35. package/dist/UserGroupAssignments-Wk1S9obw.js.map +1 -0
  36. package/dist/{UserGroupTheme-6768666a.js → UserGroupTheme-BLBu4kUe.js} +51 -53
  37. package/dist/UserGroupTheme-BLBu4kUe.js.map +1 -0
  38. package/dist/api.d.ts +805 -802
  39. package/dist/api.js +73 -77
  40. package/dist/api.js.map +1 -0
  41. package/dist/{consts-012135e5.js → consts-CZ_QkIyI.js} +1 -2
  42. package/dist/consts-CZ_QkIyI.js.map +1 -0
  43. package/dist/{customFileCategories-1b64ed45.js → customFileCategories-bG5S9qSy.js} +1 -0
  44. package/dist/customFileCategories-bG5S9qSy.js.map +1 -0
  45. package/dist/index.d.ts +3 -7
  46. package/dist/index.js +4729 -17113
  47. package/dist/index.js.map +1 -0
  48. package/dist/setTitle-Ck-71vC0.js +39377 -0
  49. package/dist/setTitle-Ck-71vC0.js.map +1 -0
  50. package/dist/style.css +1 -1
  51. package/dist/{useCanDeleteBundleVersion-64f35949.js → useCanDeleteBundleVersion-CUD1pDJ0.js} +1 -0
  52. package/dist/useCanDeleteBundleVersion-CUD1pDJ0.js.map +1 -0
  53. package/package.json +85 -108
  54. package/dist/AccessEditModal-c2178ad5.js +0 -92
  55. package/dist/BundleManagementContainer-60c28e65.js +0 -20
  56. package/dist/BundlesContainer-b3ee1991.js +0 -912
  57. package/dist/ContextBarContext-a6c59c97.js +0 -88776
  58. package/dist/DatapointImport-f6bdbdbc.js +0 -864
  59. package/dist/FileUploadInput-81bb787f.js +0 -44
  60. package/dist/Files-dc240d97.js +0 -364
  61. package/dist/GlobalPowerBiReports-3b7feef9.js +0 -11081
  62. package/dist/Graph-f5463f47.js +0 -25012
  63. package/dist/JsonSettingWidget-307658b8.js +0 -56
  64. package/dist/LicensesEditPage-f62cca26.js +0 -146
  65. package/dist/LicensesList-85279448.js +0 -150
  66. package/dist/PropertiesEditPage-4edb93b7.js +0 -371
  67. package/dist/TemplateEditPage-fe1b5f44.js +0 -508
  68. package/dist/TemplateTextInput-34e4356f.js +0 -49
  69. package/dist/TemplatesListPage-cd3194a7.js +0 -330
  70. package/dist/UserGroupAssignments-291f29f0.js +0 -297
  71. package/dist/index-738ab9ab.js +0 -18679
@@ -1,864 +0,0 @@
1
- import { ax as c, a5 as Et, d0 as wt, b2 as bt, ag as et, aZ as kt, bs as It } from "./ContextBarContext-a6c59c97.js";
2
- import * as Dt from "react";
3
- import { createContext as Ot, useState as pt, useEffect as Rt, useContext as At } from "react";
4
- import { Spinner as Tt, Button as yt, Icon as Lt, Bubble as jt } from "@deviceinsight/ng-ui-basic-components";
5
- import { ReactableWithClientSidePagination as Nt, FileUpload as Ut } from "@deviceinsight/ng-ui-components";
6
- import "react-i18next";
7
- import { fetchUnits as Pt, readAccountObject as Ft, writeAccountObject as zt } from "@deviceinsight/ng-ui-api-client";
8
- import "react-router-dom";
9
- import "react-dom";
10
- import "i18next";
11
- import "ux4iot-react";
12
- function Mt(h) {
13
- const l = h.uploadState || "UPLOAD_PENDING";
14
- return /* @__PURE__ */ c.jsx("span", { className: `di upload-status ${l.toLowerCase()}`, children: l === "UPLOAD_PENDING" && /* @__PURE__ */ c.jsx(Tt, { size: 16 }) });
15
- }
16
- const qt = {
17
- page: 0,
18
- size: 10,
19
- sort: {
20
- property: "index",
21
- direction: "ASC"
22
- }
23
- }, Kt = (h, l, g) => {
24
- const d = l.direction === "ASC" ? 1 : -1;
25
- return l.property === "index" ? h.sort((x, I) => d * (x.idx - I.idx)) : g(h, l);
26
- }, Bt = [
27
- {
28
- name: "index",
29
- label: "",
30
- render: (h) => h.idx
31
- },
32
- {
33
- name: "name",
34
- label: "",
35
- render: (h) => /* @__PURE__ */ c.jsx("div", { className: "import-datapoint-name-cell-wrapper", children: /* @__PURE__ */ c.jsx("div", { className: "name-wrapper", title: h.data ? h.data.name : "", children: h.data ? h.data.name : "" }) })
36
- },
37
- {
38
- name: "datatype",
39
- label: "",
40
- render: (h) => h.data ? h.data.datatype : ""
41
- },
42
- {
43
- name: "unit",
44
- label: "",
45
- render: (h) => h.data && h.data.unit ? h.data.unit.print : ""
46
- },
47
- {
48
- name: "threshold1",
49
- label: "",
50
- render: (h) => {
51
- var l, g;
52
- return h.data && ((l = h.data.thresholds) != null && l.threshold1) ? (g = h.data.thresholds) == null ? void 0 : g.threshold1.toString() : "";
53
- }
54
- },
55
- {
56
- name: "threshold2",
57
- label: "",
58
- render: (h) => {
59
- var l, g;
60
- return h.data && ((l = h.data.thresholds) != null && l.threshold2) ? (g = h.data.thresholds) == null ? void 0 : g.threshold2.toString() : "";
61
- }
62
- },
63
- {
64
- name: "error",
65
- label: "",
66
- render: (h) => h.error || ""
67
- }
68
- ];
69
- class Wt extends Dt.PureComponent {
70
- constructor(l) {
71
- super(l), this._isMounted = !1, this.state = {
72
- rowUploadStates: {},
73
- paginationSettings: { ...qt, size: l.pageSize }
74
- };
75
- }
76
- componentDidMount() {
77
- this._isMounted = !0;
78
- }
79
- componentDidUpdate(l) {
80
- const { data: g } = this.props;
81
- !l.data.length && g.length && this.setState(
82
- {
83
- rowUploadStates: {}
84
- },
85
- () => this.createDatapoint(0)
86
- ), l.pageSize !== this.props.pageSize && this.setState((d) => ({
87
- ...d,
88
- paginationSettings: { ...d.paginationSettings, size: this.props.pageSize }
89
- }));
90
- }
91
- componentWillUnmount() {
92
- this._isMounted = !1;
93
- }
94
- createDatapoint(l) {
95
- const { data: g, onRowComplete: d } = this.props, { rowUploadStates: x } = this.state;
96
- if (d(x), l >= g.length)
97
- return;
98
- if (!g[l])
99
- return this.createDatapoint(l + 1);
100
- const {
101
- data: { name: I, datatype: P, unit: q, thresholds: a },
102
- error: $
103
- } = g[l];
104
- if ($)
105
- return setTimeout(() => this.updateUploadStateAndContinue(l, "CANNOT_UPLOAD"), 0);
106
- const N = {
107
- name: I,
108
- datatype: P,
109
- thresholds: a,
110
- datapointType: "RAW"
111
- };
112
- q != null && q.name && (N.unit = q || void 0), (a != null && a.threshold1 || a != null && a.threshold2) && (N.thresholds = a), this.props.createDatapoint(N).then(() => this.updateUploadStateAndContinue(l, "UPLOAD_SUCCESSFUL")).catch(() => this.updateUploadStateAndContinue(l, "UPLOAD_FAILED"));
113
- }
114
- updateUploadStateAndContinue(l, g) {
115
- const { rowUploadStates: d } = this.state;
116
- this._isMounted && this.setState(
117
- {
118
- rowUploadStates: { ...d, [l]: g }
119
- },
120
- () => this.createDatapoint(l + 1)
121
- );
122
- }
123
- getColumnDefs() {
124
- const { rowUploadStates: l } = this.state;
125
- return [
126
- ...Bt,
127
- {
128
- name: "result",
129
- label: "",
130
- render: (g) => /* @__PURE__ */ c.jsx(Mt, { uploadState: l[g.idx] })
131
- }
132
- ];
133
- }
134
- render() {
135
- const { data: l, isLoading: g } = this.props;
136
- return /* @__PURE__ */ c.jsx(
137
- Nt,
138
- {
139
- columnDefs: this.getColumnDefs(),
140
- uniqueItemKey: (d) => `${d.idx}`,
141
- customSortFunction: Kt,
142
- paginationSettings: this.state.paginationSettings,
143
- items: l,
144
- isLoading: g,
145
- onChangeSize: this.props.onPageSizeChange,
146
- tableName: "datapointImportResults"
147
- }
148
- );
149
- }
150
- }
151
- var Ct = { exports: {} };
152
- /* @license
153
- Papa Parse
154
- v5.3.0
155
- https://github.com/mholt/PapaParse
156
- License: MIT
157
- */
158
- (function(h, l) {
159
- (function(g, d) {
160
- h.exports = d();
161
- })(Et, function g() {
162
- var d = typeof self < "u" ? self : typeof window < "u" ? window : d !== void 0 ? d : {}, x = !d.document && !!d.postMessage, I = x && /blob:/i.test((d.location || {}).protocol), P = {}, q = 0, a = { parse: function(e, t) {
163
- var n = (t = t || {}).dynamicTyping || !1;
164
- if (w(n) && (t.dynamicTypingFunction = n, n = {}), t.dynamicTyping = n, t.transform = !!w(t.transform) && t.transform, t.worker && a.WORKERS_SUPPORTED) {
165
- var i = function() {
166
- if (!a.WORKERS_SUPPORTED)
167
- return !1;
168
- var f = (F = d.URL || d.webkitURL || null, D = g.toString(), a.BLOB_URL || (a.BLOB_URL = F.createObjectURL(new Blob(["(", D, ")();"], { type: "text/javascript" })))), S = new d.Worker(f), F, D;
169
- return S.onmessage = ft, S.id = q++, P[S.id] = S;
170
- }();
171
- return i.userStep = t.step, i.userChunk = t.chunk, i.userComplete = t.complete, i.userError = t.error, t.step = w(t.step), t.chunk = w(t.chunk), t.complete = w(t.complete), t.error = w(t.error), delete t.worker, void i.postMessage({ input: e, config: t, workerId: i.id });
172
- }
173
- var s = null;
174
- return a.NODE_STREAM_INPUT, typeof e == "string" ? s = t.download ? new Y(t) : new Z(t) : e.readable === !0 && w(e.read) && w(e.on) ? s = new ht(t) : (d.File && e instanceof File || e instanceof Object) && (s = new X(t)), s.stream(e);
175
- }, unparse: function(e, t) {
176
- var n = !1, i = !0, s = ",", f = `\r
177
- `, S = '"', F = S + S, D = !1, r = null, j = !1;
178
- (function() {
179
- if (typeof t == "object") {
180
- if (typeof t.delimiter != "string" || a.BAD_DELIMITERS.filter(function(C) {
181
- return t.delimiter.indexOf(C) !== -1;
182
- }).length || (s = t.delimiter), (typeof t.quotes == "boolean" || typeof t.quotes == "function" || Array.isArray(t.quotes)) && (n = t.quotes), typeof t.skipEmptyLines != "boolean" && typeof t.skipEmptyLines != "string" || (D = t.skipEmptyLines), typeof t.newline == "string" && (f = t.newline), typeof t.quoteChar == "string" && (S = t.quoteChar), typeof t.header == "boolean" && (i = t.header), Array.isArray(t.columns)) {
183
- if (t.columns.length === 0)
184
- throw new Error("Option columns is empty");
185
- r = t.columns;
186
- }
187
- t.escapeChar !== void 0 && (F = t.escapeChar + S), typeof t.escapeFormulae == "boolean" && (j = t.escapeFormulae);
188
- }
189
- })();
190
- var o = new RegExp(K(S), "g");
191
- if (typeof e == "string" && (e = JSON.parse(e)), Array.isArray(e)) {
192
- if (!e.length || Array.isArray(e[0]))
193
- return z(null, e, D);
194
- if (typeof e[0] == "object")
195
- return z(r || nt(e[0]), e, D);
196
- } else if (typeof e == "object")
197
- return typeof e.data == "string" && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : nt(e.data[0])), Array.isArray(e.data[0]) || typeof e.data[0] == "object" || (e.data = [e.data])), z(e.fields || [], e.data || [], D);
198
- throw new Error("Unable to serialize unrecognized input");
199
- function nt(C) {
200
- if (typeof C != "object")
201
- return [];
202
- var E = [];
203
- for (var T in C)
204
- E.push(T);
205
- return E;
206
- }
207
- function z(C, E, T) {
208
- var U = "";
209
- typeof C == "string" && (C = JSON.parse(C)), typeof E == "string" && (E = JSON.parse(E));
210
- var L = Array.isArray(C) && 0 < C.length, B = !Array.isArray(E[0]);
211
- if (L && i) {
212
- for (var u = 0; u < C.length; u++)
213
- 0 < u && (U += s), U += m(C[u], u);
214
- 0 < E.length && (U += f);
215
- }
216
- for (var _ = 0; _ < E.length; _++) {
217
- var b = L ? C.length : E[_].length, k = !1, y = L ? Object.keys(E[_]).length === 0 : E[_].length === 0;
218
- if (T && !L && (k = T === "greedy" ? E[_].join("").trim() === "" : E[_].length === 1 && E[_][0].length === 0), T === "greedy" && L) {
219
- for (var v = [], O = 0; O < b; O++) {
220
- var p = B ? C[O] : O;
221
- v.push(E[_][p]);
222
- }
223
- k = v.join("").trim() === "";
224
- }
225
- if (!k) {
226
- for (var R = 0; R < b; R++) {
227
- 0 < R && !y && (U += s);
228
- var J = L && B ? C[R] : R;
229
- U += m(E[_][J], R);
230
- }
231
- _ < E.length - 1 && (!T || 0 < b && !y) && (U += f);
232
- }
233
- }
234
- return U;
235
- }
236
- function m(C, E) {
237
- if (C == null)
238
- return "";
239
- if (C.constructor === Date)
240
- return JSON.stringify(C).slice(1, 25);
241
- j === !0 && typeof C == "string" && C.match(/^[=+\-@].*$/) !== null && (C = "'" + C);
242
- var T = C.toString().replace(o, F), U = typeof n == "boolean" && n || typeof n == "function" && n(C, E) || Array.isArray(n) && n[E] || function(L, B) {
243
- for (var u = 0; u < B.length; u++)
244
- if (-1 < L.indexOf(B[u]))
245
- return !0;
246
- return !1;
247
- }(T, a.BAD_DELIMITERS) || -1 < T.indexOf(s) || T.charAt(0) === " " || T.charAt(T.length - 1) === " ";
248
- return U ? S + T + S : T;
249
- }
250
- } };
251
- if (a.RECORD_SEP = String.fromCharCode(30), a.UNIT_SEP = String.fromCharCode(31), a.BYTE_ORDER_MARK = "\uFEFF", a.BAD_DELIMITERS = ["\r", `
252
- `, '"', a.BYTE_ORDER_MARK], a.WORKERS_SUPPORTED = !x && !!d.Worker, a.NODE_STREAM_INPUT = 1, a.LocalChunkSize = 10485760, a.RemoteChunkSize = 5242880, a.DefaultDelimiter = ",", a.Parser = W, a.ParserHandle = ut, a.NetworkStreamer = Y, a.FileStreamer = X, a.StringStreamer = Z, a.ReadableStreamStreamer = ht, d.jQuery) {
253
- var $ = d.jQuery;
254
- $.fn.parse = function(e) {
255
- var t = e.config || {}, n = [];
256
- return this.each(function(f) {
257
- if (!($(this).prop("tagName").toUpperCase() === "INPUT" && $(this).attr("type").toLowerCase() === "file" && d.FileReader) || !this.files || this.files.length === 0)
258
- return !0;
259
- for (var S = 0; S < this.files.length; S++)
260
- n.push({ file: this.files[S], inputElem: this, instanceConfig: $.extend({}, t) });
261
- }), i(), this;
262
- function i() {
263
- if (n.length !== 0) {
264
- var f, S, F, D, r = n[0];
265
- if (w(e.before)) {
266
- var j = e.before(r.file, r.inputElem);
267
- if (typeof j == "object") {
268
- if (j.action === "abort")
269
- return f = "AbortError", S = r.file, F = r.inputElem, D = j.reason, void (w(e.error) && e.error({ name: f }, S, F, D));
270
- if (j.action === "skip")
271
- return void s();
272
- typeof j.config == "object" && (r.instanceConfig = $.extend(r.instanceConfig, j.config));
273
- } else if (j === "skip")
274
- return void s();
275
- }
276
- var o = r.instanceConfig.complete;
277
- r.instanceConfig.complete = function(nt) {
278
- w(o) && o(nt, r.file, r.inputElem), s();
279
- }, a.parse(r.file, r.instanceConfig);
280
- } else
281
- w(e.complete) && e.complete();
282
- }
283
- function s() {
284
- n.splice(0, 1), i();
285
- }
286
- };
287
- }
288
- function N(e) {
289
- this._handle = null, this._finished = !1, this._completed = !1, this._halted = !1, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = !0, this._completeResults = { data: [], errors: [], meta: {} }, (function(t) {
290
- var n = mt(t);
291
- n.chunkSize = parseInt(n.chunkSize), t.step || t.chunk || (n.chunkSize = null), this._handle = new ut(n), (this._handle.streamer = this)._config = n;
292
- }).call(this, e), this.parseChunk = function(t, n) {
293
- if (this.isFirstChunk && w(this._config.beforeFirstChunk)) {
294
- var i = this._config.beforeFirstChunk(t);
295
- i !== void 0 && (t = i);
296
- }
297
- this.isFirstChunk = !1, this._halted = !1;
298
- var s = this._partialLine + t;
299
- this._partialLine = "";
300
- var f = this._handle.parse(s, this._baseIndex, !this._finished);
301
- if (!this._handle.paused() && !this._handle.aborted()) {
302
- var S = f.meta.cursor;
303
- this._finished || (this._partialLine = s.substring(S - this._baseIndex), this._baseIndex = S), f && f.data && (this._rowCount += f.data.length);
304
- var F = this._finished || this._config.preview && this._rowCount >= this._config.preview;
305
- if (I)
306
- d.postMessage({ results: f, workerId: a.WORKER_ID, finished: F });
307
- else if (w(this._config.chunk) && !n) {
308
- if (this._config.chunk(f, this._handle), this._handle.paused() || this._handle.aborted())
309
- return void (this._halted = !0);
310
- f = void 0, this._completeResults = void 0;
311
- }
312
- return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(f.data), this._completeResults.errors = this._completeResults.errors.concat(f.errors), this._completeResults.meta = f.meta), this._completed || !F || !w(this._config.complete) || f && f.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = !0), F || f && f.meta.paused || this._nextChunk(), f;
313
- }
314
- this._halted = !0;
315
- }, this._sendError = function(t) {
316
- w(this._config.error) ? this._config.error(t) : I && this._config.error && d.postMessage({ workerId: a.WORKER_ID, error: t, finished: !1 });
317
- };
318
- }
319
- function Y(e) {
320
- var t;
321
- (e = e || {}).chunkSize || (e.chunkSize = a.RemoteChunkSize), N.call(this, e), this._nextChunk = x ? function() {
322
- this._readChunk(), this._chunkLoaded();
323
- } : function() {
324
- this._readChunk();
325
- }, this.stream = function(n) {
326
- this._input = n, this._nextChunk();
327
- }, this._readChunk = function() {
328
- if (this._finished)
329
- this._chunkLoaded();
330
- else {
331
- if (t = new XMLHttpRequest(), this._config.withCredentials && (t.withCredentials = this._config.withCredentials), x || (t.onload = at(this._chunkLoaded, this), t.onerror = at(this._chunkError, this)), t.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !x), this._config.downloadRequestHeaders) {
332
- var n = this._config.downloadRequestHeaders;
333
- for (var i in n)
334
- t.setRequestHeader(i, n[i]);
335
- }
336
- if (this._config.chunkSize) {
337
- var s = this._start + this._config.chunkSize - 1;
338
- t.setRequestHeader("Range", "bytes=" + this._start + "-" + s);
339
- }
340
- try {
341
- t.send(this._config.downloadRequestBody);
342
- } catch (f) {
343
- this._chunkError(f.message);
344
- }
345
- x && t.status === 0 && this._chunkError();
346
- }
347
- }, this._chunkLoaded = function() {
348
- t.readyState === 4 && (t.status < 200 || 400 <= t.status ? this._chunkError() : (this._start += this._config.chunkSize ? this._config.chunkSize : t.responseText.length, this._finished = !this._config.chunkSize || this._start >= function(n) {
349
- var i = n.getResponseHeader("Content-Range");
350
- return i === null ? -1 : parseInt(i.substring(i.lastIndexOf("/") + 1));
351
- }(t), this.parseChunk(t.responseText)));
352
- }, this._chunkError = function(n) {
353
- var i = t.statusText || n;
354
- this._sendError(new Error(i));
355
- };
356
- }
357
- function X(e) {
358
- var t, n;
359
- (e = e || {}).chunkSize || (e.chunkSize = a.LocalChunkSize), N.call(this, e);
360
- var i = typeof FileReader < "u";
361
- this.stream = function(s) {
362
- this._input = s, n = s.slice || s.webkitSlice || s.mozSlice, i ? ((t = new FileReader()).onload = at(this._chunkLoaded, this), t.onerror = at(this._chunkError, this)) : t = new FileReaderSync(), this._nextChunk();
363
- }, this._nextChunk = function() {
364
- this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
365
- }, this._readChunk = function() {
366
- var s = this._input;
367
- if (this._config.chunkSize) {
368
- var f = Math.min(this._start + this._config.chunkSize, this._input.size);
369
- s = n.call(s, this._start, f);
370
- }
371
- var S = t.readAsText(s, this._config.encoding);
372
- i || this._chunkLoaded({ target: { result: S } });
373
- }, this._chunkLoaded = function(s) {
374
- this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(s.target.result);
375
- }, this._chunkError = function() {
376
- this._sendError(t.error);
377
- };
378
- }
379
- function Z(e) {
380
- var t;
381
- N.call(this, e = e || {}), this.stream = function(n) {
382
- return t = n, this._nextChunk();
383
- }, this._nextChunk = function() {
384
- if (!this._finished) {
385
- var n, i = this._config.chunkSize;
386
- return i ? (n = t.substring(0, i), t = t.substring(i)) : (n = t, t = ""), this._finished = !t, this.parseChunk(n);
387
- }
388
- };
389
- }
390
- function ht(e) {
391
- N.call(this, e = e || {});
392
- var t = [], n = !0, i = !1;
393
- this.pause = function() {
394
- N.prototype.pause.apply(this, arguments), this._input.pause();
395
- }, this.resume = function() {
396
- N.prototype.resume.apply(this, arguments), this._input.resume();
397
- }, this.stream = function(s) {
398
- this._input = s, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
399
- }, this._checkIsFinished = function() {
400
- i && t.length === 1 && (this._finished = !0);
401
- }, this._nextChunk = function() {
402
- this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : n = !0;
403
- }, this._streamData = at(function(s) {
404
- try {
405
- t.push(typeof s == "string" ? s : s.toString(this._config.encoding)), n && (n = !1, this._checkIsFinished(), this.parseChunk(t.shift()));
406
- } catch (f) {
407
- this._streamError(f);
408
- }
409
- }, this), this._streamError = at(function(s) {
410
- this._streamCleanUp(), this._sendError(s);
411
- }, this), this._streamEnd = at(function() {
412
- this._streamCleanUp(), i = !0, this._streamData("");
413
- }, this), this._streamCleanUp = at(function() {
414
- this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
415
- }, this);
416
- }
417
- function ut(e) {
418
- var t, n, i, s = Math.pow(2, 53), f = -s, S = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)(e[-+]?\d+)?\s*$/, F = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/, D = this, r = 0, j = 0, o = !1, nt = !1, z = [], m = { data: [], errors: [], meta: {} };
419
- if (w(e.step)) {
420
- var C = e.step;
421
- e.step = function(u) {
422
- if (m = u, U())
423
- T();
424
- else {
425
- if (T(), m.data.length === 0)
426
- return;
427
- r += u.data.length, e.preview && r > e.preview ? n.abort() : (m.data = m.data[0], C(m, D));
428
- }
429
- };
430
- }
431
- function E(u) {
432
- return e.skipEmptyLines === "greedy" ? u.join("").trim() === "" : u.length === 1 && u[0].length === 0;
433
- }
434
- function T() {
435
- if (m && i && (B("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + a.DefaultDelimiter + "'"), i = !1), e.skipEmptyLines)
436
- for (var u = 0; u < m.data.length; u++)
437
- E(m.data[u]) && m.data.splice(u--, 1);
438
- return U() && function() {
439
- if (!m)
440
- return;
441
- function _(k, y) {
442
- w(e.transformHeader) && (k = e.transformHeader(k, y)), z.push(k);
443
- }
444
- if (Array.isArray(m.data[0])) {
445
- for (var b = 0; U() && b < m.data.length; b++)
446
- m.data[b].forEach(_);
447
- m.data.splice(0, 1);
448
- } else
449
- m.data.forEach(_);
450
- }(), function() {
451
- if (!m || !e.header && !e.dynamicTyping && !e.transform)
452
- return m;
453
- function _(k, y) {
454
- var v, O = e.header ? {} : [];
455
- for (v = 0; v < k.length; v++) {
456
- var p = v, R = k[v];
457
- e.header && (p = v >= z.length ? "__parsed_extra" : z[v]), e.transform && (R = e.transform(R, p)), R = L(p, R), p === "__parsed_extra" ? (O[p] = O[p] || [], O[p].push(R)) : O[p] = R;
458
- }
459
- return e.header && (v > z.length ? B("FieldMismatch", "TooManyFields", "Too many fields: expected " + z.length + " fields but parsed " + v, j + y) : v < z.length && B("FieldMismatch", "TooFewFields", "Too few fields: expected " + z.length + " fields but parsed " + v, j + y)), O;
460
- }
461
- var b = 1;
462
- return !m.data.length || Array.isArray(m.data[0]) ? (m.data = m.data.map(_), b = m.data.length) : m.data = _(m.data, 0), e.header && m.meta && (m.meta.fields = z), j += b, m;
463
- }();
464
- }
465
- function U() {
466
- return e.header && z.length === 0;
467
- }
468
- function L(u, _) {
469
- return b = u, e.dynamicTypingFunction && e.dynamicTyping[b] === void 0 && (e.dynamicTyping[b] = e.dynamicTypingFunction(b)), (e.dynamicTyping[b] || e.dynamicTyping) === !0 ? _ === "true" || _ === "TRUE" || _ !== "false" && _ !== "FALSE" && (function(k) {
470
- if (S.test(k)) {
471
- var y = parseFloat(k);
472
- if (f < y && y < s)
473
- return !0;
474
- }
475
- return !1;
476
- }(_) ? parseFloat(_) : F.test(_) ? new Date(_) : _ === "" ? null : _) : _;
477
- var b;
478
- }
479
- function B(u, _, b, k) {
480
- var y = { type: u, code: _, message: b };
481
- k !== void 0 && (y.row = k), m.errors.push(y);
482
- }
483
- this.parse = function(u, _, b) {
484
- var k = e.quoteChar || '"';
485
- if (e.newline || (e.newline = function(O, p) {
486
- O = O.substring(0, 1048576);
487
- var R = new RegExp(K(p) + "([^]*?)" + K(p), "gm"), J = (O = O.replace(R, "")).split("\r"), V = O.split(`
488
- `), tt = 1 < V.length && V[0].length < J[0].length;
489
- if (J.length === 1 || tt)
490
- return `
491
- `;
492
- for (var it = 0, H = 0; H < J.length; H++)
493
- J[H][0] === `
494
- ` && it++;
495
- return it >= J.length / 2 ? `\r
496
- ` : "\r";
497
- }(u, k)), i = !1, e.delimiter)
498
- w(e.delimiter) && (e.delimiter = e.delimiter(u), m.meta.delimiter = e.delimiter);
499
- else {
500
- var y = function(O, p, R, J, V) {
501
- var tt, it, H, lt;
502
- V = V || [",", " ", "|", ";", a.RECORD_SEP, a.UNIT_SEP];
503
- for (var M = 0; M < V.length; M++) {
504
- var ot = V[M], dt = 0, A = 0, rt = 0;
505
- H = void 0;
506
- for (var G = new W({ comments: J, delimiter: ot, newline: p, preview: 10 }).parse(O), st = 0; st < G.data.length; st++)
507
- if (R && E(G.data[st]))
508
- rt++;
509
- else {
510
- var Q = G.data[st].length;
511
- A += Q, H !== void 0 ? 0 < Q && (dt += Math.abs(Q - H), H = Q) : H = Q;
512
- }
513
- 0 < G.data.length && (A /= G.data.length - rt), (it === void 0 || dt <= it) && (lt === void 0 || lt < A) && 1.99 < A && (it = dt, tt = ot, lt = A);
514
- }
515
- return { successful: !!(e.delimiter = tt), bestDelimiter: tt };
516
- }(u, e.newline, e.skipEmptyLines, e.comments, e.delimitersToGuess);
517
- y.successful ? e.delimiter = y.bestDelimiter : (i = !0, e.delimiter = a.DefaultDelimiter), m.meta.delimiter = e.delimiter;
518
- }
519
- var v = mt(e);
520
- return e.preview && e.header && v.preview++, t = u, n = new W(v), m = n.parse(t, _, b), T(), o ? { meta: { paused: !0 } } : m || { meta: { paused: !1 } };
521
- }, this.paused = function() {
522
- return o;
523
- }, this.pause = function() {
524
- o = !0, n.abort(), t = w(e.chunk) ? "" : t.substring(n.getCharIndex());
525
- }, this.resume = function() {
526
- D.streamer._halted ? (o = !1, D.streamer.parseChunk(t, !0)) : setTimeout(D.resume, 3);
527
- }, this.aborted = function() {
528
- return nt;
529
- }, this.abort = function() {
530
- nt = !0, n.abort(), m.meta.aborted = !0, w(e.complete) && e.complete(m), t = "";
531
- };
532
- }
533
- function K(e) {
534
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
535
- }
536
- function W(e) {
537
- var t, n = (e = e || {}).delimiter, i = e.newline, s = e.comments, f = e.step, S = e.preview, F = e.fastMode, D = t = e.quoteChar === void 0 ? '"' : e.quoteChar;
538
- if (e.escapeChar !== void 0 && (D = e.escapeChar), (typeof n != "string" || -1 < a.BAD_DELIMITERS.indexOf(n)) && (n = ","), s === n)
539
- throw new Error("Comment character same as delimiter");
540
- s === !0 ? s = "#" : (typeof s != "string" || -1 < a.BAD_DELIMITERS.indexOf(s)) && (s = !1), i !== `
541
- ` && i !== "\r" && i !== `\r
542
- ` && (i = `
543
- `);
544
- var r = 0, j = !1;
545
- this.parse = function(o, nt, z) {
546
- if (typeof o != "string")
547
- throw new Error("Input must be a string");
548
- var m = o.length, C = n.length, E = i.length, T = s.length, U = w(f), L = [], B = [], u = [], _ = r = 0;
549
- if (!o)
550
- return M();
551
- if (F || F !== !1 && o.indexOf(t) === -1) {
552
- for (var b = o.split(i), k = 0; k < b.length; k++) {
553
- if (u = b[k], r += u.length, k !== b.length - 1)
554
- r += i.length;
555
- else if (z)
556
- return M();
557
- if (!s || u.substring(0, T) !== s) {
558
- if (U) {
559
- if (L = [], tt(u.split(n)), ot(), j)
560
- return M();
561
- } else
562
- tt(u.split(n));
563
- if (S && S <= k)
564
- return L = L.slice(0, S), M(!0);
565
- }
566
- }
567
- return M();
568
- }
569
- for (var y = o.indexOf(n, r), v = o.indexOf(i, r), O = new RegExp(K(D) + K(t), "g"), p = o.indexOf(t, r); ; )
570
- if (o[r] !== t)
571
- if (s && u.length === 0 && o.substring(r, r + T) === s) {
572
- if (v === -1)
573
- return M();
574
- r = v + E, v = o.indexOf(i, r), y = o.indexOf(n, r);
575
- } else {
576
- if (y !== -1 && (y < v || v === -1)) {
577
- if (!(y < p)) {
578
- u.push(o.substring(r, y)), r = y + C, y = o.indexOf(n, r);
579
- continue;
580
- }
581
- var R = dt(y, p, v);
582
- if (R && R.nextDelim !== void 0) {
583
- y = R.nextDelim, p = R.quoteSearch, u.push(o.substring(r, y)), r = y + C, y = o.indexOf(n, r);
584
- continue;
585
- }
586
- }
587
- if (v === -1)
588
- break;
589
- if (u.push(o.substring(r, v)), lt(v + E), U && (ot(), j))
590
- return M();
591
- if (S && L.length >= S)
592
- return M(!0);
593
- }
594
- else
595
- for (p = r, r++; ; ) {
596
- if ((p = o.indexOf(t, p + 1)) === -1)
597
- return z || B.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: L.length, index: r }), H();
598
- if (p === m - 1)
599
- return H(o.substring(r, p).replace(O, t));
600
- if (t !== D || o[p + 1] !== D) {
601
- if (t === D || p === 0 || o[p - 1] !== D) {
602
- y !== -1 && y < p + 1 && (y = o.indexOf(n, p + 1)), v !== -1 && v < p + 1 && (v = o.indexOf(i, p + 1));
603
- var J = it(v === -1 ? y : Math.min(y, v));
604
- if (o[p + 1 + J] === n) {
605
- u.push(o.substring(r, p).replace(O, t)), o[r = p + 1 + J + C] !== t && (p = o.indexOf(t, r)), y = o.indexOf(n, r), v = o.indexOf(i, r);
606
- break;
607
- }
608
- var V = it(v);
609
- if (o.substring(p + 1 + V, p + 1 + V + E) === i) {
610
- if (u.push(o.substring(r, p).replace(O, t)), lt(p + 1 + V + E), y = o.indexOf(n, r), p = o.indexOf(t, r), U && (ot(), j))
611
- return M();
612
- if (S && L.length >= S)
613
- return M(!0);
614
- break;
615
- }
616
- B.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: L.length, index: r }), p++;
617
- }
618
- } else
619
- p++;
620
- }
621
- return H();
622
- function tt(A) {
623
- L.push(A), _ = r;
624
- }
625
- function it(A) {
626
- var rt = 0;
627
- if (A !== -1) {
628
- var G = o.substring(p + 1, A);
629
- G && G.trim() === "" && (rt = G.length);
630
- }
631
- return rt;
632
- }
633
- function H(A) {
634
- return z || (A === void 0 && (A = o.substring(r)), u.push(A), r = m, tt(u), U && ot()), M();
635
- }
636
- function lt(A) {
637
- r = A, tt(u), u = [], v = o.indexOf(i, r);
638
- }
639
- function M(A) {
640
- return { data: L, errors: B, meta: { delimiter: n, linebreak: i, aborted: j, truncated: !!A, cursor: _ + (nt || 0) } };
641
- }
642
- function ot() {
643
- f(M()), L = [], B = [];
644
- }
645
- function dt(A, rt, G) {
646
- var st = { nextDelim: void 0, quoteSearch: void 0 }, Q = o.indexOf(t, rt + 1);
647
- if (rt < A && A < Q && (Q < G || G === -1)) {
648
- var gt = o.indexOf(n, Q);
649
- if (gt === -1)
650
- return st;
651
- Q < gt && (Q = o.indexOf(t, Q + 1)), st = dt(gt, Q, G);
652
- } else
653
- st = { nextDelim: A, quoteSearch: rt };
654
- return st;
655
- }
656
- }, this.abort = function() {
657
- j = !0;
658
- }, this.getCharIndex = function() {
659
- return r;
660
- };
661
- }
662
- function ft(e) {
663
- var t = e.data, n = P[t.workerId], i = !1;
664
- if (t.error)
665
- n.userError(t.error, t.file);
666
- else if (t.results && t.results.data) {
667
- var s = { abort: function() {
668
- i = !0, ct(t.workerId, { data: [], errors: [], meta: { aborted: !0 } });
669
- }, pause: _t, resume: _t };
670
- if (w(n.userStep)) {
671
- for (var f = 0; f < t.results.data.length && (n.userStep({ data: t.results.data[f], errors: t.results.errors, meta: t.results.meta }, s), !i); f++)
672
- ;
673
- delete t.results;
674
- } else
675
- w(n.userChunk) && (n.userChunk(t.results, s, t.file), delete t.results);
676
- }
677
- t.finished && !i && ct(t.workerId, t.results);
678
- }
679
- function ct(e, t) {
680
- var n = P[e];
681
- w(n.userComplete) && n.userComplete(t), n.terminate(), delete P[e];
682
- }
683
- function _t() {
684
- throw new Error("Not implemented.");
685
- }
686
- function mt(e) {
687
- if (typeof e != "object" || e === null)
688
- return e;
689
- var t = Array.isArray(e) ? [] : {};
690
- for (var n in e)
691
- t[n] = mt(e[n]);
692
- return t;
693
- }
694
- function at(e, t) {
695
- return function() {
696
- e.apply(t, arguments);
697
- };
698
- }
699
- function w(e) {
700
- return typeof e == "function";
701
- }
702
- return I && (d.onmessage = function(e) {
703
- var t = e.data;
704
- if (a.WORKER_ID === void 0 && t && (a.WORKER_ID = t.workerId), typeof t.input == "string")
705
- d.postMessage({ workerId: a.WORKER_ID, results: a.parse(t.input, t.config), finished: !0 });
706
- else if (d.File && t.input instanceof File || t.input instanceof Object) {
707
- var n = a.parse(t.input, t.config);
708
- n && d.postMessage({ workerId: a.WORKER_ID, results: n, finished: !0 });
709
- }
710
- }), (Y.prototype = Object.create(N.prototype)).constructor = Y, (X.prototype = Object.create(N.prototype)).constructor = X, (Z.prototype = Object.create(Z.prototype)).constructor = Z, (ht.prototype = Object.create(N.prototype)).constructor = ht, a;
711
- });
712
- })(Ct);
713
- var Ht = Ct.exports;
714
- const Gt = 20, Qt = (h) => {
715
- const l = [];
716
- let g = 0;
717
- const d = [...h];
718
- return h[0][0] === "DATAPOINT_NAME" && d.shift(), d.forEach((x, I) => {
719
- if (g > Gt)
720
- throw new Error("INVALID_DOCUMENT");
721
- const [P, q, a, $, N, Y] = x, X = {};
722
- N && !isNaN(parseInt(N)) && (X.threshold1 = parseInt(N)), Y && !isNaN(parseInt(Y)) && (X.threshold2 = parseInt(Y));
723
- const Z = {
724
- idx: I,
725
- data: {
726
- name: P,
727
- datatype: q && q.toUpperCase(),
728
- unit: $ ? {
729
- name: $,
730
- print: a
731
- } : null,
732
- thresholds: X
733
- }
734
- };
735
- if (l.push(Z), x.length < 2)
736
- return g++, Z.error = "INVALID_NUMBER_OF_CELLS";
737
- if (!wt.includes(q))
738
- return g++, Z.error = "INVALID_DATATYPE";
739
- }), l;
740
- }, $t = (h) => new Promise((l, g) => {
741
- Ht.parse(h, {
742
- skipEmptyLines: !0,
743
- complete: ({ data: d }) => {
744
- try {
745
- const x = Qt(d);
746
- l(x);
747
- } catch (x) {
748
- g(x);
749
- }
750
- },
751
- error: (d) => {
752
- g(d);
753
- }
754
- });
755
- }), Jt = (h, l, g) => g.findIndex((d) => (d == null ? void 0 : d.name) === (h == null ? void 0 : h.name)) === l, Yt = async (h, l, g) => {
756
- const x = l.filter((I) => !I.error).map((I) => I.data.unit).filter((I) => I && !h.some((P) => P.name === I.name)).filter(Jt).filter(bt).map(g);
757
- return await Promise.all(x), await Pt();
758
- }, Zt = [
759
- "DATAPOINT_NAME,DATAPOINT_TYPE,UNIT_DISPLAY_NAME,UNIT_IDENTIFIER,DATAPOINT_UPPER_THRESHOLD,DATAPOINT_LOWER_THRESHOLD",
760
- "new_datapoint_1,LONG,°C,degrees-celsius,20,7",
761
- "new_datapoint_2,LONG,,,,"
762
- ], vt = {
763
- marginLeft: 15,
764
- listStyle: "disc"
765
- }, Vt = () => /* @__PURE__ */ c.jsxs("ul", { style: { ...vt, width: 345 }, children: [
766
- /* @__PURE__ */ c.jsxs("li", { children: [
767
- /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.infoColumns", children: "Columns:" }),
768
- /* @__PURE__ */ c.jsxs("ul", { style: { ...vt, listStyle: "circle" }, children: [
769
- /* @__PURE__ */ c.jsx("li", { children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.datapointNameColumn", children: "Datapoint Name (required)" }) }),
770
- /* @__PURE__ */ c.jsx(
771
- "li",
772
- {
773
- style: {
774
- whiteSpace: "normal"
775
- },
776
- children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.datapointDatatypeColumn", children: "Datapoint Type (required). Datatypes: 'BOOLEAN', 'DOUBLE', 'LONG', 'TEXT', 'GEO_POSITION'" })
777
- }
778
- ),
779
- /* @__PURE__ */ c.jsx("li", { children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.datapointUnitPrintColumn", children: "Display name of unit (optional)" }) }),
780
- /* @__PURE__ */ c.jsx("li", { children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.datapointUnitPrintColumn", children: "Identifier of unit (optional)" }) }),
781
- /* @__PURE__ */ c.jsx("li", { children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.datapointUpperThresholdColumn", children: "Datapoint upper threshold (optional)" }) }),
782
- /* @__PURE__ */ c.jsx("li", { children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.datapointLowerThresholdColumn", children: "Datapoint lower threshold (optional)" }) })
783
- ] })
784
- ] }),
785
- /* @__PURE__ */ c.jsx("li", { children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.infoDelimiter", children: 'Csv should use "," as delimiter' }) })
786
- ] }), xt = Ot({
787
- pageSize: 10,
788
- onPageSizeChange: () => {
789
- }
790
- }), St = "uiConfigurations/datapointimportpagination";
791
- function Xt({ children: h }) {
792
- const [l, g] = pt(10), d = (x) => {
793
- g(x), zt(St, { pageSize: x });
794
- };
795
- return Rt(() => {
796
- const { promise: x, cancel: I } = kt(Ft(St));
797
- return x.then((P) => {
798
- g((P == null ? void 0 : P.pageSize) ?? 10);
799
- }).catch((P) => {
800
- }), I;
801
- }, []), /* @__PURE__ */ c.jsx(xt.Provider, { value: { pageSize: l, onPageSizeChange: d }, children: h });
802
- }
803
- function ue(h) {
804
- return /* @__PURE__ */ c.jsx(Xt, { children: /* @__PURE__ */ c.jsx(te, { ...h }) });
805
- }
806
- function te({ existingUnits: h, onChangeUploadStatus: l, createDatapoint: g, addUnit: d }) {
807
- const [x, I] = pt([]), [P, q] = pt(null), { pageSize: a, onPageSizeChange: $ } = At(xt), [N, Y] = pt(!1);
808
- function X() {
809
- I([]), q(null);
810
- }
811
- function Z(K) {
812
- Y(!0), I([]), q(null), $t(K).then(async (W) => {
813
- await Yt(h, W, d), I(W), l(!0, 0, 0);
814
- }).catch((W) => {
815
- q(W);
816
- }).finally(() => Y(!1));
817
- }
818
- function ht(K) {
819
- const W = Object.values(K), ft = W.filter((ct) => ct === "UPLOAD_SUCCESSFUL");
820
- l(W.length !== x.length, ft.length, x.length);
821
- }
822
- function ut() {
823
- const K = "datapoint-import-template.csv";
824
- It.saveAs(
825
- new Blob([Zt.join(`
826
- `)], {
827
- type: "text/csv"
828
- }),
829
- K
830
- );
831
- }
832
- return /* @__PURE__ */ c.jsxs(c.Fragment, { children: [
833
- /* @__PURE__ */ c.jsx(
834
- Ut,
835
- {
836
- onRemoveFile: X,
837
- onSelectFile: Z,
838
- previewComponent: ({ file: K, onRemoveFile: W }) => /* @__PURE__ */ c.jsxs("strong", { className: "di delete-file-button", children: [
839
- K ? K.name : "",
840
- /* @__PURE__ */ c.jsx(yt, { naked: !0, onClick: W, "data-testid": "delete-file-button", children: /* @__PURE__ */ c.jsx(Lt, { del: !0 }) })
841
- ] })
842
- }
843
- ),
844
- P && /* @__PURE__ */ c.jsx("div", { className: "di upload-error parsing-error", children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.tooManyParsingErrors", children: "Too many parsing errors" }) }),
845
- !x.length && /* @__PURE__ */ c.jsxs("div", { className: "di download-csv-section", children: [
846
- /* @__PURE__ */ c.jsx(yt, { onClick: ut, children: /* @__PURE__ */ c.jsx(et, { i18nKey: "datapointImport.downloadSample", children: "Download template csv file" }) }),
847
- /* @__PURE__ */ c.jsx("label", { className: "csv-upload-info", children: /* @__PURE__ */ c.jsx(jt, { content: /* @__PURE__ */ c.jsx(Vt, {}), children: /* @__PURE__ */ c.jsx("span", { className: "upload-anchor", children: " ?" }) }) })
848
- ] }),
849
- /* @__PURE__ */ c.jsx("div", { className: "datapoint-import-section", children: /* @__PURE__ */ c.jsx(
850
- Wt,
851
- {
852
- onRowComplete: ht,
853
- data: x,
854
- isLoading: N,
855
- createDatapoint: g,
856
- pageSize: a,
857
- onPageSizeChange: $
858
- }
859
- ) })
860
- ] });
861
- }
862
- export {
863
- ue as default
864
- };