@firecms/core 3.0.0-canary.164 → 3.0.0-canary.166

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.umd.js CHANGED
@@ -877,6 +877,28 @@
877
877
  const simpleRegexp = input.match(/((?![*+?])(?:[^\r\n[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*])+)/);
878
878
  return !!simpleRegexp;
879
879
  }
880
+ const reservedKeys = ["edit", "copy", "delete"];
881
+ function mergeEntityActions(currentActions, newActions) {
882
+ const updatedActions = [];
883
+ currentActions.forEach((action) => {
884
+ const newAction = newActions.find((a) => a.key === action.key);
885
+ if (newAction) {
886
+ const mergedAction = {
887
+ ...action,
888
+ ...newAction
889
+ };
890
+ updatedActions.push(mergedAction);
891
+ } else {
892
+ updatedActions.push(action);
893
+ }
894
+ });
895
+ newActions.forEach((action) => {
896
+ if (!currentActions.find((a) => a.key === action.key) && (!action.key || !reservedKeys.includes(action.key))) {
897
+ updatedActions.push(action);
898
+ }
899
+ });
900
+ return updatedActions;
901
+ }
880
902
  function useDebouncedCallback(value, callback, immediate, t0) {
881
903
  const $ = reactCompilerRuntime.c(9);
882
904
  const timeoutMs = t0 === void 0 ? 300 : t0;
@@ -6860,15 +6882,17 @@
6860
6882
  const hasCollapsedActions = actions.some((a) => a.collapsed || a.collapsed === void 0);
6861
6883
  const collapsedActions = actions.filter((a_0) => a_0.collapsed || a_0.collapsed === void 0);
6862
6884
  const uncollapsedActions = actions.filter((a_1) => a_1.collapsed === false);
6863
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10", frozen ? "sticky left-0" : ""), style: {
6885
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10", frozen ? "sticky left-0" : ""), onClick: React.useCallback((event) => {
6886
+ event.stopPropagation();
6887
+ }, []), style: {
6864
6888
  width,
6865
6889
  position: frozen ? "sticky" : "initial",
6866
6890
  left: frozen ? 0 : "initial",
6867
6891
  contain: "strict"
6868
6892
  }, children: [
6869
6893
  (hasActions || selectionEnabled) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-34 flex justify-center", children: [
6870
- uncollapsedActions.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: action.name, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: (event) => {
6871
- event.stopPropagation();
6894
+ uncollapsedActions.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: action.name, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: (event_0) => {
6895
+ event_0.stopPropagation();
6872
6896
  action.onClick({
6873
6897
  entity,
6874
6898
  fullPath,
@@ -6898,8 +6922,8 @@
6898
6922
  ] }, index_0)) }),
6899
6923
  selectionEnabled && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: `Select ${entity.id}`, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { size: largeLayout ? "medium" : "small", checked: Boolean(isSelected), onCheckedChange }) })
6900
6924
  ] }),
6901
- !hideId && size !== "xs" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[138px] text-center overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2", onClick: (event_0) => {
6902
- event_0.stopPropagation();
6925
+ !hideId && size !== "xs" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[138px] text-center overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2", onClick: (event_1) => {
6926
+ event_1.stopPropagation();
6903
6927
  }, children: entity ? entity.id : /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, {}) })
6904
6928
  ] });
6905
6929
  };
@@ -7108,7 +7132,7 @@
7108
7132
  function getSubcollectionColumnId(collection) {
7109
7133
  return `subcollection:${collection.id ?? collection.path}`;
7110
7134
  }
7111
- const COLLECTION_GROUP_PARENT_ID$1 = "collectionGroupParent";
7135
+ const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
7112
7136
  function useColumnIds(collection, includeSubcollections) {
7113
7137
  const $ = reactCompilerRuntime.c(5);
7114
7138
  let t0;
@@ -7119,7 +7143,7 @@
7119
7143
  propertyColumnConfigs = hideAndExpandKeys(collection, collection.propertiesOrder);
7120
7144
  if (collection.collectionGroup) {
7121
7145
  propertyColumnConfigs.push({
7122
- key: COLLECTION_GROUP_PARENT_ID$1,
7146
+ key: COLLECTION_GROUP_PARENT_ID,
7123
7147
  disabled: true
7124
7148
  });
7125
7149
  }
@@ -7174,7 +7198,7 @@
7174
7198
  }];
7175
7199
  }
7176
7200
  }
