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