@firecms/collection_editor 3.0.0-canary.126 → 3.0.0-canary.127

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 CHANGED
@@ -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
  }
@@ -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;
@@ -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
- setSubcollectionToDelete(void 0);
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?" }),
@@ -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: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,
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, parentCollectionIds ?? []);
5495
+ return collectionInference?.(collection2.path, collection2.collectionGroup ?? false, parentPaths ?? []);
5490
5496
  };
5491
5497
  const inferCollectionFromData = async (newCollection) => {
5492
5498
  try {