@firecms/collection_editor 3.0.0-canary.126 → 3.0.0-canary.128
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 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +16 -10
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_inference.d.ts +1 -1
- package/package.json +8 -8
- package/src/types/collection_inference.ts +1 -1
- package/src/ui/HomePageEditorCollectionAction.tsx +2 -2
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +1 -0
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +1 -1
- package/src/ui/collection_editor/PropertyEditView.tsx +6 -6
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +20 -15
- package/src/ui/collection_editor/templates/pages_template.ts +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { FieldCaption, SearchIconsView, toSnakeCase, singular, IconForView, ArrayContainer, serializeRegExp, useSnackbarController, resolveEnumValues, isPropertyBuilder, useCustomizationController, getFieldConfig, ErrorBoundary, PropertyConfigBadge, unslugify, useNavigationController, mergeDeep, DEFAULT_FIELD_CONFIGS, isValidRegExp, getFieldId,
|
|
2
|
+
import { FieldCaption, SearchIconsView, toSnakeCase, singular, IconForView, ArrayContainer, serializeRegExp, useSnackbarController, resolveEnumValues, isPropertyBuilder, useCustomizationController, getFieldConfig, ErrorBoundary, PropertyConfigBadge, unslugify, useNavigationController, mergeDeep, DEFAULT_FIELD_CONFIGS, isValidRegExp, getFieldId, ConfirmationDialog, useLargeLayout, makePropertiesEditable, resolveEntityView, useSelectionController, CircularProgressCenter, EntityCollectionTable, slugify, useAuthController, randomString, removeUndefined, ErrorView, removeInitialAndTrailingSlashes, getDefaultPropertiesOrder, joinCollectionLists } from "@firecms/core";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import React__default, { useContext, useState, useEffect, useMemo, useRef, useDeferredValue, useCallback } from "react";
|
|
5
5
|
import equal from "react-fast-compare";
|
|
@@ -131,6 +131,7 @@ function CollectionDetailsForm({
|
|
|
131
131
|
value: values.name ?? "",
|
|
132
132
|
onChange: (e) => updateName(e.target.value),
|
|
133
133
|
label: "Name",
|
|
134
|
+
autoFocus: true,
|
|
134
135
|
required: true,
|
|
135
136
|
error: showErrors && Boolean(errors.name)
|
|
136
137
|
}
|
|
@@ -3549,7 +3550,7 @@ function PropertyEditFormFields({
|
|
|
3549
3550
|
/* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(AdvancedPropertyValidation, { disabled }) })
|
|
3550
3551
|
] }),
|
|
3551
3552
|
onDelete && /* @__PURE__ */ jsx(
|
|
3552
|
-
|
|
3553
|
+
ConfirmationDialog,
|
|
3553
3554
|
{
|
|
3554
3555
|
open: deleteDialogOpen,
|
|
3555
3556
|
onAccept: () => onDelete(values?.id, propertyNamespace),
|
|
@@ -4193,7 +4194,7 @@ function SubcollectionsEditTab({
|
|
|
4193
4194
|
values,
|
|
4194
4195
|
setFieldValue
|
|
4195
4196
|
} = useFormex();
|
|
4196
|
-
const subcollections = collection.subcollections ?? [];
|
|
4197
|
+
const [subcollections, setSubcollections] = React__default.useState(collection.subcollections ?? []);
|
|
4197
4198
|
const resolvedEntityViews = values.entityViews?.filter((e) => typeof e === "string").map((e) => resolveEntityView(e, contextEntityViews)).filter(Boolean) ?? [];
|
|
4198
4199
|
const hardCodedEntityViews = collection.entityViews?.filter((e) => typeof e !== "string") ?? [];
|
|
4199
4200
|
const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;
|
|
@@ -4346,7 +4347,7 @@ function SubcollectionsEditTab({
|
|
|
4346
4347
|
] }) }),
|
|
4347
4348
|
/* @__PURE__ */ jsx("div", { style: { height: "52px" } }),
|
|
4348
4349
|
subcollectionToDelete && /* @__PURE__ */ jsx(
|
|
4349
|
-
|
|
4350
|
+
ConfirmationDialog,
|
|
4350
4351
|
{
|
|
4351
4352
|
open: Boolean(subcollectionToDelete),
|
|
4352
4353
|
onAccept: () => {
|
|
@@ -4355,8 +4356,10 @@ function SubcollectionsEditTab({
|
|
|
4355
4356
|
parentCollectionIds: [...parentCollectionIds ?? [], collection.id]
|
|
4356
4357
|
};
|
|
4357
4358
|
console.debug("Deleting subcollection", props);
|
|
4358
|
-
configController.deleteCollection(props)
|
|
4359
|
-
|
|
4359
|
+
configController.deleteCollection(props).then(() => {
|
|
4360
|
+
setSubcollectionToDelete(void 0);
|
|
4361
|
+
setSubcollections(subcollections?.filter((e) => e.id !== subcollectionToDelete));
|
|
4362
|
+
});
|
|
4360
4363
|
},
|
|
4361
4364
|
onCancel: () => setSubcollectionToDelete(void 0),
|
|
4362
4365
|
title: /* @__PURE__ */ jsx(Fragment, { children: "Delete this subcollection?" }),
|
|
@@ -4368,7 +4371,7 @@ function SubcollectionsEditTab({
|
|
|
4368
4371
|
}
|
|
4369
4372
|
),
|
|
4370
4373
|
viewToDelete && /* @__PURE__ */ jsx(
|
|
4371
|
-
|
|
4374
|
+
ConfirmationDialog,
|
|
4372
4375
|
{
|
|
4373
4376
|
open: Boolean(viewToDelete),
|
|
4374
4377
|
onAccept: () => {
|
|
@@ -4395,7 +4398,10 @@ function SubcollectionsEditTab({
|
|
|
4395
4398
|
isNewCollection: false,
|
|
4396
4399
|
...currentDialog,
|
|
4397
4400
|
getUser,
|
|
4398
|
-
handleClose: () => {
|
|
4401
|
+
handleClose: (updatedCollection) => {
|
|
4402
|
+
if (updatedCollection && !subcollections.map((e) => e.id).includes(updatedCollection.id)) {
|
|
4403
|
+
setSubcollections([...subcollections, updatedCollection]);
|
|
4404
|
+
}
|
|
4399
4405
|
setCurrentDialog(void 0);
|
|
4400
4406
|
}
|
|
4401
4407
|
}
|
|
@@ -4672,7 +4678,7 @@ const pagesCollectionTemplate = {
|
|
|
4672
4678
|
validation: {
|
|
4673
4679
|
required: true,
|
|
4674
4680
|
unique: true,
|
|
4675
|
-
matches:
|
|
4681
|
+
matches: "^[a-z0-9]+(?:-[a-z0-9]+)*$",
|
|
4676
4682
|
matchesMessage: "Must be lowercase, alphanumeric, and hyphenated"
|
|
4677
4683
|
}
|
|
4678
4684
|
},
|
|
@@ -5486,7 +5492,7 @@ function CollectionEditorInternal({
|
|
|
5486
5492
|
};
|
|
5487
5493
|
const doCollectionInference = (collection2) => {
|
|
5488
5494
|
if (!collectionInference) return void 0;
|
|
5489
|
-
return collectionInference?.(collection2.path, collection2.collectionGroup ?? false,
|
|
5495
|
+
return collectionInference?.(collection2.path, collection2.collectionGroup ?? false, parentPaths ?? []);
|
|
5490
5496
|
};
|
|
5491
5497
|
const inferCollectionFromData = async (newCollection) => {
|
|
5492
5498
|
try {
|
|
@@ -6300,7 +6306,7 @@ function HomePageEditorCollectionAction({
|
|
|
6300
6306
|
)
|
|
6301
6307
|
] }),
|
|
6302
6308
|
/* @__PURE__ */ jsx(
|
|
6303
|
-
|
|
6309
|
+
ConfirmationDialog,
|
|
6304
6310
|
{
|
|
6305
6311
|
open: deleteRequested,
|
|
6306
6312
|
onAccept: deleteCollection,
|