@firecms/collection_editor 3.0.0-canary.264 → 3.0.0-canary.266
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 +58 -45
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +66 -53
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
- package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +1 -1
- package/dist/ui/collection_editor/import/clean_import_data.d.ts +1 -1
- package/package.json +19 -19
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +2 -2
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +1 -1
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +1 -1
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +1 -1
- package/src/ui/collection_editor/import/clean_import_data.ts +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("react-compiler-runtime"), require("@firecms/core"), require("react"), require("react-fast-compare"), require("@firecms/ui"), require("yup"), require("@firecms/formex"), require("@firecms/schema_inference"), require("@dnd-kit/core"), require("@dnd-kit/sortable"), require("@dnd-kit/modifiers"), require("@dnd-kit/utilities"), require("json5"), require("prism-react-renderer"), require("@firecms/
|
|
3
|
-
})(this, function(exports2, jsxRuntime, reactCompilerRuntime, core, React, equal, ui, Yup, formex, schema_inference, core$1, sortable, modifiers, utilities, JSON5, prismReactRenderer,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("react-compiler-runtime"), require("@firecms/core"), require("react"), require("react-fast-compare"), require("@firecms/ui"), require("yup"), require("@firecms/formex"), require("@firecms/schema_inference"), require("@dnd-kit/core"), require("@dnd-kit/sortable"), require("@dnd-kit/modifiers"), require("@dnd-kit/utilities"), require("json5"), require("prism-react-renderer"), require("@firecms/data_import"), require("react-router")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "react-compiler-runtime", "@firecms/core", "react", "react-fast-compare", "@firecms/ui", "yup", "@firecms/formex", "@firecms/schema_inference", "@dnd-kit/core", "@dnd-kit/sortable", "@dnd-kit/modifiers", "@dnd-kit/utilities", "json5", "prism-react-renderer", "@firecms/data_import", "react-router"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["FireCMS collection editor"] = {}, global.jsxRuntime, global.reactCompilerRuntime, global.core, global.React, global.equal, global.ui, global.Yup, global.formex, global.schema_inference, global.core$1, global.sortable, global.modifiers, global.utilities, global.JSON5, global.prismReactRenderer, global.data_import, global.reactRouter));
|
|
3
|
+
})(this, (function(exports2, jsxRuntime, reactCompilerRuntime, core, React, equal, ui, Yup, formex, schema_inference, core$1, sortable, modifiers, utilities, JSON5, prismReactRenderer, data_import, reactRouter) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -4447,7 +4447,7 @@
|
|
|
4447
4447
|
return t4;
|
|
4448
4448
|
}
|
|
4449
4449
|
function CollectionsSelect(t0) {
|
|
4450
|
-
const $ = reactCompilerRuntime.c(
|
|
4450
|
+
const $ = reactCompilerRuntime.c(29);
|
|
4451
4451
|
let disabled;
|
|
4452
4452
|
let error;
|
|
4453
4453
|
let handleChange;
|
|
@@ -4499,12 +4499,21 @@
|
|
|
4499
4499
|
}
|
|
4500
4500
|
const collections = t1;
|
|
4501
4501
|
let t2;
|
|
4502
|
-
if ($[10] !== collections
|
|
4503
|
-
|
|
4502
|
+
if ($[10] !== collections) {
|
|
4503
|
+
t2 = Array.from(new Set(Object.values(collections).map(_temp$9).filter(Boolean)).values());
|
|
4504
|
+
$[10] = collections;
|
|
4505
|
+
$[11] = t2;
|
|
4506
|
+
} else {
|
|
4507
|
+
t2 = $[11];
|
|
4508
|
+
}
|
|
4509
|
+
const groups = t2;
|
|
4510
|
+
let t3;
|
|
4511
|
+
if ($[12] !== collections || $[13] !== disabled || $[14] !== error || $[15] !== groups || $[16] !== handleChange || $[17] !== pathPath || $[18] !== props || $[19] !== value) {
|
|
4504
4512
|
const ungroupedCollections = collections.filter(_temp2$6);
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4513
|
+
const t42 = Boolean(error);
|
|
4514
|
+
let t52;
|
|
4515
|
+
if ($[21] !== collections) {
|
|
4516
|
+
t52 = (selected) => {
|
|
4508
4517
|
const selectedCollection = collections.find((collection) => collection.id === selected || collection.path === selected);
|
|
4509
4518
|
if (!selectedCollection) {
|
|
4510
4519
|
return null;
|
|
@@ -4514,56 +4523,58 @@
|
|
|
4514
4523
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "font-medium ml-4", children: selectedCollection?.name.toUpperCase() })
|
|
4515
4524
|
] });
|
|
4516
4525
|
};
|
|
4517
|
-
$[
|
|
4518
|
-
$[
|
|
4526
|
+
$[21] = collections;
|
|
4527
|
+
$[22] = t52;
|
|
4519
4528
|
} else {
|
|
4520
|
-
|
|
4529
|
+
t52 = $[22];
|
|
4521
4530
|
}
|
|
4522
|
-
let
|
|
4523
|
-
if ($[
|
|
4524
|
-
|
|
4531
|
+
let t6;
|
|
4532
|
+
if ($[23] !== collections || $[24] !== groups) {
|
|
4533
|
+
t6 = groups.flatMap((group) => /* @__PURE__ */ jsxRuntime.jsx(ui.SelectGroup, { label: group || "Views", children: collections.filter((collection_0) => collection_0.group === group).map((collection_1) => /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: collection_1.id ?? collection_1.path, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row", children: [
|
|
4525
4534
|
/* @__PURE__ */ jsxRuntime.jsx(core.IconForView, { collectionOrView: collection_1 }),
|
|
4526
4535
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", className: "font-medium ml-4", children: collection_1?.name.toUpperCase() })
|
|
4527
|
-
] }) }, `${collection_1.id ?? collection_1.path}-${group}`)) }, `group_${group}`);
|
|
4528
|
-
$[
|
|
4529
|
-
$[
|
|
4536
|
+
] }) }, `${collection_1.id ?? collection_1.path}-${group}`)) }, `group_${group}`));
|
|
4537
|
+
$[23] = collections;
|
|
4538
|
+
$[24] = groups;
|
|
4539
|
+
$[25] = t6;
|
|
4530
4540
|
} else {
|
|
4531
|
-
|
|
4541
|
+
t6 = $[25];
|
|
4532
4542
|
}
|
|
4533
|
-
|
|
4534
|
-
|
|
4543
|
+
t3 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { error: t42, disabled, value: value ?? "", position: "item-aligned", name: pathPath, size: "large", fullWidth: true, onChange: handleChange, label: "Target collection", renderValue: t52, ...props, children: [
|
|
4544
|
+
t6,
|
|
4535
4545
|
ungroupedCollections && /* @__PURE__ */ jsxRuntime.jsx(ui.SelectGroup, { label: "Views", children: ungroupedCollections.map(_temp3$3) })
|
|
4536
4546
|
] });
|
|
4537
|
-
$[
|
|
4538
|
-
$[
|
|
4539
|
-
$[
|
|
4540
|
-
$[
|
|
4541
|
-
$[
|
|
4542
|
-
$[
|
|
4543
|
-
$[
|
|
4544
|
-
$[
|
|
4547
|
+
$[12] = collections;
|
|
4548
|
+
$[13] = disabled;
|
|
4549
|
+
$[14] = error;
|
|
4550
|
+
$[15] = groups;
|
|
4551
|
+
$[16] = handleChange;
|
|
4552
|
+
$[17] = pathPath;
|
|
4553
|
+
$[18] = props;
|
|
4554
|
+
$[19] = value;
|
|
4555
|
+
$[20] = t3;
|
|
4545
4556
|
} else {
|
|
4546
|
-
|
|
4557
|
+
t3 = $[20];
|
|
4547
4558
|
}
|
|
4548
|
-
let
|
|
4549
|
-
if ($[
|
|
4550
|
-
|
|
4551
|
-
$[
|
|
4559
|
+
let t4;
|
|
4560
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
4561
|
+
t4 = /* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: "You can only edit the reference collection upon field creation." });
|
|
4562
|
+
$[26] = t4;
|
|
4552
4563
|
} else {
|
|
4553
|
-
|
|
4564
|
+
t4 = $[26];
|
|
4554
4565
|
}
|
|
4555
|
-
let
|
|
4556
|
-
if ($[
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4566
|
+
let t5;
|
|
4567
|
+
if ($[27] !== t3) {
|
|
4568
|
+
t5 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4569
|
+
t3,
|
|
4570
|
+
t4
|
|
4560
4571
|
] });
|
|
4561
|
-
$[
|
|
4562
|
-
$[
|
|
4572
|
+
$[27] = t3;
|
|
4573
|
+
$[28] = t5;
|
|
4563
4574
|
} else {
|
|
4564
|
-
|
|
4575
|
+
t5 = $[28];
|
|
4565
4576
|
}
|
|
4566
|
-
return
|
|
4577
|
+
return t5;
|
|
4567
4578
|
}
|
|
4568
4579
|
function _temp3$3(collection_2) {
|
|
4569
4580
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: collection_2.id ?? collection_2.path, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row", children: [
|
|
@@ -8482,7 +8493,7 @@
|
|
|
8482
8493
|
if ($[45] !== onContinue || $[46] !== parentCollection) {
|
|
8483
8494
|
t20 = !parentCollection && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
8484
8495
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", className: "mb-2", children: "● Create a collection from a file (csv, json, xls, xslx...)" }),
|
|
8485
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8496
|
+
/* @__PURE__ */ jsxRuntime.jsx(data_import.ImportFileUpload, { onDataAdded: (data, propertiesOrder) => onContinue(data, propertiesOrder) })
|
|
8486
8497
|
] });
|
|
8487
8498
|
$[45] = onContinue;
|
|
8488
8499
|
$[46] = parentCollection;
|
|
@@ -8659,12 +8670,14 @@
|
|
|
8659
8670
|
const propertyPath_0 = fullId_0 ? idToPropertiesPath(fullId_0) : void 0;
|
|
8660
8671
|
const propertyData = importConfig.importData.map((d) => formex.getIn(d, importKey));
|
|
8661
8672
|
const inferredNewProperty = {
|
|
8662
|
-
...schema_inference.buildPropertyFromData(propertyData, property_1,
|
|
8673
|
+
...schema_inference.buildPropertyFromData(propertyData, property_1, data_import.getInferenceType),
|
|
8663
8674
|
editable: true
|
|
8664
8675
|
};
|
|
8665
8676
|
if (propertyPath_0) {
|
|
8666
|
-
{
|
|
8677
|
+
if (inferredNewProperty) {
|
|
8667
8678
|
setFieldValue(propertyPath_0, inferredNewProperty, false);
|
|
8679
|
+
} else {
|
|
8680
|
+
setFieldValue(propertyPath_0, property_1, false);
|
|
8668
8681
|
}
|
|
8669
8682
|
setFieldTouched(propertyPath_0, true, false);
|
|
8670
8683
|
}
|
|
@@ -8697,7 +8710,7 @@
|
|
|
8697
8710
|
if (isIdColumn) {
|
|
8698
8711
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: " This column will be used as ID" });
|
|
8699
8712
|
}
|
|
8700
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8713
|
+
return /* @__PURE__ */ jsxRuntime.jsx(data_import.ImportNewPropertyFieldPreview, { property: property_2, propertyKey: propertyKey_0, onPropertyNameChanged: (propertyKey_1, value) => setFieldValue(`properties.${propertyKey_1}.name`, value, false), onEditClick: () => {
|
|
8701
8714
|
if (!propertyKey_0 || !property_2) {
|
|
8702
8715
|
return;
|
|
8703
8716
|
}
|
|
@@ -8722,7 +8735,7 @@
|
|
|
8722
8735
|
if ($[16] !== importConfig || $[17] !== t5 || $[18] !== t6) {
|
|
8723
8736
|
t7 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
8724
8737
|
t4,
|
|
8725
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8738
|
+
/* @__PURE__ */ jsxRuntime.jsx(data_import.DataNewPropertiesMapping, { importConfig, destinationProperties: t5, buildPropertyView: t6 })
|
|
8726
8739
|
] });
|
|
8727
8740
|
$[16] = importConfig;
|
|
8728
8741
|
$[17] = t5;
|
|
@@ -8982,7 +8995,7 @@
|
|
|
8982
8995
|
let t1;
|
|
8983
8996
|
if ($[0] !== authController || $[1] !== importConfig || $[2] !== properties) {
|
|
8984
8997
|
t1 = async function loadEntities2() {
|
|
8985
|
-
const mappedData = importConfig.importData.map((d) =>
|
|
8998
|
+
const mappedData = importConfig.importData.map((d) => data_import.convertDataToEntity(authController, d, importConfig.idColumn, importConfig.headersMapping, properties, "TEMP_PATH", importConfig.defaultValues));
|
|
8986
8999
|
importConfig.setEntities(mappedData);
|
|
8987
9000
|
};
|
|
8988
9001
|
$[0] = authController;
|
|
@@ -9665,7 +9678,7 @@
|
|
|
9665
9678
|
groups,
|
|
9666
9679
|
existingEntities
|
|
9667
9680
|
}) {
|
|
9668
|
-
const importConfig =
|
|
9681
|
+
const importConfig = data_import.useImportConfig();
|
|
9669
9682
|
const navigation = core.useNavigationController();
|
|
9670
9683
|
const snackbarController = core.useSnackbarController();
|
|
9671
9684
|
const propertyErrorsRef = React.useRef({});
|
|
@@ -9891,7 +9904,7 @@
|
|
|
9891
9904
|
}, [dirty]);
|
|
9892
9905
|
function onImportDataSet(data_0, propertiesOrder) {
|
|
9893
9906
|
importConfig.setInUse(true);
|
|
9894
|
-
schema_inference.buildEntityPropertiesFromData(data_0,
|
|
9907
|
+
schema_inference.buildEntityPropertiesFromData(data_0, data_import.getInferenceType).then((properties) => {
|
|
9895
9908
|
const res = cleanPropertiesFromImport(properties);
|
|
9896
9909
|
importConfig.setIdColumn(res.idColumn);
|
|
9897
9910
|
importConfig.setImportData(data_0);
|
|
@@ -9951,7 +9964,7 @@
|
|
|
9951
9964
|
}, existingCollectionPaths: existingPaths, parentCollection, pathSuggestions }),
|
|
9952
9965
|
currentView === "import_data_mapping" && importConfig && /* @__PURE__ */ jsxRuntime.jsx(CollectionEditorImportMapping, { importConfig, collectionEditable, propertyConfigs }),
|
|
9953
9966
|
currentView === "import_data_preview" && importConfig && /* @__PURE__ */ jsxRuntime.jsx(CollectionEditorImportDataPreview, { importConfig, properties: values_1.properties, propertiesOrder: values_1.propertiesOrder }),
|
|
9954
|
-
currentView === "import_data_saving" && importConfig && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9967
|
+
currentView === "import_data_saving" && importConfig && /* @__PURE__ */ jsxRuntime.jsx(data_import.ImportSaveInProgress, { importConfig, collection: values_1, path, onImportSuccess: async (importedCollection) => {
|
|
9955
9968
|
snackbarController.open({
|
|
9956
9969
|
type: "info",
|
|
9957
9970
|
message: "Data imported successfully"
|
|
@@ -11409,5 +11422,5 @@
|
|
|
11409
11422
|
exports2.useCollectionEditorPlugin = useCollectionEditorPlugin;
|
|
11410
11423
|
exports2.useCollectionsConfigController = useCollectionsConfigController;
|
|
11411
11424
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
11412
|
-
});
|
|
11425
|
+
}));
|
|
11413
11426
|
//# sourceMappingURL=index.umd.js.map
|