7177
- if (collection.collectionGroup && key === COLLECTION_GROUP_PARENT_ID$1) {
7201
+ if (collection.collectionGroup && key === COLLECTION_GROUP_PARENT_ID) {
7178
7202
  return [{
7179
7203
  key,
7180
7204
  disabled: true
@@ -7193,7 +7217,7 @@
7193
7217
  columnIds.push(...subCollectionIds.filter((subColId) => !columnIds.includes(subColId)));
7194
7218
  }
7195
7219
  if (collection.collectionGroup) {
7196
- columnIds.push(COLLECTION_GROUP_PARENT_ID$1);
7220
+ columnIds.push(COLLECTION_GROUP_PARENT_ID);
7197
7221
  }
7198
7222
  return hideAndExpandKeys(collection, columnIds);
7199
7223
  }
@@ -9471,6 +9495,7 @@
9471
9495
  }
9472
9496
  const editEntityAction = {
9473
9497
  icon: /* @__PURE__ */ jsxRuntime.jsx(ui.EditIcon, {}),
9498
+ key: "edit",
9474
9499
  name: "Edit",
9475
9500
  collapsed: false,
9476
9501
  onClick({
@@ -9503,6 +9528,7 @@
9503
9528
  const copyEntityAction = {
9504
9529
  icon: /* @__PURE__ */ jsxRuntime.jsx(ui.FileCopyIcon, {}),
9505
9530
  name: "Copy",
9531
+ key: "copy",
9506
9532
  onClick({
9507
9533
  entity,
9508
9534
  collection,
@@ -9526,34 +9552,10 @@
9526
9552
  return Promise.resolve(void 0);
9527
9553
  }
9528
9554
  };
9529
- const archiveEntityAction = {
9530
- icon: /* @__PURE__ */ jsxRuntime.jsx(ui.ArchiveIcon, {}),
9531
- name: "Archive",
9532
- onClick({
9533
- entity,
9534
- collection,
9535
- context: {
9536
- dataSource
9537
- }
9538
- }) {
9539
- return Promise.resolve(void 0);
9540
- }
9541
- };
9542
- const openWebsiteAction = {
9543
- icon: /* @__PURE__ */ jsxRuntime.jsx(ui.OpenInNewIcon, {}),
9544
- name: "See in website",
9545
- onClick({
9546
- entity,
9547
- collection,
9548
- context
9549
- }) {
9550
- window.open(`https://example.com/${entity.id}`, "_blank");
9551
- return Promise.resolve(void 0);
9552
- }
9553
- };
9554
9555
  const deleteEntityAction = {
9555
9556
  icon: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, {}),
9556
9557
  name: "Delete",
9558
+ key: "delete",
9557
9559
  onClick({
9558
9560
  entity,
9559
9561
  fullPath,
@@ -11520,7 +11522,7 @@
11520
11522
  const actions = [];
11521
11523
  if (createEnabled) actions.push(copyEntityAction);
11522
11524
  if (deleteEnabled) actions.push(deleteEntityAction);
11523
- if (customEntityActions) actions.push(...customEntityActions);
11525
+ if (customEntityActions) return mergeEntityActions(actions, customEntityActions);
11524
11526
  return actions;
11525
11527
  }, [authController, inputCollection, path]);
11526
11528
  const modified = formex$1.dirty;
@@ -12128,7 +12130,6 @@
12128
12130
  }
12129
12131
  return t5;
12130
12132
  }
12131
- const COLLECTION_GROUP_PARENT_ID = "collectionGroupParent";
12132
12133
  const EntityCollectionView = React.memo(function EntityCollectionView2({
12133
12134
  fullPath: fullPathProp,
12134
12135
  parentCollectionIds,
@@ -12378,7 +12379,7 @@
12378
12379
  const actions = [editEntityAction];
12379
12380
  if (createEnabled) actions.push(copyEntityAction);
12380
12381
  if (deleteEnabled) actions.push(deleteEntityAction);
12381
- if (customEntityActions) actions.push(...customEntityActions);
12382
+ if (customEntityActions) return mergeEntityActions(actions, customEntityActions);
12382
12383
  return actions;
12383
12384
  };
12384
12385
  const getIdColumnWidth = () => {
@@ -16018,7 +16019,7 @@
16018
16019
  propertyOrBuilder: inputProperty,
16019
16020
  propertyConfigs: customizationController.propertyConfigs
16020
16021
  });
16021
- if (value === void 0 || property === null) {
16022
+ if (property === null) {
16022
16023
  let t02;
16023
16024
  if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
16024
16025
  t02 = /* @__PURE__ */ jsxRuntime.jsx(EmptyValue, {});
@@ -16039,7 +16040,7 @@
16039
16040
  customProps: property.customProps
16040
16041
  });
16041
16042
  } else {
16042
- if (value === null) {
16043
+ if (value === void 0 || value === null) {
16043
16044
  let t02;
16044
16045
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
16045
16046
  t02 = /* @__PURE__ */ jsxRuntime.jsx(EmptyValue, {});
@@ -22535,6 +22536,7 @@
22535
22536
  exports2.AuthControllerContext = AuthControllerContext;
22536
22537
  exports2.BlockFieldBinding = BlockFieldBinding;
22537
22538
  exports2.BooleanPreview = BooleanPreview;
22539
+ exports2.COLLECTION_GROUP_PARENT_ID = COLLECTION_GROUP_PARENT_ID;
22538
22540
  exports2.COLLECTION_PATH_SEPARATOR = COLLECTION_PATH_SEPARATOR;
22539
22541
  exports2.CircularProgressCenter = CircularProgressCenter;
22540
22542
  exports2.ConfirmationDialog = ConfirmationDialog;
@@ -22613,7 +22615,6 @@
22613
22615
  exports2.VirtualTable = VirtualTable;
22614
22616
  exports2.addInitialSlash = addInitialSlash;
22615
22617
  exports2.applyPermissionsFunctionIfEmpty = applyPermissionsFunctionIfEmpty;
22616
- exports2.archiveEntityAction = archiveEntityAction;
22617
22618
  exports2.buildAdditionalFieldDelegate = buildAdditionalFieldDelegate;
22618
22619
  exports2.buildCollection = buildCollection;
22619
22620
  exports2.buildEntityCallbacks = buildEntityCallbacks;
@@ -22687,7 +22688,7 @@
22687
22688
  exports2.makePropertiesNonEditable = makePropertiesNonEditable;
22688
22689
  exports2.mergeCollection = mergeCollection;
22689
22690
  exports2.mergeDeep = mergeDeep;
22690
- exports2.openWebsiteAction = openWebsiteAction;
22691
+ exports2.mergeEntityActions = mergeEntityActions;
22691
22692
  exports2.pick = pick;
22692
22693
  exports2.plural = plural;
22693
22694
  exports2.printChanged = printChanged;