@firecms/data_import_export 3.0.0-canary.45 → 3.0.0-canary.46
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/index.es.js +17 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/utils/data.ts +0 -1
package/dist/index.es.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import y, { useState as S, useRef as Je, useEffect as De, useCallback as v, useMemo as
|
1
|
+
import y, { useState as S, useRef as Je, useEffect as De, useCallback as v, useMemo as He } from "react";
|
2
2
|
import { jsxs as p, Fragment as M, jsx as i } from "react/jsx-runtime";
|
3
|
-
import { getPropertyInPath as J, mergeDeep as
|
4
|
-
import { Table as me, TableHeader as fe, TableCell as w, TableBody as he, TableRow as ge, Typography as f, ChevronRightIcon as xe, ExpandablePanel as tt, Select as _e, SelectItem as
|
3
|
+
import { getPropertyInPath as J, mergeDeep as Ve, resolveProperty as ze, isPropertyBuilder as ue, EntityReference as Ue, useSnackbarController as Ne, useCustomizationController as G, getFieldConfig as Se, ErrorBoundary as We, PropertyConfigBadge as Oe, useDataSource as ke, resolveCollection as Ie, getPropertiesWithPropertiesOrder as Xe, useSelectionController as Ge, EntityCollectionTable as Ye, slugify as qe, getArrayValuesCount as Qe, getValueInPath as Ze, useFireCMSContext as Ke, useNavigationController as et } from "@firecms/core";
|
4
|
+
import { Table as me, TableHeader as fe, TableCell as w, TableBody as he, TableRow as ge, Typography as f, ChevronRightIcon as xe, ExpandablePanel as tt, Select as _e, SelectItem as H, TextField as re, BooleanSwitchWithLabel as se, DateTimeField as rt, FileUpload as at, UploadIcon as nt, IconButton as Y, EditIcon as st, CenteredView as ye, Button as O, CircularProgress as Ae, Tooltip as q, FileUploadIcon as it, Dialog as ie, DialogContent as le, DialogActions as oe, cn as k, defaultBorderMixin as lt, GetAppIcon as Ee, Alert as ot, focusedMixin as _ } from "@firecms/ui";
|
5
5
|
import { inferTypeFromValue as ct, buildEntityPropertiesFromData as dt } from "@firecms/schema_inference";
|
6
|
-
import * as
|
6
|
+
import * as V from "xlsx";
|
7
7
|
import { getIn as Te, setIn as pt } from "@firecms/formex";
|
8
8
|
const ut = () => {
|
9
9
|
const [e, a] = S(!1), [s, t] = S({}), [r, n] = S(), [l, o] = S([]), [c, d] = S([]), [u, m] = S({}), [h, g] = S([]), [x, R] = S({});
|
@@ -43,9 +43,9 @@ function mt(e) {
|
|
43
43
|
default:
|
44
44
|
n = r;
|
45
45
|
}
|
46
|
-
const l =
|
46
|
+
const l = V.utils.encode_row(n.s.r), o = new Array(n.e.c - n.s.c + 1);
|
47
47
|
for (let c = n.s.c; c <= n.e.c; ++c) {
|
48
|
-
o[c] =
|
48
|
+
o[c] = V.utils.encode_col(c);
|
49
49
|
const d = e[o[c] + l];
|
50
50
|
switch (a) {
|
51
51
|
case 1:
|
@@ -60,7 +60,7 @@ function mt(e) {
|
|
60
60
|
default:
|
61
61
|
if (d === void 0)
|
62
62
|
continue;
|
63
|
-
s.push(
|
63
|
+
s.push(V.utils.format_cell(d));
|
64
64
|
}
|
65
65
|
}
|
66
66
|
return s;
|
@@ -115,11 +115,11 @@ function ft(e) {
|
|
115
115
|
console.debug("Converting Excel file to JSON", e.name);
|
116
116
|
const t = new FileReader();
|
117
117
|
t.onload = function(r) {
|
118
|
-
const n = new Uint8Array(r.target?.result), l =
|
118
|
+
const n = new Uint8Array(r.target?.result), l = V.read(n, {
|
119
119
|
type: "array",
|
120
120
|
codepage: 65001,
|
121
121
|
cellDates: !0
|
122
|
-
}), o = l.SheetNames[0], c = l.Sheets[o], d =
|
122
|
+
}), o = l.SheetNames[0], c = l.Sheets[o], d = V.utils.sheet_to_json(c), u = mt(c), h = d.map(ht).map(je);
|
123
123
|
a({
|
124
124
|
data: h,
|
125
125
|
propertiesOrder: u
|
@@ -162,7 +162,7 @@ function gt(e, a, s, t, r, n) {
|
|
162
162
|
return {
|
163
163
|
[h]: x
|
164
164
|
};
|
165
|
-
}).reduce((u, m) => ({ ...u, ...m }), {}), c =
|
165
|
+
}).reduce((u, m) => ({ ...u, ...m }), {}), c = Ve(n ?? {}, je(o));
|
166
166
|
let d = a ? e[a] : void 0;
|
167
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
168
|
id: d,
|
@@ -182,8 +182,7 @@ function ae(e, a) {
|
|
182
182
|
if (a === void 0)
|
183
183
|
return e;
|
184
184
|
const s = ze({
|
185
|
-
propertyOrBuilder: a
|
186
|
-
propertyValue: e
|
185
|
+
propertyOrBuilder: a
|
187
186
|
});
|
188
187
|
if (s === null)
|
189
188
|
return e;
|
@@ -362,8 +361,8 @@ function bt({
|
|
362
361
|
renderValue: (t) => /* @__PURE__ */ i(f, { variant: "body2", children: t !== "__none__" ? t : "Autogenerate ID" }),
|
363
362
|
label: "Column that will be used as ID for each document",
|
364
363
|
children: [
|
365
|
-
/* @__PURE__ */ i(
|
366
|
-
Object.entries(a).map(([t, r]) => /* @__PURE__ */ i(
|
364
|
+
/* @__PURE__ */ i(H, { value: "__none__", children: "Autogenerate ID" }),
|
365
|
+
Object.entries(a).map(([t, r]) => /* @__PURE__ */ i(H, { value: t, children: t }, t))
|
367
366
|
]
|
368
367
|
}
|
369
368
|
) });
|
@@ -715,14 +714,14 @@ function Nt({
|
|
715
714
|
},
|
716
715
|
renderValue: o,
|
717
716
|
children: [
|
718
|
-
/* @__PURE__ */ i(
|
719
|
-
/* @__PURE__ */ i(
|
717
|
+
/* @__PURE__ */ i(H, { value: "__do_not_import", children: /* @__PURE__ */ i(f, { variant: "body2", color: "disabled", className: "p-4", children: "Do not import this property" }) }),
|
718
|
+
/* @__PURE__ */ i(H, { value: W, children: /* @__PURE__ */ i(f, { variant: "body2", className: "p-4", children: "Use this column as ID" }) }),
|
720
719
|
r.map(({
|
721
720
|
property: d,
|
722
721
|
level: u,
|
723
722
|
propertyKey: m
|
724
723
|
}) => /* @__PURE__ */ i(
|
725
|
-
|
724
|
+
H,
|
726
725
|
{
|
727
726
|
value: m,
|
728
727
|
disabled: d.dataType === "map",
|
@@ -1143,7 +1142,7 @@ function At({
|
|
1143
1142
|
] });
|
1144
1143
|
}
|
1145
1144
|
function $t(e) {
|
1146
|
-
return
|
1145
|
+
return He(() => ({
|
1147
1146
|
key: "import_export",
|
1148
1147
|
collectionView: {
|
1149
1148
|
CollectionActions: [Dt, At],
|