@firecms/core 3.0.0-canary.161 → 3.0.0-canary.163
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 +18 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +18 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +2 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -1
- package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
- package/src/components/EntityPreview.tsx +9 -5
- package/src/core/EntityEditView.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
package/dist/index.es.js
CHANGED
|
@@ -5577,10 +5577,10 @@ function EntityPreview({
|
|
|
5577
5577
|
const titleProperty = getEntityTitlePropertyKey(resolvedCollection, customizationController.propertyConfigs);
|
|
5578
5578
|
const imagePropertyKey = getEntityImagePreviewPropertyKey(resolvedCollection);
|
|
5579
5579
|
const imageProperty = imagePropertyKey ? resolvedCollection.properties[imagePropertyKey] : void 0;
|
|
5580
|
-
const usedImageProperty = "of" in imageProperty ? imageProperty.of : imageProperty;
|
|
5580
|
+
const usedImageProperty = imageProperty && "of" in imageProperty ? imageProperty.of : imageProperty;
|
|
5581
5581
|
const restProperties = listProperties.filter((p) => p !== titleProperty && p !== imagePropertyKey);
|
|
5582
|
-
const imageValue = getValueInPath(entity.values, imagePropertyKey);
|
|
5583
|
-
const usedImageValue = "of" in imageProperty ? (imageValue ?? []).length > 0 ? imageValue[0] : void 0 : imageValue;
|
|
5582
|
+
const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : void 0;
|
|
5583
|
+
const usedImageValue = imageProperty !== void 0 ? "of" in imageProperty ? (imageValue ?? []).length > 0 ? imageValue[0] : void 0 : imageValue : void 0;
|
|
5584
5584
|
return /* @__PURE__ */ jsxs(EntityPreviewContainer, { onClick: disabled ? void 0 : onClick, hover: disabled ? void 0 : hover, size, children: [
|
|
5585
5585
|
/* @__PURE__ */ jsxs("div", { className: cls("flex w-10 h-10 ml-1 mr-2 shrink-0", size === "small" ? "my-0.5" : "m-2 self-start"), children: [
|
|
5586
5586
|
usedImageProperty && usedImageValue && /* @__PURE__ */ jsx(PropertyPreview, { property: usedImageProperty, propertyKey: imagePropertyKey, size: "small", value: usedImageValue }),
|
|
@@ -5590,11 +5590,11 @@ function EntityPreview({
|
|
|
5590
5590
|
"maxWidth": "calc(100% - 96px)"
|
|
5591
5591
|
}, children: [
|
|
5592
5592
|
size !== "small" && includeId && (entity ? /* @__PURE__ */ jsx("div", { className: "block whitespace-nowrap overflow-hidden truncate", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "disabled", className: "font-mono", children: entity.id }) }) : /* @__PURE__ */ jsx(Skeleton, {})),
|
|
5593
|
-
titleProperty && /* @__PURE__ */ jsx("div", { className: "my-0.5 text-sm font-medium", children: entity ? /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: titleProperty, value: getValueInPath(entity.values, titleProperty), property: resolvedCollection.properties[titleProperty], size: "large" }) : /* @__PURE__ */ jsx(SkeletonPropertyComponent, { property: resolvedCollection.properties[titleProperty], size: "large" }) }),
|
|
5593
|
+
titleProperty && /* @__PURE__ */ jsx("div", { className: "truncate my-0.5 text-sm font-medium", children: entity ? /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: titleProperty, value: getValueInPath(entity.values, titleProperty), property: resolvedCollection.properties[titleProperty], size: "large" }) : /* @__PURE__ */ jsx(SkeletonPropertyComponent, { property: resolvedCollection.properties[titleProperty], size: "large" }) }),
|
|
5594
5594
|
restProperties && restProperties.map((key) => {
|
|
5595
5595
|
const childProperty = resolvedCollection.properties[key];
|
|
5596
5596
|
if (!childProperty) return null;
|
|
5597
|
-
return /* @__PURE__ */ jsx("div", { className: restProperties.length > 1 ? "my-0.5" : "my-0", children: entity ? /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key, value: getValueInPath(entity.values, key), property: childProperty, size: "small" }) : /* @__PURE__ */ jsx(SkeletonPropertyComponent, { property: childProperty, size: "small" }) }, "ref_prev_" + key);
|
|
5597
|
+
return /* @__PURE__ */ jsx("div", { className: cls("truncate", restProperties.length > 1 ? "my-0.5" : "my-0"), children: entity ? /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key, value: getValueInPath(entity.values, key), property: childProperty, size: "small" }) : /* @__PURE__ */ jsx(SkeletonPropertyComponent, { property: childProperty, size: "small" }) }, "ref_prev_" + key);
|
|
5598
5598
|
})
|
|
5599
5599
|
] }),
|
|
5600
5600
|
entity && includeEntityLink && /* @__PURE__ */ jsx(Tooltip, { title: `See details for ${entity.id}`, className: "shrink-0", children: /* @__PURE__ */ jsx(IconButton, { color: "inherit", size: "medium", className: size !== "small" ? "self-start" : "", onClick: (e) => {
|
|
@@ -8852,7 +8852,6 @@ const EntityCollectionTable = function EntityCollectionTable2({
|
|
|
8852
8852
|
const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
|
|
8853
8853
|
const context = useFireCMSContext();
|
|
8854
8854
|
const [size, setSize] = React__default.useState(defaultSize ?? "m");
|
|
8855
|
-
const selectedEntityIds = selectedEntities?.map((e) => e.id);
|
|
8856
8855
|
const updateSize = useCallback((size_0) => {
|
|
8857
8856
|
if (onSizeChanged) onSizeChanged(size_0);
|
|
8858
8857
|
setSize(size_0);
|
|
@@ -8908,7 +8907,7 @@ const EntityCollectionTable = function EntityCollectionTable2({
|
|
|
8908
8907
|
context
|
|
8909
8908
|
})?.toString() });
|
|
8910
8909
|
return /* @__PURE__ */ jsx(EntityTableCell, { width, size, value: value_0, selected: false, disabled: true, align: "left", allowScroll: false, showExpandIcon: false, disabledTooltip: "This column can't be edited directly", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: child }) }, `additional_table_cell_${entity_0.id}_${column_0.key}`);
|
|
8911
|
-
}, [size
|
|
8910
|
+
}, [size]);
|
|
8912
8911
|
const collectionColumns = (() => {
|
|
8913
8912
|
const columnsResult = propertiesToColumns({
|
|
8914
8913
|
properties,
|
|
@@ -8958,14 +8957,14 @@ const EntityCollectionTable = function EntityCollectionTable2({
|
|
|
8958
8957
|
} else {
|
|
8959
8958
|
throw Error("Internal: columns not mapped properly");
|
|
8960
8959
|
}
|
|
8961
|
-
} catch (
|
|
8962
|
-
console.error("Error rendering cell",
|
|
8963
|
-
return /* @__PURE__ */ jsx(EntityTableCell, { size, width: column_1.width, saved: false, value: null, align: "left", fullHeight: false, disabled: true, children: /* @__PURE__ */ jsx(ErrorView, { error:
|
|
8960
|
+
} catch (e) {
|
|
8961
|
+
console.error("Error rendering cell", e);
|
|
8962
|
+
return /* @__PURE__ */ jsx(EntityTableCell, { size, width: column_1.width, saved: false, value: null, align: "left", fullHeight: false, disabled: true, children: /* @__PURE__ */ jsx(ErrorView, { error: e }) });
|
|
8964
8963
|
}
|
|
8965
8964
|
}, [tableRowActionsBuilder, additionalCellRenderer, propertyCellRenderer, size]);
|
|
8966
8965
|
return /* @__PURE__ */ jsxs("div", { ref, style, className: cls("h-full w-full flex flex-col bg-white dark:bg-surface-950", className), children: [
|
|
8967
8966
|
/* @__PURE__ */ jsx(CollectionTableToolbar, { onTextSearch: textSearchEnabled ? onTextSearch : void 0, textSearchLoading, onTextSearchClick: textSearchEnabled ? onTextSearchClick : void 0, size, onSizeChanged: updateSize, title, actionsStart, actions, loading: tableController.dataLoading }),
|
|
8968
|
-
/* @__PURE__ */ jsx(SelectableTable, { columns, size, inlineEditing, cellRenderer, onEntityClick, highlightedRow:
|
|
8967
|
+
/* @__PURE__ */ jsx(SelectableTable, { columns, size, inlineEditing, cellRenderer, onEntityClick, highlightedRow: (entity_1) => Boolean(selectedEntities?.find((e_0) => e_0.id === entity_1.id && e_0.path === entity_1.path)), tableController, onValueChange, onColumnResize, hoverRow, filterable, emptyComponent, endAdornment, AddColumnComponent })
|
|
8969
8968
|
] });
|
|
8970
8969
|
};
|
|
8971
8970
|
function useDataOrder({
|
|
@@ -9160,9 +9159,10 @@ function useSelectionController(onSelectionChange) {
|
|
|
9160
9159
|
const toggleEntitySelection = useCallback((entity, newSelectedState) => {
|
|
9161
9160
|
let newValue;
|
|
9162
9161
|
if (newSelectedState === void 0) {
|
|
9163
|
-
|
|
9162
|
+
const isSelected = Boolean(selectedEntities.find((e) => e.id === entity.id && e.path === entity.path));
|
|
9163
|
+
if (isSelected) {
|
|
9164
9164
|
onSelectionChange?.(entity, false);
|
|
9165
|
-
newValue = selectedEntities.filter((item) => item.id
|
|
9165
|
+
newValue = selectedEntities.filter((item) => !(item.id === entity.id && item.path === entity.path));
|
|
9166
9166
|
} else {
|
|
9167
9167
|
onSelectionChange?.(entity, true);
|
|
9168
9168
|
newValue = [...selectedEntities, entity];
|
|
@@ -9173,13 +9173,13 @@ function useSelectionController(onSelectionChange) {
|
|
|
9173
9173
|
newValue = [...selectedEntities, entity];
|
|
9174
9174
|
} else {
|
|
9175
9175
|
onSelectionChange?.(entity, false);
|
|
9176
|
-
newValue = selectedEntities.filter((item_0) => item_0.id
|
|
9176
|
+
newValue = selectedEntities.filter((item_0) => !(item_0.id === entity.id && item_0.path === entity.path));
|
|
9177
9177
|
}
|
|
9178
9178
|
}
|
|
9179
9179
|
setSelectedEntities(newValue);
|
|
9180
9180
|
}, [selectedEntities]);
|
|
9181
9181
|
const isEntitySelected = useCallback((entity_0) => {
|
|
9182
|
-
return selectedEntities.
|
|
9182
|
+
return Boolean(selectedEntities.find((e_0) => e_0.id === entity_0.id && e_0.path === entity_0.path));
|
|
9183
9183
|
}, [selectedEntities]);
|
|
9184
9184
|
return {
|
|
9185
9185
|
selectedEntities,
|
|
@@ -11572,7 +11572,7 @@ function EntityEditViewInner({
|
|
|
11572
11572
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
11573
11573
|
/* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey: key_0, icon: /* @__PURE__ */ jsx(NotesIcon, { size: "small" }), title: additionalField.name, className: "text-text-secondary dark:text-text-secondary-dark ml-3.5" }),
|
|
11574
11574
|
/* @__PURE__ */ jsx("div", { className: cls(paperMixin, "min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"), children: /* @__PURE__ */ jsx(ErrorBoundary, { children: child }) })
|
|
11575
|
-
] });
|
|
11575
|
+
] }, `additional_${key_0}`);
|
|
11576
11576
|
}
|
|
11577
11577
|
console.warn(`Property ${key_0} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
|
|
11578
11578
|
return null;
|
|
@@ -12389,7 +12389,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
|
|
|
12389
12389
|
width: width_0,
|
|
12390
12390
|
frozen
|
|
12391
12391
|
}) => {
|
|
12392
|
-
const isSelected = usedSelectionController.selectedEntities.
|
|
12392
|
+
const isSelected = Boolean(usedSelectionController.selectedEntities.find((e_1) => e_1.id == entity_6.id && e_1.path == entity_6.path));
|
|
12393
12393
|
const actions_0 = getActionsForEntity({
|
|
12394
12394
|
entity: entity_6,
|
|
12395
12395
|
customEntityActions: collection.entityActions
|
|
@@ -15867,7 +15867,7 @@ function _temp$8(t0) {
|
|
|
15867
15867
|
return /* @__PURE__ */ jsxs("div", { className: cls(defaultBorderMixin, "last:border-b-0 border-b"), children: [
|
|
15868
15868
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
|
|
15869
15869
|
/* @__PURE__ */ jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-mono break-words", color: "secondary", children: key }) }, `table-cell-title-${key}-${key}`),
|
|
15870
|
-
/* @__PURE__ */ jsx("div", { className: "flex-grow max-w-[75%]", children: childValue &&
|
|
15870
|
+
/* @__PURE__ */ jsx("div", { className: "flex-grow max-w-[75%]", children: childValue && /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(ErrorBoundary, { children: childValue.toString() }) }) })
|
|
15871
15871
|
] }),
|
|
15872
15872
|
typeof childValue === "object" && /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "border-l pl-4"), children: /* @__PURE__ */ jsx(KeyValuePreview, { value: childValue }) })
|
|
15873
15873
|
] }, `map_preview_table_${key}}`);
|