@firecms/data_import_export 3.0.0-canary.41 → 3.0.0-canary.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +113 -21
- package/dist/components/DataNewPropertiesMapping.d.ts +3 -5
- package/dist/components/ImportFileUpload.d.ts +1 -1
- package/dist/export_import/ExportCollectionAction.d.ts +1 -1
- package/dist/index.es.js +697 -550
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/column_mapping.d.ts +5 -7
- package/dist/utils/data.d.ts +3 -10
- package/dist/utils/file_headers.d.ts +1 -0
- package/dist/utils/file_to_json.d.ts +6 -1
- package/dist/utils/get_properties_mapping.d.ts +0 -3
- package/dist/utils/index.d.ts +0 -1
- package/package.json +12 -10
- package/src/components/DataNewPropertiesMapping.tsx +153 -40
- package/src/components/ImportFileUpload.tsx +12 -4
- package/src/components/ImportNewPropertyFieldPreview.tsx +7 -2
- package/src/export_import/ExportCollectionAction.tsx +8 -1
- package/src/export_import/ImportCollectionAction.tsx +23 -20
- package/src/hooks/useImportConfig.tsx +6 -0
- package/src/types/column_mapping.ts +6 -6
- package/src/utils/data.ts +37 -126
- package/src/utils/file_headers.ts +90 -0
- package/src/utils/file_to_json.ts +24 -11
- package/src/utils/get_properties_mapping.ts +63 -59
- package/src/utils/index.ts +0 -1
package/dist/index.es.js
CHANGED
@@ -1,281 +1,421 @@
|
|
1
|
-
import
|
2
|
-
import { jsxs as
|
3
|
-
import { getPropertyInPath as
|
4
|
-
import { Table as
|
5
|
-
import { buildEntityPropertiesFromData as
|
6
|
-
import * as
|
7
|
-
|
8
|
-
|
1
|
+
import w, { useState as C, useRef as Re, useEffect as ye, useCallback as D, useMemo as Be } from "react";
|
2
|
+
import { jsxs as p, Fragment as $, jsx as i } from "react/jsx-runtime";
|
3
|
+
import { getPropertyInPath as B, mergeDeep as Je, resolveProperty as He, isPropertyBuilder as le, EntityReference as Ve, useSnackbarController as ve, useCustomizationController as G, getFieldConfig as we, ErrorBoundary as Ue, PropertyConfigBadge as Ce, useDataSource as De, resolveCollection as Oe, getPropertiesWithPropertiesOrder as ze, useSelectionController as We, EntityCollectionTable as Xe, slugify as Ge, getArrayValuesCount as Ye, getValueInPath as qe, useFireCMSContext as Qe, useNavigationController as Ze } from "@firecms/core";
|
4
|
+
import { Table as ce, TableHeader as de, TableCell as y, TableBody as pe, TableRow as ue, Typography as m, ChevronRightIcon as fe, ExpandablePanel as Ke, Select as Se, SelectItem as J, TextField as ee, BooleanSwitchWithLabel as Ne, DateTimeField as et, FileUpload as tt, UploadIcon as rt, IconButton as ne, EditIcon as nt, CenteredView as me, Button as _, CircularProgress as _e, Tooltip as ae, FileUploadIcon as at, Dialog as Ie, DialogContent as Ae, DialogActions as Te, cn as R, defaultBorderMixin as st, GetAppIcon as it, Alert as ot, focusedMixin as z } from "@firecms/ui";
|
5
|
+
import { inferTypeFromValue as lt, buildEntityPropertiesFromData as ct } from "@firecms/schema_inference";
|
6
|
+
import * as H from "xlsx";
|
7
|
+
import { getIn as Ee, setIn as dt } from "@firecms/formex";
|
8
|
+
const pt = () => {
|
9
|
+
const [e, n] = C(!1), [a, t] = C({}), [r, s] = C(), [l, o] = C([]), [c, d] = C([]), [u, f] = C({}), [h, g] = C([]), [O, k] = C({});
|
9
10
|
return {
|
10
11
|
inUse: e,
|
11
|
-
setInUse:
|
12
|
-
idColumn:
|
13
|
-
setIdColumn:
|
14
|
-
entities:
|
12
|
+
setInUse: n,
|
13
|
+
idColumn: r,
|
14
|
+
setIdColumn: s,
|
15
|
+
entities: c,
|
15
16
|
setEntities: d,
|
16
|
-
importData:
|
17
|
-
setImportData:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
importData: l,
|
18
|
+
setImportData: o,
|
19
|
+
headingsOrder: (h ?? []).length > 0 ? h : Object.keys(u),
|
20
|
+
setHeadingsOrder: g,
|
21
|
+
headersMapping: u,
|
22
|
+
setHeadersMapping: f,
|
23
|
+
originProperties: O,
|
24
|
+
setOriginProperties: k,
|
25
|
+
defaultValues: a,
|
26
|
+
setDefaultValues: t
|
22
27
|
};
|
23
28
|
};
|
24
|
-
function
|
25
|
-
|
29
|
+
function ut(e) {
|
30
|
+
let n = 0;
|
31
|
+
const a = [], t = {};
|
32
|
+
if (e == null || e["!ref"] == null)
|
33
|
+
return [];
|
34
|
+
const r = t.range !== void 0 ? t.range : e["!ref"];
|
35
|
+
let s;
|
36
|
+
switch (t.header === 1 ? n = 1 : t.header === "A" ? n = 2 : Array.isArray(t.header) && (n = 3), typeof r) {
|
37
|
+
case "string":
|
38
|
+
s = he(r);
|
39
|
+
break;
|
40
|
+
case "number":
|
41
|
+
s = he(e["!ref"]), s.s.r = r;
|
42
|
+
break;
|
43
|
+
default:
|
44
|
+
s = r;
|
45
|
+
}
|
46
|
+
const l = H.utils.encode_row(s.s.r), o = new Array(s.e.c - s.s.c + 1);
|
47
|
+
for (let c = s.s.c; c <= s.e.c; ++c) {
|
48
|
+
o[c] = H.utils.encode_col(c);
|
49
|
+
const d = e[o[c] + l];
|
50
|
+
switch (n) {
|
51
|
+
case 1:
|
52
|
+
a.push(c);
|
53
|
+
break;
|
54
|
+
case 2:
|
55
|
+
a.push(o[c]);
|
56
|
+
break;
|
57
|
+
case 3:
|
58
|
+
a.push(t.header[c - s.s.c]);
|
59
|
+
break;
|
60
|
+
default:
|
61
|
+
if (d === void 0)
|
62
|
+
continue;
|
63
|
+
a.push(H.utils.format_cell(d));
|
64
|
+
}
|
65
|
+
}
|
66
|
+
return a;
|
67
|
+
}
|
68
|
+
function he(e) {
|
69
|
+
const n = {
|
70
|
+
s: {
|
71
|
+
c: 0,
|
72
|
+
r: 0
|
73
|
+
},
|
74
|
+
e: {
|
75
|
+
c: 0,
|
76
|
+
r: 0
|
77
|
+
}
|
78
|
+
};
|
79
|
+
let a = 0, t = 0, r = 0;
|
80
|
+
const s = e.length;
|
81
|
+
for (a = 0; t < s && !((r = e.charCodeAt(t) - 64) < 1 || r > 26); ++t)
|
82
|
+
a = 26 * a + r;
|
83
|
+
for (n.s.c = --a, a = 0; t < s && !((r = e.charCodeAt(t) - 48) < 0 || r > 9); ++t)
|
84
|
+
a = 10 * a + r;
|
85
|
+
if (n.s.r = --a, t === s || e.charCodeAt(++t) === 58)
|
86
|
+
return n.e.c = n.s.c, n.e.r = n.s.r, n;
|
87
|
+
for (a = 0; t !== s && !((r = e.charCodeAt(t) - 64) < 1 || r > 26); ++t)
|
88
|
+
a = 26 * a + r;
|
89
|
+
for (n.e.c = --a, a = 0; t !== s && !((r = e.charCodeAt(t) - 48) < 0 || r > 9); ++t)
|
90
|
+
a = 10 * a + r;
|
91
|
+
return n.e.r = --a, n;
|
92
|
+
}
|
93
|
+
function ft(e) {
|
94
|
+
return new Promise((n, a) => {
|
26
95
|
if (e.type === "application/json") {
|
27
96
|
console.debug("Converting JSON file to JSON", e.name);
|
28
97
|
const t = new FileReader();
|
29
|
-
t.onload = function(
|
98
|
+
t.onload = function(r) {
|
30
99
|
try {
|
31
|
-
const
|
32
|
-
Array.isArray(
|
33
|
-
|
34
|
-
|
100
|
+
const s = r.target?.result, l = JSON.parse(s);
|
101
|
+
if (!Array.isArray(l))
|
102
|
+
a(new Error("JSON file should contain an array of objects"));
|
103
|
+
else {
|
104
|
+
const o = l.length > 0 ? Object.keys(l[0]) : [];
|
105
|
+
n({
|
106
|
+
data: l,
|
107
|
+
propertiesOrder: o
|
108
|
+
});
|
109
|
+
}
|
110
|
+
} catch (s) {
|
111
|
+
console.error("Error parsing JSON file", s), a(s);
|
35
112
|
}
|
36
113
|
}, t.readAsText(e);
|
37
114
|
} else {
|
38
115
|
console.debug("Converting Excel file to JSON", e.name);
|
39
116
|
const t = new FileReader();
|
40
|
-
t.onload = function(
|
41
|
-
const
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
117
|
+
t.onload = function(r) {
|
118
|
+
const s = new Uint8Array(r.target?.result), l = H.read(s, {
|
119
|
+
type: "array",
|
120
|
+
codepage: 65001,
|
121
|
+
cellDates: !0
|
122
|
+
}), o = l.SheetNames[0], c = l.Sheets[o], d = H.utils.sheet_to_json(c), u = ut(c), h = d.map(mt).map(je);
|
123
|
+
n({
|
124
|
+
data: h,
|
125
|
+
propertiesOrder: u
|
126
|
+
});
|
50
127
|
}, t.readAsArrayBuffer(e);
|
51
128
|
}
|
52
129
|
});
|
53
130
|
}
|
54
|
-
function
|
55
|
-
return Object.keys(e).reduce((
|
131
|
+
function mt(e) {
|
132
|
+
return Object.keys(e).reduce((n, a) => {
|
56
133
|
try {
|
57
|
-
|
134
|
+
n[a] = JSON.parse(e[a]);
|
58
135
|
} catch {
|
59
|
-
|
136
|
+
n[a] = e[a];
|
60
137
|
}
|
61
|
-
return
|
138
|
+
return n;
|
62
139
|
}, {});
|
63
140
|
}
|
64
|
-
function
|
65
|
-
return Object.keys(e).reduce((
|
66
|
-
let t =
|
67
|
-
const
|
68
|
-
return
|
69
|
-
if (/^[\w]+\[\d+\]$/.test(
|
70
|
-
const
|
71
|
-
t[
|
141
|
+
function je(e) {
|
142
|
+
return Object.keys(e).reduce((n, a) => {
|
143
|
+
let t = n;
|
144
|
+
const r = a.split(".");
|
145
|
+
return r.forEach((s, l) => {
|
146
|
+
if (/^[\w]+\[\d+\]$/.test(s)) {
|
147
|
+
const o = s.slice(0, s.indexOf("[")), c = parseInt(s.slice(s.indexOf("[") + 1, s.indexOf("]")));
|
148
|
+
t[o] || (t[o] = []), l !== r.length - 1 ? (t[o][c] = t[o][c] || {}, t = t[o][c]) : t[o][c] = e[a];
|
72
149
|
} else
|
73
|
-
|
74
|
-
}),
|
150
|
+
l !== r.length - 1 ? (t[s] = t[s] || {}, t = t[s]) : t[s] = e[a];
|
151
|
+
}), n;
|
75
152
|
}, {});
|
76
153
|
}
|
77
|
-
function
|
78
|
-
const
|
79
|
-
|
80
|
-
const
|
81
|
-
const h = a
|
82
|
-
if (!
|
154
|
+
function ht(e, n, a, t, r, s) {
|
155
|
+
const l = Fe(e);
|
156
|
+
n && delete l[n];
|
157
|
+
const o = Object.entries(l).map(([u, f]) => {
|
158
|
+
const h = Ee(a, u) ?? u, g = B(t, h);
|
159
|
+
if (!g)
|
83
160
|
return {};
|
84
|
-
const
|
85
|
-
|
86
|
-
|
87
|
-
[h]: A
|
161
|
+
const O = te(f, g);
|
162
|
+
return {
|
163
|
+
[h]: O
|
88
164
|
};
|
89
|
-
}).reduce((
|
90
|
-
let
|
91
|
-
return typeof
|
92
|
-
id:
|
165
|
+
}).reduce((u, f) => ({ ...u, ...f }), {}), c = Je(s ?? {}, je(o));
|
166
|
+
let d = n ? e[n] : void 0;
|
167
|
+
return typeof d == "string" ? d = d.trim() : typeof d == "number" || typeof d == "boolean" ? d = d.toString() : d instanceof Date ? d = d.toISOString() : d && "toString" in d && (d = d.toString()), {
|
168
|
+
id: d,
|
93
169
|
values: c,
|
94
|
-
path:
|
170
|
+
path: r
|
95
171
|
};
|
96
172
|
}
|
97
|
-
function
|
173
|
+
function Fe(e, n = "") {
|
98
174
|
return Object.keys(e).reduce((a, t) => {
|
99
|
-
const
|
100
|
-
return typeof e[t] == "object" && e[t] !== null && !Array.isArray(e[t]) ? Object.assign(a,
|
175
|
+
const r = n ? `${n}.${t}` : t;
|
176
|
+
return typeof e[t] == "object" && !(e[t] instanceof Date) && e[t] !== null && !Array.isArray(e[t]) ? Object.assign(a, Fe(e[t], r)) : a[r] = e[t], a;
|
101
177
|
}, {});
|
102
178
|
}
|
103
|
-
function
|
104
|
-
if (
|
179
|
+
function te(e, n) {
|
180
|
+
if (e === null)
|
181
|
+
return null;
|
182
|
+
if (n === void 0)
|
105
183
|
return e;
|
106
|
-
const {
|
107
|
-
|
108
|
-
|
109
|
-
}
|
110
|
-
if (a ===
|
111
|
-
return e
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
if (
|
184
|
+
const a = He({
|
185
|
+
propertyOrBuilder: n,
|
186
|
+
propertyValue: e
|
187
|
+
});
|
188
|
+
if (a === null)
|
189
|
+
return e;
|
190
|
+
const t = lt(e), r = a.dataType;
|
191
|
+
if (t === "array" && r === "array" && Array.isArray(e) && a.of && !le(a.of))
|
192
|
+
return e.map((s) => te(s, a.of));
|
193
|
+
if (t === "string" && r === "number" && typeof e == "string")
|
116
194
|
return Number(e);
|
117
|
-
if (
|
118
|
-
return e.split(",").map((
|
119
|
-
|
120
|
-
to: r.toSubtype
|
121
|
-
}));
|
122
|
-
if (a === "string" && t === "boolean")
|
195
|
+
if (t === "string" && r === "array" && typeof e == "string" && a.of && !le(a.of))
|
196
|
+
return e.split(",").map((s) => te(s, a.of));
|
197
|
+
if (t === "string" && r === "boolean")
|
123
198
|
return e === "true";
|
124
|
-
if (
|
199
|
+
if (t === "number" && r === "boolean")
|
125
200
|
return e === 1;
|
126
|
-
if (
|
201
|
+
if (t === "boolean" && r === "number")
|
127
202
|
return e ? 1 : 0;
|
128
|
-
if (
|
203
|
+
if (t === "boolean" && r === "string")
|
129
204
|
return e ? "true" : "false";
|
130
|
-
if (
|
205
|
+
if (t === "number" && r === "string" && typeof e == "number")
|
131
206
|
return e.toString();
|
132
|
-
if (
|
133
|
-
return e.split(",").map((
|
134
|
-
if (
|
207
|
+
if (t === "string" && r === "array" && typeof e == "string")
|
208
|
+
return e.split(",").map((s) => s.trim());
|
209
|
+
if (t === "string" && r === "date" && typeof e == "string")
|
135
210
|
try {
|
136
211
|
return new Date(e);
|
137
212
|
} catch {
|
138
213
|
return e;
|
139
214
|
}
|
140
215
|
else {
|
141
|
-
if (
|
216
|
+
if (t === "date" && r === "string")
|
142
217
|
return e instanceof Date && e.toISOString();
|
143
|
-
if (
|
218
|
+
if (t === "number" && r === "date" && typeof e == "number")
|
144
219
|
try {
|
145
220
|
return new Date(e);
|
146
221
|
} catch {
|
147
222
|
return e;
|
148
223
|
}
|
149
|
-
else if (
|
150
|
-
const
|
151
|
-
return new
|
224
|
+
else if (t === "string" && r === "reference" && typeof e == "string") {
|
225
|
+
const s = e.split("/").slice(0, -1).join("/"), l = e.split("/").slice(-1)[0];
|
226
|
+
return new Ve(l, s);
|
152
227
|
} else {
|
153
|
-
if (
|
228
|
+
if (t === r)
|
154
229
|
return e;
|
155
|
-
if (
|
230
|
+
if (t === "array" && r === "string" && Array.isArray(e))
|
156
231
|
return e.join(",");
|
157
232
|
}
|
158
233
|
}
|
159
234
|
return e;
|
160
235
|
}
|
161
|
-
function
|
236
|
+
function gt(e) {
|
162
237
|
return typeof e == "number" ? "number" : typeof e == "string" ? "string" : typeof e == "boolean" ? "boolean" : e instanceof Date ? "date" : Array.isArray(e) ? "array" : "map";
|
163
238
|
}
|
164
|
-
function
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
const d = n ? `${n}.${s}` : s, c = _(t, s), l = _(e, d);
|
169
|
-
if (c) {
|
170
|
-
if (c.dataType === "map" && c.properties) {
|
171
|
-
const p = a(c.properties, d);
|
172
|
-
Object.keys(p).forEach((m) => {
|
173
|
-
i[`${d}.${m}`] = p[m];
|
174
|
-
});
|
175
|
-
return;
|
176
|
-
}
|
177
|
-
if (l) {
|
178
|
-
const p = l.dataType, m = c.dataType;
|
179
|
-
let h, g;
|
180
|
-
c.dataType === "array" && c.of && (g = c.of.dataType), l?.dataType === "array" && l?.of && (h = l.of.dataType), (p !== m || h !== g) && (i[s] = {
|
181
|
-
from: p,
|
182
|
-
to: m,
|
183
|
-
fromSubtype: h,
|
184
|
-
toSubtype: g
|
185
|
-
});
|
186
|
-
}
|
187
|
-
}
|
188
|
-
}), i;
|
189
|
-
}
|
190
|
-
return a(r);
|
191
|
-
}
|
192
|
-
function ot({
|
193
|
-
idColumn: e,
|
194
|
-
headersMapping: r,
|
195
|
-
originProperties: a,
|
196
|
-
destinationProperties: t,
|
197
|
-
onIdPropertyChanged: n,
|
198
|
-
buildPropertyView: i
|
239
|
+
function bt({
|
240
|
+
importConfig: e,
|
241
|
+
destinationProperties: n,
|
242
|
+
buildPropertyView: a
|
199
243
|
}) {
|
200
|
-
|
201
|
-
|
202
|
-
|
244
|
+
const t = e.headersMapping, r = e.headingsOrder, s = e.idColumn, l = e.originProperties;
|
245
|
+
return /* @__PURE__ */ p($, { children: [
|
246
|
+
/* @__PURE__ */ i(
|
247
|
+
xt,
|
203
248
|
{
|
204
|
-
idColumn:
|
205
|
-
headersMapping:
|
206
|
-
onChange:
|
249
|
+
idColumn: s,
|
250
|
+
headersMapping: t,
|
251
|
+
onChange: (o) => e.setIdColumn(o ?? void 0)
|
207
252
|
}
|
208
253
|
),
|
209
|
-
/* @__PURE__ */
|
254
|
+
/* @__PURE__ */ i("div", { className: "h-4" }),
|
255
|
+
/* @__PURE__ */ p(ce, { style: {
|
210
256
|
tableLayout: "fixed"
|
211
257
|
}, children: [
|
212
|
-
/* @__PURE__ */
|
213
|
-
/* @__PURE__ */
|
214
|
-
/* @__PURE__ */
|
215
|
-
/* @__PURE__ */
|
258
|
+
/* @__PURE__ */ p(de, { children: [
|
259
|
+
/* @__PURE__ */ i(y, { header: !0, style: { width: "20%" }, children: "Column in file" }),
|
260
|
+
/* @__PURE__ */ i(y, { header: !0 }),
|
261
|
+
/* @__PURE__ */ i(y, { header: !0, style: { width: "75%" }, children: "Map to Property" })
|
216
262
|
] }),
|
217
|
-
/* @__PURE__ */
|
218
|
-
(
|
219
|
-
const c =
|
220
|
-
return /* @__PURE__ */
|
221
|
-
/* @__PURE__ */
|
222
|
-
/* @__PURE__ */
|
223
|
-
|
224
|
-
|
263
|
+
/* @__PURE__ */ i(pe, { children: n && r.map(
|
264
|
+
(o) => {
|
265
|
+
const c = t[o], d = t[o], u = c ? B(n, c) : null, f = B(l, o), h = f ? f.dataType === "array" && typeof f.of == "object" ? `${f.dataType} - ${f.of.dataType}` : f.dataType : void 0;
|
266
|
+
return /* @__PURE__ */ p(ue, { style: { height: "90px" }, children: [
|
267
|
+
/* @__PURE__ */ p(y, { style: { width: "20%" }, children: [
|
268
|
+
/* @__PURE__ */ i(m, { variant: "body2", children: o }),
|
269
|
+
f && /* @__PURE__ */ i(
|
270
|
+
m,
|
225
271
|
{
|
226
272
|
variant: "caption",
|
227
273
|
color: "secondary",
|
228
|
-
children:
|
274
|
+
children: h
|
229
275
|
}
|
230
276
|
)
|
231
277
|
] }),
|
232
|
-
/* @__PURE__ */
|
233
|
-
/* @__PURE__ */
|
234
|
-
|
278
|
+
/* @__PURE__ */ i(y, { children: /* @__PURE__ */ i(fe, {}) }),
|
279
|
+
/* @__PURE__ */ i(
|
280
|
+
y,
|
235
281
|
{
|
236
|
-
className:
|
282
|
+
className: o === s ? "text-center" : void 0,
|
237
283
|
style: { width: "75%" },
|
238
|
-
children:
|
239
|
-
isIdColumn:
|
240
|
-
property:
|
241
|
-
propertyKey:
|
242
|
-
importKey:
|
284
|
+
children: a?.({
|
285
|
+
isIdColumn: o === s,
|
286
|
+
property: u,
|
287
|
+
propertyKey: d,
|
288
|
+
importKey: o
|
243
289
|
})
|
244
290
|
}
|
245
291
|
)
|
246
|
-
] },
|
292
|
+
] }, o);
|
247
293
|
}
|
248
294
|
) })
|
295
|
+
] }),
|
296
|
+
/* @__PURE__ */ p(Ke, { title: "Default values", initiallyExpanded: !1, className: "p-4 mt-4", children: [
|
297
|
+
/* @__PURE__ */ i("div", { className: "text-sm text-slate-500 dark:text-slate-300 font-medium ml-3.5 mb-1", children: "You can select a default value for unmapped columns and empty values:" }),
|
298
|
+
/* @__PURE__ */ p(ce, { style: {
|
299
|
+
tableLayout: "fixed"
|
300
|
+
}, children: [
|
301
|
+
/* @__PURE__ */ p(de, { children: [
|
302
|
+
/* @__PURE__ */ i(y, { header: !0, style: { width: "30%" }, children: "Property" }),
|
303
|
+
/* @__PURE__ */ i(y, { header: !0 }),
|
304
|
+
/* @__PURE__ */ i(y, { header: !0, style: { width: "65%" }, children: "Default value" })
|
305
|
+
] }),
|
306
|
+
/* @__PURE__ */ i(pe, { children: n && ke(n).map(
|
307
|
+
(o) => {
|
308
|
+
const c = B(n, o);
|
309
|
+
return typeof c != "object" || c === null || !["number", "string", "boolean", "map"].includes(c.dataType) ? null : /* @__PURE__ */ p(ue, { style: { height: "70px" }, children: [
|
310
|
+
/* @__PURE__ */ i(y, { style: { width: "20%" }, children: /* @__PURE__ */ i(m, { variant: "body2", children: o }) }),
|
311
|
+
/* @__PURE__ */ i(y, { children: /* @__PURE__ */ i(fe, {}) }),
|
312
|
+
/* @__PURE__ */ i(
|
313
|
+
y,
|
314
|
+
{
|
315
|
+
className: o === s ? "text-center" : void 0,
|
316
|
+
style: { width: "75%" },
|
317
|
+
children: /* @__PURE__ */ i(
|
318
|
+
yt,
|
319
|
+
{
|
320
|
+
property: c,
|
321
|
+
defaultValue: Ee(e.defaultValues, o),
|
322
|
+
onValueChange: (d) => {
|
323
|
+
const u = dt(e.defaultValues, o, d);
|
324
|
+
e.setDefaultValues(u);
|
325
|
+
}
|
326
|
+
}
|
327
|
+
)
|
328
|
+
}
|
329
|
+
)
|
330
|
+
] }, o);
|
331
|
+
}
|
332
|
+
) })
|
333
|
+
] })
|
249
334
|
] })
|
250
335
|
] });
|
251
336
|
}
|
252
|
-
function
|
337
|
+
function ke(e, n) {
|
338
|
+
return Object.entries(e).reduce((a, [t, r]) => {
|
339
|
+
const s = n ? `${n}.${t}` : t;
|
340
|
+
if (typeof r != "function" && r.dataType === "map" && r.properties) {
|
341
|
+
const l = ke(r.properties, s);
|
342
|
+
return [...a, ...l];
|
343
|
+
}
|
344
|
+
return [...a, s];
|
345
|
+
}, []);
|
346
|
+
}
|
347
|
+
function xt({
|
253
348
|
idColumn: e,
|
254
|
-
headersMapping:
|
349
|
+
headersMapping: n,
|
255
350
|
onChange: a
|
256
351
|
}) {
|
257
|
-
return /* @__PURE__ */
|
258
|
-
|
352
|
+
return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ p(
|
353
|
+
Se,
|
259
354
|
{
|
260
355
|
size: "small",
|
261
356
|
value: e ?? "",
|
262
357
|
onChange: (t) => {
|
263
|
-
const
|
264
|
-
a(
|
358
|
+
const r = t.target.value;
|
359
|
+
a(r === "__none__" ? null : r);
|
265
360
|
},
|
266
|
-
|
361
|
+
placeholder: "Autogenerate ID",
|
362
|
+
renderValue: (t) => /* @__PURE__ */ i(m, { variant: "body2", children: t !== "__none__" ? t : "Autogenerate ID" }),
|
267
363
|
label: "Column that will be used as ID for each document",
|
268
364
|
children: [
|
269
|
-
/* @__PURE__ */
|
270
|
-
Object.entries(
|
365
|
+
/* @__PURE__ */ i(J, { value: "__none__", children: "Autogenerate ID" }),
|
366
|
+
Object.entries(n).map(([t, r]) => /* @__PURE__ */ i(J, { value: t, children: t }, t))
|
271
367
|
]
|
272
368
|
}
|
273
369
|
) });
|
274
370
|
}
|
275
|
-
function
|
276
|
-
|
277
|
-
|
278
|
-
|
371
|
+
function yt({
|
372
|
+
property: e,
|
373
|
+
onValueChange: n,
|
374
|
+
defaultValue: a
|
375
|
+
}) {
|
376
|
+
return e.dataType === "string" ? /* @__PURE__ */ i(
|
377
|
+
ee,
|
378
|
+
{
|
379
|
+
size: "small",
|
380
|
+
placeholder: "Default value",
|
381
|
+
value: a ?? "",
|
382
|
+
onChange: (t) => n(t.target.value)
|
383
|
+
}
|
384
|
+
) : e.dataType === "number" ? /* @__PURE__ */ i(
|
385
|
+
ee,
|
386
|
+
{
|
387
|
+
size: "small",
|
388
|
+
type: "number",
|
389
|
+
value: a ?? "",
|
390
|
+
placeholder: "Default value",
|
391
|
+
onChange: (t) => n(t.target.value)
|
392
|
+
}
|
393
|
+
) : e.dataType === "boolean" ? /* @__PURE__ */ i(
|
394
|
+
Ne,
|
395
|
+
{
|
396
|
+
value: a ?? null,
|
397
|
+
allowIndeterminate: !0,
|
398
|
+
size: "small",
|
399
|
+
onValueChange: (t) => n(t === null ? void 0 : t),
|
400
|
+
label: a === void 0 ? "Do not set value" : a === !0 ? "Set value to true" : "Set value to false"
|
401
|
+
}
|
402
|
+
) : e.dataType === "date" ? /* @__PURE__ */ i(
|
403
|
+
et,
|
404
|
+
{
|
405
|
+
mode: e.mode ?? "date",
|
406
|
+
size: "small",
|
407
|
+
value: a ?? void 0,
|
408
|
+
onChange: (t) => {
|
409
|
+
n(t);
|
410
|
+
},
|
411
|
+
clearable: !0
|
412
|
+
}
|
413
|
+
) : null;
|
414
|
+
}
|
415
|
+
function vt({ onDataAdded: e }) {
|
416
|
+
const n = ve();
|
417
|
+
return /* @__PURE__ */ i(
|
418
|
+
tt,
|
279
419
|
{
|
280
420
|
accept: {
|
281
421
|
"text/*": [".csv", ".xls", ".xlsx"],
|
@@ -290,208 +430,212 @@ function lt({ onDataAdded: e }) {
|
|
290
430
|
preventDropOnDocument: !0,
|
291
431
|
size: "small",
|
292
432
|
maxFiles: 1,
|
293
|
-
uploadDescription: /* @__PURE__ */
|
294
|
-
/* @__PURE__ */
|
433
|
+
uploadDescription: /* @__PURE__ */ p($, { children: [
|
434
|
+
/* @__PURE__ */ i(rt, {}),
|
295
435
|
"Drag and drop a file here or click to upload"
|
296
436
|
] }),
|
297
437
|
onFilesAdded: (a) => {
|
298
|
-
a.length > 0 &&
|
299
|
-
|
438
|
+
a.length > 0 && ft(a[0]).then(({
|
439
|
+
data: t,
|
440
|
+
propertiesOrder: r
|
441
|
+
}) => {
|
442
|
+
e(t, r);
|
300
443
|
}).catch((t) => {
|
301
|
-
console.error("Error parsing file", t),
|
444
|
+
console.error("Error parsing file", t), n.open({
|
445
|
+
type: "error",
|
446
|
+
message: t.message
|
447
|
+
});
|
302
448
|
});
|
303
449
|
}
|
304
450
|
}
|
305
451
|
);
|
306
452
|
}
|
307
|
-
function
|
453
|
+
function $t({
|
308
454
|
propertyKey: e,
|
309
|
-
property:
|
455
|
+
property: n,
|
310
456
|
onEditClick: a,
|
311
457
|
includeName: t = !0,
|
312
|
-
onPropertyNameChanged:
|
313
|
-
propertyTypeView:
|
458
|
+
onPropertyNameChanged: r,
|
459
|
+
propertyTypeView: s
|
314
460
|
}) {
|
315
|
-
const { propertyConfigs:
|
316
|
-
return /* @__PURE__ */
|
461
|
+
const { propertyConfigs: l } = G(), o = n ? we(n, l) : null;
|
462
|
+
return /* @__PURE__ */ i(Ue, { children: /* @__PURE__ */ p(
|
317
463
|
"div",
|
318
464
|
{
|
319
465
|
className: "flex flex-row w-full items-center",
|
320
466
|
children: [
|
321
|
-
/* @__PURE__ */
|
322
|
-
/* @__PURE__ */
|
323
|
-
t && /* @__PURE__ */
|
324
|
-
|
467
|
+
/* @__PURE__ */ i("div", { className: "mx-4", children: s ?? /* @__PURE__ */ i(Ce, { propertyConfig: o ?? void 0 }) }),
|
468
|
+
/* @__PURE__ */ i("div", { className: "w-full flex flex-col grow", children: /* @__PURE__ */ p("div", { className: "flex flex-row items-center gap-2", children: [
|
469
|
+
t && /* @__PURE__ */ i(
|
470
|
+
ee,
|
325
471
|
{
|
326
472
|
size: "small",
|
327
473
|
className: "text-base grow",
|
328
|
-
value:
|
474
|
+
value: n?.name ?? "",
|
329
475
|
onChange: (c) => {
|
330
|
-
|
476
|
+
r && e && r(e, c.target.value);
|
331
477
|
}
|
332
478
|
}
|
333
479
|
),
|
334
|
-
/* @__PURE__ */
|
480
|
+
/* @__PURE__ */ i(ne, { onClick: a, size: "small", children: /* @__PURE__ */ i(nt, { size: "small" }) })
|
335
481
|
] }) })
|
336
482
|
]
|
337
483
|
}
|
338
484
|
) });
|
339
485
|
}
|
340
|
-
function
|
486
|
+
function wt({
|
341
487
|
path: e,
|
342
|
-
importConfig:
|
488
|
+
importConfig: n,
|
343
489
|
collection: a,
|
344
490
|
onImportSuccess: t
|
345
491
|
}) {
|
346
|
-
const [
|
347
|
-
function
|
348
|
-
|
349
|
-
|
492
|
+
const [r, s] = C(void 0), l = De(), o = Re(!1), [c, d] = C(0);
|
493
|
+
function u() {
|
494
|
+
o.current || (o.current = !0, Pe(
|
495
|
+
l,
|
350
496
|
a,
|
351
497
|
e,
|
352
|
-
|
498
|
+
n.entities,
|
353
499
|
0,
|
354
500
|
25,
|
355
|
-
|
501
|
+
d
|
356
502
|
).then(() => {
|
357
|
-
t(a),
|
358
|
-
}).catch((
|
359
|
-
|
503
|
+
t(a), o.current = !1;
|
504
|
+
}).catch((f) => {
|
505
|
+
s(f), o.current = !1;
|
360
506
|
}));
|
361
507
|
}
|
362
|
-
return
|
363
|
-
|
364
|
-
}, []),
|
365
|
-
/* @__PURE__ */
|
366
|
-
/* @__PURE__ */
|
367
|
-
/* @__PURE__ */
|
368
|
-
|
508
|
+
return ye(() => {
|
509
|
+
u();
|
510
|
+
}, []), r ? /* @__PURE__ */ p(me, { className: "flex flex-col gap-4 items-center", children: [
|
511
|
+
/* @__PURE__ */ i(m, { variant: "h6", children: "Error saving data" }),
|
512
|
+
/* @__PURE__ */ i(m, { variant: "body2", color: "error", children: r.message }),
|
513
|
+
/* @__PURE__ */ i(
|
514
|
+
_,
|
369
515
|
{
|
370
|
-
onClick:
|
516
|
+
onClick: u,
|
371
517
|
variant: "outlined",
|
372
518
|
children: "Retry"
|
373
519
|
}
|
374
520
|
)
|
375
|
-
] }) : /* @__PURE__ */
|
376
|
-
/* @__PURE__ */
|
377
|
-
/* @__PURE__ */
|
378
|
-
/* @__PURE__ */
|
521
|
+
] }) : /* @__PURE__ */ p(me, { className: "flex flex-col gap-4 items-center", children: [
|
522
|
+
/* @__PURE__ */ i(_e, {}),
|
523
|
+
/* @__PURE__ */ i(m, { variant: "h6", children: "Saving data" }),
|
524
|
+
/* @__PURE__ */ p(m, { variant: "body2", children: [
|
379
525
|
c,
|
380
526
|
"/",
|
381
|
-
|
527
|
+
n.entities.length,
|
382
528
|
" entities saved"
|
383
529
|
] }),
|
384
|
-
/* @__PURE__ */
|
530
|
+
/* @__PURE__ */ i(m, { variant: "caption", children: "Do not close this tab or the import will be interrupted." })
|
385
531
|
] });
|
386
532
|
}
|
387
|
-
function
|
388
|
-
console.debug("Saving imported data",
|
389
|
-
const
|
390
|
-
return Promise.all(
|
533
|
+
function Pe(e, n, a, t, r = 0, s = 25, l) {
|
534
|
+
console.debug("Saving imported data", r, s);
|
535
|
+
const o = t.slice(r, r + s);
|
536
|
+
return Promise.all(o.map((c) => e.saveEntity({
|
391
537
|
path: a,
|
392
538
|
values: c.values,
|
393
539
|
entityId: c.id,
|
394
|
-
collection:
|
540
|
+
collection: n,
|
395
541
|
status: "new"
|
396
|
-
}))).then(() =>
|
542
|
+
}))).then(() => r + s < t.length ? (l(r + s), Pe(e, n, a, t, r + s, s, l)) : (l(t.length), Promise.resolve()));
|
397
543
|
}
|
398
|
-
function
|
544
|
+
function Ct({
|
399
545
|
collection: e,
|
400
|
-
path:
|
546
|
+
path: n,
|
401
547
|
collectionEntitiesCount: a,
|
402
548
|
onAnalyticsEvent: t
|
403
549
|
}) {
|
404
|
-
const
|
405
|
-
|
406
|
-
}, [
|
407
|
-
|
408
|
-
}, [
|
409
|
-
|
410
|
-
}, []),
|
411
|
-
|
412
|
-
}, []),
|
413
|
-
if (
|
414
|
-
const T = await
|
415
|
-
|
416
|
-
const
|
417
|
-
|
418
|
-
const
|
419
|
-
(
|
550
|
+
const r = G(), s = ve(), [l, o] = w.useState(!1), [c, d] = w.useState("initial"), u = pt(), f = D(() => {
|
551
|
+
o(!0), t?.("import_open"), d("initial");
|
552
|
+
}, [t]), h = D(() => {
|
553
|
+
o(!1);
|
554
|
+
}, [o]), g = D(() => {
|
555
|
+
t?.("import_mapping_complete"), d("preview");
|
556
|
+
}, [t]), O = D(() => {
|
557
|
+
t?.("import_data_save"), d("import_data_saving");
|
558
|
+
}, [t]), k = async (b) => {
|
559
|
+
if (u.setImportData(b), b.length > 0) {
|
560
|
+
const T = await ct(b, gt);
|
561
|
+
u.setOriginProperties(T);
|
562
|
+
const E = $e(b, e?.properties);
|
563
|
+
u.setHeadersMapping(E);
|
564
|
+
const j = Object.keys(E)?.[0];
|
565
|
+
(j?.includes("id") || j?.includes("key")) && u.setIdColumn(j);
|
420
566
|
}
|
421
567
|
setTimeout(() => {
|
422
|
-
|
568
|
+
t?.("import_data_added"), d("mapping");
|
423
569
|
}, 100);
|
424
|
-
},
|
570
|
+
}, I = Oe({
|
425
571
|
collection: e,
|
426
|
-
path:
|
427
|
-
fields:
|
428
|
-
}),
|
429
|
-
return e.collectionGroup ? null : /* @__PURE__ */
|
430
|
-
/* @__PURE__ */
|
431
|
-
/* @__PURE__ */
|
432
|
-
|
572
|
+
path: n,
|
573
|
+
fields: r.propertyConfigs
|
574
|
+
}), L = ze(I.properties, I.propertiesOrder), A = Object.entries(L).flatMap(([b, T]) => Me(b, T, 0)), V = I.propertiesOrder ?? Object.keys(I.properties);
|
575
|
+
return e.collectionGroup ? null : /* @__PURE__ */ p($, { children: [
|
576
|
+
/* @__PURE__ */ i(ae, { title: "Import", children: /* @__PURE__ */ i(ne, { color: "primary", onClick: f, children: /* @__PURE__ */ i(at, {}) }) }),
|
577
|
+
/* @__PURE__ */ p(
|
578
|
+
Ie,
|
433
579
|
{
|
434
|
-
open:
|
580
|
+
open: l,
|
435
581
|
fullWidth: c === "preview",
|
436
582
|
fullHeight: c === "preview",
|
437
583
|
maxWidth: c === "initial" ? "lg" : "7xl",
|
438
584
|
children: [
|
439
|
-
/* @__PURE__ */
|
440
|
-
c === "initial" && /* @__PURE__ */
|
441
|
-
/* @__PURE__ */
|
442
|
-
/* @__PURE__ */
|
443
|
-
/* @__PURE__ */
|
585
|
+
/* @__PURE__ */ p(Ae, { className: "flex flex-col gap-4 my-4", fullHeight: c === "preview", children: [
|
586
|
+
c === "initial" && /* @__PURE__ */ p($, { children: [
|
587
|
+
/* @__PURE__ */ i(m, { variant: "h6", children: "Import data" }),
|
588
|
+
/* @__PURE__ */ i(m, { variant: "body2", children: "Upload a CSV, Excel or JSON file and map it to your existing schema" }),
|
589
|
+
/* @__PURE__ */ i(vt, { onDataAdded: k })
|
444
590
|
] }),
|
445
|
-
c === "mapping" && /* @__PURE__ */
|
446
|
-
/* @__PURE__ */
|
447
|
-
/* @__PURE__ */
|
448
|
-
|
591
|
+
c === "mapping" && /* @__PURE__ */ p($, { children: [
|
592
|
+
/* @__PURE__ */ i(m, { variant: "h6", className: "ml-3.5", children: "Map fields" }),
|
593
|
+
/* @__PURE__ */ i(
|
594
|
+
bt,
|
449
595
|
{
|
450
|
-
|
451
|
-
|
452
|
-
originProperties: p.originProperties,
|
453
|
-
destinationProperties: x,
|
454
|
-
onIdPropertyChanged: (y) => p.setIdColumn(y ?? void 0),
|
596
|
+
importConfig: u,
|
597
|
+
destinationProperties: L,
|
455
598
|
buildPropertyView: ({
|
456
|
-
isIdColumn:
|
599
|
+
isIdColumn: b,
|
457
600
|
property: T,
|
458
|
-
propertyKey:
|
459
|
-
importKey:
|
460
|
-
}) => /* @__PURE__ */
|
461
|
-
|
601
|
+
propertyKey: E,
|
602
|
+
importKey: j
|
603
|
+
}) => /* @__PURE__ */ i(
|
604
|
+
Dt,
|
462
605
|
{
|
463
|
-
selectedPropertyKey:
|
464
|
-
properties:
|
465
|
-
propertiesAndLevel:
|
466
|
-
isIdColumn:
|
606
|
+
selectedPropertyKey: E ?? "",
|
607
|
+
properties: L,
|
608
|
+
propertiesAndLevel: A,
|
609
|
+
isIdColumn: b,
|
467
610
|
onIdSelected: () => {
|
468
|
-
|
611
|
+
u.setIdColumn(j);
|
469
612
|
},
|
470
|
-
onPropertySelected: (
|
471
|
-
|
472
|
-
|
613
|
+
onPropertySelected: (P) => {
|
614
|
+
t?.("import_mapping_field_updated");
|
615
|
+
const Y = Object.entries(u.headersMapping).map(([x, M]) => M === P ? { [x]: null } : x === j ? { [x]: P } : { [x]: M }).reduce((x, M) => ({ ...x, ...M }), {});
|
616
|
+
u.setHeadersMapping(Y), P === u.idColumn && u.setIdColumn(void 0);
|
473
617
|
}
|
474
618
|
}
|
475
619
|
)
|
476
620
|
}
|
477
621
|
)
|
478
622
|
] }),
|
479
|
-
c === "preview" && /* @__PURE__ */
|
480
|
-
|
623
|
+
c === "preview" && /* @__PURE__ */ i(
|
624
|
+
Ot,
|
481
625
|
{
|
482
|
-
importConfig:
|
483
|
-
properties:
|
484
|
-
propertiesOrder:
|
626
|
+
importConfig: u,
|
627
|
+
properties: L,
|
628
|
+
propertiesOrder: V
|
485
629
|
}
|
486
630
|
),
|
487
|
-
c === "import_data_saving" &&
|
488
|
-
|
631
|
+
c === "import_data_saving" && u && /* @__PURE__ */ i(
|
632
|
+
wt,
|
489
633
|
{
|
490
|
-
importConfig:
|
634
|
+
importConfig: u,
|
491
635
|
collection: e,
|
492
|
-
path:
|
493
|
-
onImportSuccess: (
|
494
|
-
h(),
|
636
|
+
path: n,
|
637
|
+
onImportSuccess: (b) => {
|
638
|
+
h(), s.open({
|
495
639
|
type: "info",
|
496
640
|
message: "Data imported successfully"
|
497
641
|
});
|
@@ -499,44 +643,44 @@ function dt({
|
|
499
643
|
}
|
500
644
|
)
|
501
645
|
] }),
|
502
|
-
/* @__PURE__ */
|
503
|
-
c === "mapping" && /* @__PURE__ */
|
504
|
-
|
646
|
+
/* @__PURE__ */ p(Te, { children: [
|
647
|
+
c === "mapping" && /* @__PURE__ */ i(
|
648
|
+
_,
|
505
649
|
{
|
506
|
-
onClick: () =>
|
650
|
+
onClick: () => d("initial"),
|
507
651
|
variant: "text",
|
508
652
|
children: "Back"
|
509
653
|
}
|
510
654
|
),
|
511
|
-
c === "preview" && /* @__PURE__ */
|
512
|
-
|
655
|
+
c === "preview" && /* @__PURE__ */ i(
|
656
|
+
_,
|
513
657
|
{
|
514
|
-
onClick: () =>
|
658
|
+
onClick: () => d("mapping"),
|
515
659
|
variant: "text",
|
516
660
|
children: "Back"
|
517
661
|
}
|
518
662
|
),
|
519
|
-
/* @__PURE__ */
|
520
|
-
|
663
|
+
/* @__PURE__ */ i(
|
664
|
+
_,
|
521
665
|
{
|
522
666
|
onClick: h,
|
523
667
|
variant: "text",
|
524
668
|
children: "Cancel"
|
525
669
|
}
|
526
670
|
),
|
527
|
-
c === "mapping" && /* @__PURE__ */
|
528
|
-
|
671
|
+
c === "mapping" && /* @__PURE__ */ i(
|
672
|
+
_,
|
529
673
|
{
|
530
674
|
variant: "filled",
|
531
675
|
onClick: g,
|
532
676
|
children: "Next"
|
533
677
|
}
|
534
678
|
),
|
535
|
-
c === "preview" && /* @__PURE__ */
|
536
|
-
|
679
|
+
c === "preview" && /* @__PURE__ */ i(
|
680
|
+
_,
|
537
681
|
{
|
538
682
|
variant: "filled",
|
539
|
-
onClick:
|
683
|
+
onClick: O,
|
540
684
|
children: "Save data"
|
541
685
|
}
|
542
686
|
)
|
@@ -546,92 +690,92 @@ function dt({
|
|
546
690
|
)
|
547
691
|
] });
|
548
692
|
}
|
549
|
-
const
|
550
|
-
function
|
693
|
+
const W = "__internal_id__";
|
694
|
+
function Dt({
|
551
695
|
selectedPropertyKey: e,
|
552
|
-
properties:
|
696
|
+
properties: n,
|
553
697
|
onPropertySelected: a,
|
554
698
|
onIdSelected: t,
|
555
|
-
propertiesAndLevel:
|
556
|
-
isIdColumn:
|
699
|
+
propertiesAndLevel: r,
|
700
|
+
isIdColumn: s
|
557
701
|
}) {
|
558
|
-
const
|
559
|
-
|
702
|
+
const l = e ? B(n, e) : null, o = D((d) => d === W ? /* @__PURE__ */ i(m, { variant: "body2", className: "p-4", children: "Use this column as ID" }) : !d || !l ? /* @__PURE__ */ i(m, { variant: "body2", color: "disabled", className: "p-4", children: "Do not import this property" }) : /* @__PURE__ */ i(
|
703
|
+
ge,
|
560
704
|
{
|
561
|
-
propertyKey:
|
562
|
-
property:
|
705
|
+
propertyKey: d,
|
706
|
+
property: l
|
563
707
|
}
|
564
|
-
), [
|
565
|
-
|
566
|
-
|
567
|
-
return /* @__PURE__ */ f(
|
568
|
-
ge,
|
708
|
+
), [l]);
|
709
|
+
return /* @__PURE__ */ p(
|
710
|
+
Se,
|
569
711
|
{
|
570
|
-
value:
|
571
|
-
onValueChange:
|
572
|
-
|
712
|
+
value: s ? W : e ?? void 0,
|
713
|
+
onValueChange: (d) => {
|
714
|
+
d === W ? (t(), a(null)) : a(d === "__do_not_import" ? null : d);
|
715
|
+
},
|
716
|
+
renderValue: o,
|
573
717
|
children: [
|
574
|
-
/* @__PURE__ */
|
575
|
-
/* @__PURE__ */
|
576
|
-
|
577
|
-
property:
|
578
|
-
level:
|
579
|
-
propertyKey:
|
580
|
-
}) => /* @__PURE__ */
|
581
|
-
|
718
|
+
/* @__PURE__ */ i(J, { value: "__do_not_import", children: /* @__PURE__ */ i(m, { variant: "body2", color: "disabled", className: "p-4", children: "Do not import this property" }) }),
|
719
|
+
/* @__PURE__ */ i(J, { value: W, children: /* @__PURE__ */ i(m, { variant: "body2", className: "p-4", children: "Use this column as ID" }) }),
|
720
|
+
r.map(({
|
721
|
+
property: d,
|
722
|
+
level: u,
|
723
|
+
propertyKey: f
|
724
|
+
}) => /* @__PURE__ */ i(
|
725
|
+
J,
|
582
726
|
{
|
583
|
-
value:
|
584
|
-
disabled:
|
585
|
-
children: /* @__PURE__ */
|
586
|
-
|
727
|
+
value: f,
|
728
|
+
disabled: d.dataType === "map",
|
729
|
+
children: /* @__PURE__ */ i(
|
730
|
+
ge,
|
587
731
|
{
|
588
|
-
propertyKey:
|
589
|
-
property:
|
590
|
-
level:
|
732
|
+
propertyKey: f,
|
733
|
+
property: d,
|
734
|
+
level: u
|
591
735
|
}
|
592
736
|
)
|
593
737
|
},
|
594
|
-
|
738
|
+
f
|
595
739
|
))
|
596
740
|
]
|
597
741
|
}
|
598
742
|
);
|
599
743
|
}
|
600
|
-
function
|
744
|
+
function Me(e, n, a) {
|
601
745
|
const t = [];
|
602
746
|
return t.push({
|
603
|
-
property:
|
747
|
+
property: n,
|
604
748
|
level: a,
|
605
749
|
propertyKey: e
|
606
|
-
}),
|
607
|
-
t.push(...
|
750
|
+
}), n.dataType === "map" && n.properties && Object.entries(n.properties).forEach(([r, s]) => {
|
751
|
+
t.push(...Me(`${e}.${r}`, s, a + 1));
|
608
752
|
}), t;
|
609
753
|
}
|
610
|
-
function
|
754
|
+
function ge({
|
611
755
|
propertyKey: e,
|
612
|
-
property:
|
756
|
+
property: n,
|
613
757
|
level: a = 0
|
614
758
|
}) {
|
615
|
-
const { propertyConfigs: t } =
|
616
|
-
return /* @__PURE__ */
|
759
|
+
const { propertyConfigs: t } = G(), r = we(n, t);
|
760
|
+
return /* @__PURE__ */ p(
|
617
761
|
"div",
|
618
762
|
{
|
619
763
|
className: "flex flex-row w-full text-start items-center h-full",
|
620
764
|
children: [
|
621
|
-
new Array(a).fill(0).map((
|
622
|
-
/* @__PURE__ */
|
623
|
-
/* @__PURE__ */
|
624
|
-
/* @__PURE__ */
|
625
|
-
|
765
|
+
new Array(a).fill(0).map((s, l) => /* @__PURE__ */ i("div", { className: R(st, "ml-8 border-l h-12") }, l)),
|
766
|
+
/* @__PURE__ */ i("div", { className: "m-4", children: /* @__PURE__ */ i(ae, { title: r?.name, children: /* @__PURE__ */ i(Ce, { propertyConfig: r }) }) }),
|
767
|
+
/* @__PURE__ */ p("div", { className: "flex flex-col flex-grow p-2 pl-2", children: [
|
768
|
+
/* @__PURE__ */ i(
|
769
|
+
m,
|
626
770
|
{
|
627
771
|
variant: "body1",
|
628
772
|
component: "span",
|
629
773
|
className: "flex-grow pr-2",
|
630
|
-
children:
|
774
|
+
children: n.name ? n.name : " "
|
631
775
|
}
|
632
776
|
),
|
633
|
-
/* @__PURE__ */
|
634
|
-
|
777
|
+
/* @__PURE__ */ i(
|
778
|
+
m,
|
635
779
|
{
|
636
780
|
className: " pr-2",
|
637
781
|
variant: "body2",
|
@@ -645,216 +789,220 @@ function se({
|
|
645
789
|
}
|
646
790
|
);
|
647
791
|
}
|
648
|
-
function
|
792
|
+
function Ot({
|
649
793
|
importConfig: e,
|
650
|
-
properties:
|
794
|
+
properties: n,
|
651
795
|
propertiesOrder: a
|
652
796
|
}) {
|
653
|
-
|
654
|
-
const
|
655
|
-
|
797
|
+
ye(() => {
|
798
|
+
const r = e.importData.map((s) => ht(s, e.idColumn, e.headersMapping, n, "TEMP_PATH", e.defaultValues));
|
799
|
+
console.log("Mapped data", {
|
800
|
+
importConfig: e,
|
801
|
+
mappedData: r
|
802
|
+
}), e.setEntities(r);
|
656
803
|
}, []);
|
657
|
-
const t =
|
658
|
-
return /* @__PURE__ */
|
659
|
-
|
804
|
+
const t = We();
|
805
|
+
return /* @__PURE__ */ i(
|
806
|
+
Xe,
|
660
807
|
{
|
661
|
-
title: /* @__PURE__ */
|
662
|
-
/* @__PURE__ */
|
663
|
-
/* @__PURE__ */
|
808
|
+
title: /* @__PURE__ */ p("div", { children: [
|
809
|
+
/* @__PURE__ */ i(m, { variant: "subtitle2", children: "Imported data preview" }),
|
810
|
+
/* @__PURE__ */ i(m, { variant: "caption", children: "Entities with the same id will be overwritten" })
|
664
811
|
] }),
|
665
812
|
tableController: {
|
666
813
|
data: e.entities,
|
667
814
|
dataLoading: !1,
|
668
815
|
noMoreToLoad: !1
|
669
816
|
},
|
670
|
-
endAdornment: /* @__PURE__ */
|
817
|
+
endAdornment: /* @__PURE__ */ i("div", { className: "h-12" }),
|
671
818
|
filterable: !1,
|
672
819
|
sortable: !1,
|
673
820
|
selectionController: t,
|
674
|
-
|
675
|
-
key: n,
|
676
|
-
disabled: !1
|
677
|
-
})),
|
678
|
-
properties: r
|
821
|
+
properties: n
|
679
822
|
}
|
680
823
|
);
|
681
824
|
}
|
682
|
-
function
|
825
|
+
function $e(e, n) {
|
683
826
|
const a = {};
|
684
827
|
return e.filter(Boolean).forEach((t) => {
|
685
|
-
Object.keys(t).forEach((
|
686
|
-
const
|
687
|
-
if (typeof
|
688
|
-
const
|
689
|
-
Object.entries(c).forEach(([
|
690
|
-
a[`${
|
828
|
+
Object.keys(t).forEach((r) => {
|
829
|
+
const s = t[r];
|
830
|
+
if (typeof s == "object" && !Array.isArray(s)) {
|
831
|
+
const l = n?.[r], o = l && "properties" in l ? l.properties : void 0, c = $e([s], o);
|
832
|
+
Object.entries(c).forEach(([d, u]) => {
|
833
|
+
a[`${r}.${d}`] = `${r}.${u}`;
|
691
834
|
});
|
692
835
|
}
|
693
|
-
if (!
|
694
|
-
a[
|
695
|
-
else if (
|
696
|
-
a[
|
836
|
+
if (!n)
|
837
|
+
a[r] = r;
|
838
|
+
else if (r in n)
|
839
|
+
a[r] = r;
|
697
840
|
else {
|
698
|
-
const
|
699
|
-
|
841
|
+
const l = Ge(r);
|
842
|
+
l in n ? a[r] = l : a[r] = r;
|
700
843
|
}
|
701
844
|
});
|
702
845
|
}), a;
|
703
846
|
}
|
704
|
-
function
|
705
|
-
console.debug("Downloading export", { dataLength: e.length, collection: a, exportType:
|
706
|
-
const
|
707
|
-
if (
|
708
|
-
const c = t ?
|
709
|
-
|
847
|
+
function St(e, n, a, t, r, s, l) {
|
848
|
+
console.debug("Downloading export", { dataLength: e.length, collection: a, exportType: s, dateExportType: l });
|
849
|
+
const o = a.properties;
|
850
|
+
if (s === "csv") {
|
851
|
+
const c = t ? Ye(e.map((g) => g.values)) : {}, d = It(o, r, c), u = Nt(e, n, o, d, l), f = be(d.map((g) => g.label)), h = u.map((g) => be(g));
|
852
|
+
xe([f, ...h], `${a.name}.csv`, "text/csv");
|
710
853
|
} else {
|
711
|
-
const c =
|
712
|
-
|
854
|
+
const c = _t(e, n, o, l), d = JSON.stringify(c, null, 2);
|
855
|
+
xe([d], `${a.name}.json`, "application/json");
|
713
856
|
}
|
714
857
|
}
|
715
|
-
function
|
716
|
-
const
|
717
|
-
id:
|
718
|
-
...
|
858
|
+
function Nt(e, n, a, t, r) {
|
859
|
+
const s = e.map((l) => ({
|
860
|
+
id: l.id,
|
861
|
+
...se(l.values, a, "csv", r)
|
719
862
|
}));
|
720
|
-
return
|
721
|
-
|
722
|
-
}),
|
723
|
-
}
|
724
|
-
function
|
725
|
-
const
|
726
|
-
id:
|
727
|
-
...
|
863
|
+
return n && n.forEach((l, o) => {
|
864
|
+
s[o] = { ...s[o], ...l };
|
865
|
+
}), s && s.map((l) => t.map((o) => qe(l, o.key)));
|
866
|
+
}
|
867
|
+
function _t(e, n, a, t) {
|
868
|
+
const r = e.map((s) => ({
|
869
|
+
id: s.id,
|
870
|
+
...se(s.values, a, "json", t)
|
728
871
|
}));
|
729
|
-
return
|
730
|
-
|
731
|
-
}),
|
872
|
+
return n && n.forEach((s, l) => {
|
873
|
+
r[l] = { ...r[l], ...s };
|
874
|
+
}), r;
|
732
875
|
}
|
733
|
-
function
|
876
|
+
function It(e, n, a) {
|
734
877
|
const t = [
|
735
878
|
{ label: "id", key: "id" },
|
736
|
-
...Object.entries(e).flatMap(([
|
737
|
-
{ length: a[
|
738
|
-
(
|
739
|
-
).flat() :
|
879
|
+
...Object.entries(e).flatMap(([r, s]) => a && a[r] > 1 ? Array.from(
|
880
|
+
{ length: a[r] },
|
881
|
+
(l, o) => re(s, `${r}[${o}]`, "")
|
882
|
+
).flat() : re(s, r, ""))
|
740
883
|
];
|
741
|
-
return
|
742
|
-
}
|
743
|
-
function
|
744
|
-
const t = a ? `${a}.${
|
745
|
-
return e.dataType === "map" && e.properties ? Object.entries(e.properties).map(([
|
746
|
-
}
|
747
|
-
function
|
748
|
-
let
|
749
|
-
if (
|
750
|
-
|
751
|
-
else if (
|
752
|
-
|
753
|
-
else if (
|
754
|
-
const
|
755
|
-
|
884
|
+
return n && t.push(...n.map((r) => ({ label: r, key: r }))), t;
|
885
|
+
}
|
886
|
+
function re(e, n, a = "") {
|
887
|
+
const t = a ? `${a}.${n}` : n;
|
888
|
+
return e.dataType === "map" && e.properties ? Object.entries(e.properties).map(([r, s]) => re(s, r, t)).flat() : [{ label: t, key: t }];
|
889
|
+
}
|
890
|
+
function X(e, n, a, t) {
|
891
|
+
let r;
|
892
|
+
if (n.dataType === "map" && n.properties)
|
893
|
+
r = se(e, n.properties, a, t);
|
894
|
+
else if (n.dataType === "array")
|
895
|
+
n.of && Array.isArray(e) ? Array.isArray(n.of) ? r = n.of.map((s, l) => X(e[l], s, a, t)) : n.of.dataType === "map" ? r = a === "csv" ? e.map((s) => JSON.stringify(s)) : e.map((s) => X(s, n.of, a, t)) : r = e.map((s) => X(s, n.of, a, t)) : r = e;
|
896
|
+
else if (n.dataType === "reference" && e && e.isEntityReference && e.isEntityReference()) {
|
897
|
+
const s = e || void 0;
|
898
|
+
r = s ? s.pathWithId : null;
|
756
899
|
} else
|
757
|
-
|
758
|
-
return
|
759
|
-
}
|
760
|
-
function
|
761
|
-
const
|
762
|
-
const
|
763
|
-
return c === void 0 ? {} : { [
|
764
|
-
}).reduce((
|
765
|
-
return { ...e, ...
|
766
|
-
}
|
767
|
-
function
|
768
|
-
return e.map((
|
900
|
+
n.dataType === "date" && e instanceof Date ? r = e ? t === "timestamp" ? e.getTime() : e.toISOString() : null : r = e;
|
901
|
+
return r;
|
902
|
+
}
|
903
|
+
function se(e, n, a, t) {
|
904
|
+
const r = Object.entries(n).map(([s, l]) => {
|
905
|
+
const o = e && e[s], c = X(o, l, a, t);
|
906
|
+
return c === void 0 ? {} : { [s]: c };
|
907
|
+
}).reduce((s, l) => ({ ...s, ...l }), {});
|
908
|
+
return { ...e, ...r };
|
909
|
+
}
|
910
|
+
function be(e) {
|
911
|
+
return e.map((n) => n == null ? "" : Array.isArray(n) ? '"' + JSON.stringify(n).replaceAll('"', '\\"') + '"' : '"' + String(n).replaceAll('"', '""') + '"').join(",") + `\r
|
769
912
|
`;
|
770
913
|
}
|
771
|
-
function
|
772
|
-
const t = new Blob(e, { type: a }),
|
773
|
-
|
914
|
+
function xe(e, n, a) {
|
915
|
+
const t = new Blob(e, { type: a }), r = URL.createObjectURL(t), s = document.createElement("a");
|
916
|
+
s.href = r, s.setAttribute("download", n), s.click();
|
774
917
|
}
|
775
|
-
const
|
776
|
-
function
|
918
|
+
const At = 500;
|
919
|
+
function Tt({
|
777
920
|
collection: e,
|
778
|
-
path:
|
921
|
+
path: n,
|
779
922
|
collectionEntitiesCount: a,
|
780
|
-
|
781
|
-
|
923
|
+
onAnalyticsEvent: t,
|
924
|
+
exportAllowed: r,
|
925
|
+
notAllowedView: s
|
782
926
|
}) {
|
783
|
-
const
|
927
|
+
const l = G(), o = typeof e.exportable == "object" ? e.exportable : void 0, c = w.useRef(/* @__PURE__ */ new Date()), [d, u] = w.useState(!0), [f, h] = w.useState("csv"), [g, O] = w.useState("string"), k = Qe(), I = De(), A = Ze().resolveAliasesFrom(n), V = !r || r({
|
784
928
|
collectionEntitiesCount: a,
|
785
|
-
path:
|
929
|
+
path: A,
|
786
930
|
collection: e
|
787
|
-
}),
|
931
|
+
}), b = w.useMemo(() => Oe({
|
788
932
|
collection: e,
|
789
|
-
path:
|
790
|
-
fields:
|
791
|
-
}), [e,
|
792
|
-
|
793
|
-
}, [
|
794
|
-
|
795
|
-
}, [
|
796
|
-
const
|
933
|
+
path: A,
|
934
|
+
fields: l.propertyConfigs
|
935
|
+
}), [e, A]), [T, E] = w.useState(!1), [j, P] = w.useState(), [Y, x] = w.useState(!1), M = D(() => {
|
936
|
+
x(!0);
|
937
|
+
}, [x]), q = D(() => {
|
938
|
+
x(!1);
|
939
|
+
}, [x]), ie = D(async (S) => {
|
940
|
+
const U = o?.additionalFields, N = b.additionalFields, Q = U ? await Promise.all(S.map(async (F) => (await Promise.all(U.map(async (v) => ({
|
797
941
|
[v.key]: await v.builder({
|
798
942
|
entity: F,
|
799
|
-
context:
|
943
|
+
context: k
|
800
944
|
})
|
801
|
-
})))).reduce((v,
|
945
|
+
})))).reduce((v, K) => ({ ...v, ...K }), {}))) : [], Z = N ? await Promise.all(S.map(async (F) => (await Promise.all(N.map(async (v) => v.value ? {
|
802
946
|
[v.key]: await v.value({
|
803
947
|
entity: F,
|
804
|
-
context:
|
948
|
+
context: k
|
805
949
|
})
|
806
|
-
} : {}))).reduce((v,
|
807
|
-
return [...
|
808
|
-
}, [
|
809
|
-
|
810
|
-
|
811
|
-
|
950
|
+
} : {}))).reduce((v, K) => ({ ...v, ...K }), {}))) : [];
|
951
|
+
return [...Q, ...Z];
|
952
|
+
}, [o?.additionalFields]), oe = D(async (S, U) => {
|
953
|
+
t?.("export_collection", {
|
954
|
+
collection: S.path
|
955
|
+
}), E(!0), I.fetchCollection({
|
956
|
+
path: A,
|
957
|
+
collection: S
|
812
958
|
}).then(async (N) => {
|
813
|
-
|
814
|
-
const
|
815
|
-
...
|
816
|
-
...
|
959
|
+
P(void 0);
|
960
|
+
const Q = await ie(N), Z = [
|
961
|
+
...U?.additionalFields?.map((F) => F.key) ?? [],
|
962
|
+
...S.additionalFields?.map((F) => F.key) ?? []
|
817
963
|
];
|
818
|
-
|
964
|
+
St(N, Q, S, d, Z, f, g), t?.("export_collection_success", {
|
965
|
+
collection: S.path
|
966
|
+
});
|
819
967
|
}).catch((N) => {
|
820
|
-
console.error("Error loading export data", N),
|
821
|
-
}).finally(() =>
|
822
|
-
}, [
|
823
|
-
|
824
|
-
}, [
|
825
|
-
return /* @__PURE__ */
|
826
|
-
/* @__PURE__ */
|
827
|
-
/* @__PURE__ */
|
828
|
-
|
968
|
+
console.error("Error loading export data", N), P(N);
|
969
|
+
}).finally(() => E(!1));
|
970
|
+
}, [t, I, A, ie, d, f, g]), Le = D(() => {
|
971
|
+
oe(b, o), q();
|
972
|
+
}, [oe, b, o, q]);
|
973
|
+
return /* @__PURE__ */ p($, { children: [
|
974
|
+
/* @__PURE__ */ i(ae, { title: "Export", children: /* @__PURE__ */ i(ne, { color: "primary", onClick: M, children: /* @__PURE__ */ i(it, {}) }) }),
|
975
|
+
/* @__PURE__ */ p(
|
976
|
+
Ie,
|
829
977
|
{
|
830
|
-
open:
|
831
|
-
onOpenChange:
|
978
|
+
open: Y,
|
979
|
+
onOpenChange: x,
|
832
980
|
maxWidth: "xl",
|
833
981
|
children: [
|
834
|
-
/* @__PURE__ */
|
835
|
-
/* @__PURE__ */
|
836
|
-
/* @__PURE__ */
|
837
|
-
a >
|
982
|
+
/* @__PURE__ */ p(Ae, { className: "flex flex-col gap-4 my-4", children: [
|
983
|
+
/* @__PURE__ */ i(m, { variant: "h6", children: "Export data" }),
|
984
|
+
/* @__PURE__ */ i("div", { children: "Download the the content of this table as a CSV" }),
|
985
|
+
a > At && /* @__PURE__ */ i(ot, { color: "warning", children: /* @__PURE__ */ p("div", { children: [
|
838
986
|
"This collections has a large number of documents (",
|
839
987
|
a,
|
840
988
|
")."
|
841
989
|
] }) }),
|
842
|
-
/* @__PURE__ */
|
843
|
-
/* @__PURE__ */
|
844
|
-
/* @__PURE__ */
|
845
|
-
/* @__PURE__ */
|
990
|
+
/* @__PURE__ */ p("div", { className: "flex flex-row gap-4", children: [
|
991
|
+
/* @__PURE__ */ p("div", { className: "p-4 flex flex-col", children: [
|
992
|
+
/* @__PURE__ */ p("div", { className: "flex items-center", children: [
|
993
|
+
/* @__PURE__ */ i(
|
846
994
|
"input",
|
847
995
|
{
|
848
996
|
id: "radio-csv",
|
849
997
|
type: "radio",
|
850
998
|
value: "csv",
|
851
999
|
name: "exportType",
|
852
|
-
checked:
|
853
|
-
onChange: () =>
|
854
|
-
className:
|
1000
|
+
checked: f === "csv",
|
1001
|
+
onChange: () => h("csv"),
|
1002
|
+
className: R(z, "w-4 text-primary-dark bg-gray-100 border-gray-300 dark:bg-gray-700 dark:border-gray-600")
|
855
1003
|
}
|
856
1004
|
),
|
857
|
-
/* @__PURE__ */
|
1005
|
+
/* @__PURE__ */ i(
|
858
1006
|
"label",
|
859
1007
|
{
|
860
1008
|
htmlFor: "radio-csv",
|
@@ -863,20 +1011,20 @@ function bt({
|
|
863
1011
|
}
|
864
1012
|
)
|
865
1013
|
] }),
|
866
|
-
/* @__PURE__ */
|
867
|
-
/* @__PURE__ */
|
1014
|
+
/* @__PURE__ */ p("div", { className: "flex items-center", children: [
|
1015
|
+
/* @__PURE__ */ i(
|
868
1016
|
"input",
|
869
1017
|
{
|
870
1018
|
id: "radio-json",
|
871
1019
|
type: "radio",
|
872
1020
|
value: "json",
|
873
1021
|
name: "exportType",
|
874
|
-
checked:
|
875
|
-
onChange: () =>
|
876
|
-
className:
|
1022
|
+
checked: f === "json",
|
1023
|
+
onChange: () => h("json"),
|
1024
|
+
className: R(z, "w-4 text-primary-dark bg-gray-100 border-gray-300 dark:bg-gray-700 dark:border-gray-600")
|
877
1025
|
}
|
878
1026
|
),
|
879
|
-
/* @__PURE__ */
|
1027
|
+
/* @__PURE__ */ i(
|
880
1028
|
"label",
|
881
1029
|
{
|
882
1030
|
htmlFor: "radio-json",
|
@@ -886,54 +1034,54 @@ function bt({
|
|
886
1034
|
)
|
887
1035
|
] })
|
888
1036
|
] }),
|
889
|
-
/* @__PURE__ */
|
890
|
-
/* @__PURE__ */
|
891
|
-
/* @__PURE__ */
|
1037
|
+
/* @__PURE__ */ p("div", { className: "p-4 flex flex-col", children: [
|
1038
|
+
/* @__PURE__ */ p("div", { className: "flex items-center", children: [
|
1039
|
+
/* @__PURE__ */ i(
|
892
1040
|
"input",
|
893
1041
|
{
|
894
1042
|
id: "radio-timestamp",
|
895
1043
|
type: "radio",
|
896
1044
|
value: "timestamp",
|
897
1045
|
name: "dateExportType",
|
898
|
-
checked:
|
899
|
-
onChange: () =>
|
900
|
-
className:
|
1046
|
+
checked: g === "timestamp",
|
1047
|
+
onChange: () => O("timestamp"),
|
1048
|
+
className: R(z, "w-4 text-primary-dark bg-gray-100 border-gray-300 dark:bg-gray-700 dark:border-gray-600")
|
901
1049
|
}
|
902
1050
|
),
|
903
|
-
/* @__PURE__ */
|
1051
|
+
/* @__PURE__ */ p(
|
904
1052
|
"label",
|
905
1053
|
{
|
906
1054
|
htmlFor: "radio-timestamp",
|
907
1055
|
className: "p-2 text-sm font-medium text-gray-900 dark:text-slate-300",
|
908
1056
|
children: [
|
909
1057
|
"Dates as timestamps (",
|
910
|
-
|
1058
|
+
c.current.getTime(),
|
911
1059
|
")"
|
912
1060
|
]
|
913
1061
|
}
|
914
1062
|
)
|
915
1063
|
] }),
|
916
|
-
/* @__PURE__ */
|
917
|
-
/* @__PURE__ */
|
1064
|
+
/* @__PURE__ */ p("div", { className: "flex items-center", children: [
|
1065
|
+
/* @__PURE__ */ i(
|
918
1066
|
"input",
|
919
1067
|
{
|
920
1068
|
id: "radio-string",
|
921
1069
|
type: "radio",
|
922
1070
|
value: "string",
|
923
1071
|
name: "dateExportType",
|
924
|
-
checked:
|
925
|
-
onChange: () =>
|
926
|
-
className:
|
1072
|
+
checked: g === "string",
|
1073
|
+
onChange: () => O("string"),
|
1074
|
+
className: R(z, "w-4 text-primary-dark bg-gray-100 border-gray-300 dark:bg-gray-700 dark:border-gray-600")
|
927
1075
|
}
|
928
1076
|
),
|
929
|
-
/* @__PURE__ */
|
1077
|
+
/* @__PURE__ */ p(
|
930
1078
|
"label",
|
931
1079
|
{
|
932
1080
|
htmlFor: "radio-string",
|
933
1081
|
className: "p-2 text-sm font-medium text-gray-900 dark:text-slate-300",
|
934
1082
|
children: [
|
935
1083
|
"Dates as strings (",
|
936
|
-
|
1084
|
+
c.current.toISOString(),
|
937
1085
|
")"
|
938
1086
|
]
|
939
1087
|
}
|
@@ -941,34 +1089,34 @@ function bt({
|
|
941
1089
|
] })
|
942
1090
|
] })
|
943
1091
|
] }),
|
944
|
-
/* @__PURE__ */
|
945
|
-
|
1092
|
+
/* @__PURE__ */ i(
|
1093
|
+
Ne,
|
946
1094
|
{
|
947
1095
|
size: "small",
|
948
|
-
disabled:
|
949
|
-
value:
|
950
|
-
onValueChange:
|
1096
|
+
disabled: f !== "csv",
|
1097
|
+
value: d,
|
1098
|
+
onValueChange: u,
|
951
1099
|
label: "Flatten arrays"
|
952
1100
|
}
|
953
1101
|
),
|
954
|
-
!
|
1102
|
+
!V && s
|
955
1103
|
] }),
|
956
|
-
/* @__PURE__ */
|
957
|
-
|
958
|
-
/* @__PURE__ */
|
959
|
-
|
1104
|
+
/* @__PURE__ */ p(Te, { children: [
|
1105
|
+
T && /* @__PURE__ */ i(_e, { size: "small" }),
|
1106
|
+
/* @__PURE__ */ i(
|
1107
|
+
_,
|
960
1108
|
{
|
961
|
-
onClick:
|
1109
|
+
onClick: q,
|
962
1110
|
variant: "text",
|
963
1111
|
children: "Cancel"
|
964
1112
|
}
|
965
1113
|
),
|
966
|
-
/* @__PURE__ */
|
967
|
-
|
1114
|
+
/* @__PURE__ */ i(
|
1115
|
+
_,
|
968
1116
|
{
|
969
1117
|
variant: "filled",
|
970
|
-
onClick:
|
971
|
-
disabled:
|
1118
|
+
onClick: Le,
|
1119
|
+
disabled: T || !V,
|
972
1120
|
children: "Download"
|
973
1121
|
}
|
974
1122
|
)
|
@@ -978,28 +1126,27 @@ function bt({
|
|
978
1126
|
)
|
979
1127
|
] });
|
980
1128
|
}
|
981
|
-
function
|
982
|
-
return
|
1129
|
+
function Lt(e) {
|
1130
|
+
return Be(() => ({
|
983
1131
|
key: "import_export",
|
984
1132
|
collectionView: {
|
985
|
-
CollectionActions: [
|
1133
|
+
CollectionActions: [Ct, Tt],
|
986
1134
|
collectionActionsProps: e
|
987
1135
|
}
|
988
1136
|
}), [e]);
|
989
1137
|
}
|
990
1138
|
export {
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
Nt as useImportExportPlugin
|
1139
|
+
bt as DataNewPropertiesMapping,
|
1140
|
+
vt as ImportFileUpload,
|
1141
|
+
$t as ImportNewPropertyFieldPreview,
|
1142
|
+
wt as ImportSaveInProgress,
|
1143
|
+
ht as convertDataToEntity,
|
1144
|
+
ft as convertFileToJson,
|
1145
|
+
Fe as flattenEntry,
|
1146
|
+
gt as getInferenceType,
|
1147
|
+
te as processValueMapping,
|
1148
|
+
je as unflattenObject,
|
1149
|
+
pt as useImportConfig,
|
1150
|
+
Lt as useImportExportPlugin
|
1004
1151
|
};
|
1005
1152
|
//# sourceMappingURL=index.es.js.map
|