@firecms/collection_editor 3.3.0 → 3.4.0-canary.0ef7442
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 +83 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +83 -19
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -7
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +2 -2
- package/src/ui/collection_editor/DisplaySettingsForm.tsx +105 -0
package/dist/index.umd.js
CHANGED
|
@@ -11487,6 +11487,30 @@
|
|
|
11487
11487
|
});
|
|
11488
11488
|
return result;
|
|
11489
11489
|
}, [resolvedCollection.properties]);
|
|
11490
|
+
const imageProperties = React.useMemo(() => {
|
|
11491
|
+
const result_0 = [];
|
|
11492
|
+
if (!resolvedCollection.properties) return result_0;
|
|
11493
|
+
const isImageProperty = (prop_0) => {
|
|
11494
|
+
if (!prop_0 || !("dataType" in prop_0)) return false;
|
|
11495
|
+
if (prop_0.dataType === "string") {
|
|
11496
|
+
return Boolean(prop_0.storage?.acceptedFiles?.includes("image/*")) || prop_0.url === "image";
|
|
11497
|
+
}
|
|
11498
|
+
if (prop_0.dataType === "array" && prop_0.of) {
|
|
11499
|
+
return isImageProperty(prop_0.of);
|
|
11500
|
+
}
|
|
11501
|
+
return false;
|
|
11502
|
+
};
|
|
11503
|
+
Object.entries(resolvedCollection.properties).forEach(([key_0, prop_1]) => {
|
|
11504
|
+
if (isImageProperty(prop_1)) {
|
|
11505
|
+
result_0.push({
|
|
11506
|
+
key: key_0,
|
|
11507
|
+
label: prop_1.name || key_0,
|
|
11508
|
+
property: prop_1
|
|
11509
|
+
});
|
|
11510
|
+
}
|
|
11511
|
+
});
|
|
11512
|
+
return result_0;
|
|
11513
|
+
}, [resolvedCollection.properties]);
|
|
11490
11514
|
if (typeof values.customId === "object") ;
|
|
11491
11515
|
else if (values.customId === true) ;
|
|
11492
11516
|
else if (values.customId === false) ;
|
|
@@ -11513,25 +11537,25 @@
|
|
|
11513
11537
|
")"
|
|
11514
11538
|
] });
|
|
11515
11539
|
}
|
|
11516
|
-
const
|
|
11517
|
-
if (!
|
|
11518
|
-
const fieldConfig = core.getFieldConfig(
|
|
11540
|
+
const prop_2 = numberProperties.find((p_0) => p_0.key === value_1);
|
|
11541
|
+
if (!prop_2) return t("select_a_property");
|
|
11542
|
+
const fieldConfig = core.getFieldConfig(prop_2.property, customizationController.propertyConfigs);
|
|
11519
11543
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11520
11544
|
/* @__PURE__ */ jsxRuntime.jsx(core.PropertyConfigBadge, { propertyConfig: fieldConfig }),
|
|
11521
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
11545
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: prop_2.label })
|
|
11522
11546
|
] });
|
|
11523
11547
|
}, endAdornment: values.orderProperty ? /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: (e) => {
|
|
11524
11548
|
e.stopPropagation();
|
|
11525
11549
|
setFieldValue("orderProperty", void 0);
|
|
11526
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: "small" }) }) : void 0, children: numberProperties.map((
|
|
11527
|
-
const fieldConfig_0 = core.getFieldConfig(
|
|
11528
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value:
|
|
11550
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: "small" }) }) : void 0, children: numberProperties.map((prop_3) => {
|
|
11551
|
+
const fieldConfig_0 = core.getFieldConfig(prop_3.property, customizationController.propertyConfigs);
|
|
11552
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: prop_3.key, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
11529
11553
|
/* @__PURE__ */ jsxRuntime.jsx(core.PropertyConfigBadge, { propertyConfig: fieldConfig_0 }),
|
|
11530
11554
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11531
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children:
|
|
11555
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: prop_3.label }),
|
|
11532
11556
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", children: fieldConfig_0?.name || t("number") })
|
|
11533
11557
|
] })
|
|
11534
|
-
] }) },
|
|
11558
|
+
] }) }, prop_3.key);
|
|
11535
11559
|
}) }, `order-select-${numberProperties.length}`),
|
|
11536
11560
|
/* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { error: orderPropertyMissing, children: orderPropertyMissing ? t("order_property_not_found", {
|
|
11537
11561
|
property: values.orderProperty ?? ""
|
|
@@ -11570,14 +11594,54 @@
|
|
|
11570
11594
|
] });
|
|
11571
11595
|
})()
|
|
11572
11596
|
] }),
|
|
11573
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12
|
|
11597
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 mt-4", children: (() => {
|
|
11598
|
+
const imagePropertyMissing = Boolean(values.imageProperty) && !imageProperties.some((p_2) => p_2.key === values.imageProperty);
|
|
11599
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11600
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", color: "secondary", className: "ml-3.5", children: t("image_property") }),
|
|
11601
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select, { name: "imageProperty", size: "large", fullWidth: true, position: "item-aligned", disabled: imageProperties.length === 0, error: imagePropertyMissing, value: values.imageProperty ?? "", onValueChange: (v_0) => {
|
|
11602
|
+
setFieldValue("imageProperty", v_0 || void 0);
|
|
11603
|
+
}, renderValue: (value_2) => {
|
|
11604
|
+
if (imagePropertyMissing) {
|
|
11605
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-red-500", children: [
|
|
11606
|
+
value_2,
|
|
11607
|
+
" (",
|
|
11608
|
+
t("not_found_suffix"),
|
|
11609
|
+
")"
|
|
11610
|
+
] });
|
|
11611
|
+
}
|
|
11612
|
+
const prop_4 = imageProperties.find((p_3) => p_3.key === value_2);
|
|
11613
|
+
if (!prop_4) return t("select_a_property");
|
|
11614
|
+
const fieldConfig_1 = core.getFieldConfig(prop_4.property, customizationController.propertyConfigs);
|
|
11615
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11616
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.PropertyConfigBadge, { propertyConfig: fieldConfig_1 }),
|
|
11617
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: prop_4.label })
|
|
11618
|
+
] });
|
|
11619
|
+
}, endAdornment: values.imageProperty ? /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: (e_0) => {
|
|
11620
|
+
e_0.stopPropagation();
|
|
11621
|
+
setFieldValue("imageProperty", void 0);
|
|
11622
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: "small" }) }) : void 0, children: imageProperties.map((prop_5) => {
|
|
11623
|
+
const fieldConfig_2 = core.getFieldConfig(prop_5.property, customizationController.propertyConfigs);
|
|
11624
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: prop_5.key, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
11625
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.PropertyConfigBadge, { propertyConfig: fieldConfig_2 }),
|
|
11626
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11627
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: prop_5.label }),
|
|
11628
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", children: fieldConfig_2?.name || prop_5.label })
|
|
11629
|
+
] })
|
|
11630
|
+
] }) }, prop_5.key);
|
|
11631
|
+
}) }, `image-select-${imageProperties.length}`),
|
|
11632
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { error: imagePropertyMissing, children: imagePropertyMissing ? t("image_property_not_found", {
|
|
11633
|
+
property: values.imageProperty ?? ""
|
|
11634
|
+
}) : imageProperties.length === 0 ? t("no_image_properties") : t("image_property_description") })
|
|
11635
|
+
] });
|
|
11636
|
+
})() }),
|
|
11637
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select, { name: "defaultSize", size: "large", fullWidth: true, label: t("default_row_size"), position: "item-aligned", onChange: handleChange, value: values.defaultSize ?? "", renderValue: (value_3) => value_3.toUpperCase(), children: ["xs", "s", "m", "l", "xl"].map((value_4) => /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: value_4, children: value_4.toUpperCase() }, `size-select-${value_4}`)) }) }),
|
|
11574
11638
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
|
|
11575
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "sideDialogWidth", type: "number", "aria-describedby": "sideDialogWidth-helper", onChange: (
|
|
11576
|
-
const
|
|
11577
|
-
if (!
|
|
11639
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TextField, { name: "sideDialogWidth", type: "number", "aria-describedby": "sideDialogWidth-helper", onChange: (e_1) => {
|
|
11640
|
+
const value_5 = e_1.target.value;
|
|
11641
|
+
if (!value_5) {
|
|
11578
11642
|
setFieldValue("sideDialogWidth", null);
|
|
11579
|
-
} else if (!isNaN(Number(
|
|
11580
|
-
setFieldValue("sideDialogWidth", Number(
|
|
11643
|
+
} else if (!isNaN(Number(value_5))) {
|
|
11644
|
+
setFieldValue("sideDialogWidth", Number(value_5));
|
|
11581
11645
|
}
|
|
11582
11646
|
}, endAdornment: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: () => {
|
|
11583
11647
|
setFieldValue("sideDialogWidth", null);
|
|
@@ -11585,11 +11649,11 @@
|
|
|
11585
11649
|
/* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t("side_dialog_width_description") })
|
|
11586
11650
|
] }),
|
|
11587
11651
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
|
|
11588
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.BooleanSwitchWithLabel, { position: "start", size: "large", label: values.inlineEditing === void 0 || values.inlineEditing ? t("inline_editing_enabled") : t("inline_editing_disabled"), onValueChange: (
|
|
11652
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.BooleanSwitchWithLabel, { position: "start", size: "large", label: values.inlineEditing === void 0 || values.inlineEditing ? t("inline_editing_enabled") : t("inline_editing_disabled"), onValueChange: (v_1) => setFieldValue("inlineEditing", v_1), value: values.inlineEditing === void 0 ? true : values.inlineEditing }),
|
|
11589
11653
|
/* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t("inline_editing_description") })
|
|
11590
11654
|
] }),
|
|
11591
11655
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "col-span-12", children: [
|
|
11592
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.BooleanSwitchWithLabel, { position: "start", size: "large", label: values.includeJsonView === void 0 || values.includeJsonView ? t("include_json_view") : t("no_json_view"), onValueChange: (
|
|
11656
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.BooleanSwitchWithLabel, { position: "start", size: "large", label: values.includeJsonView === void 0 || values.includeJsonView ? t("include_json_view") : t("no_json_view"), onValueChange: (v_2) => setFieldValue("includeJsonView", v_2), value: values.includeJsonView === void 0 ? true : values.includeJsonView }),
|
|
11593
11657
|
/* @__PURE__ */ jsxRuntime.jsx(core.FieldCaption, { children: t("json_view_description") })
|
|
11594
11658
|
] })
|
|
11595
11659
|
] }),
|
|
@@ -12151,7 +12215,7 @@
|
|
|
12151
12215
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { className: "mt-8 w-full", size: "large", onClick: () => setNewPropertyDialogOpen(true), startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), children: t("add_new_property") })
|
|
12152
12216
|
] }),
|
|
12153
12217
|
!asDialog && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sticky top-8 min-h-full w-full flex flex-col justify-center", children: [
|
|
12154
|
-
selectedPropertyFullId && selectedProperty && !core.isPropertyBuilder(selectedProperty) && /* @__PURE__ */ jsxRuntime.jsx(PropertyForm, { inArray: false, existingProperty: !isNewCollection, autoUpdateId: false, allowDataInference: !isNewCollection, autoOpenTypeSelect: false, propertyKey: selectedPropertyKey, propertyNamespace: selectedPropertyNamespace, property: selectedProperty, onPropertyChanged, onDelete: deleteProperty, onError: onPropertyErrorInternal, forceShowErrors: showErrors, initialErrors, getData, propertyConfigs, collectionEditable, collectionProperties: values.properties }, `edit_view_${
|
|
12218
|
+
selectedPropertyFullId && selectedProperty && !core.isPropertyBuilder(selectedProperty) && /* @__PURE__ */ jsxRuntime.jsx(PropertyForm, { inArray: false, existingProperty: !isNewCollection, autoUpdateId: false, allowDataInference: !isNewCollection, autoOpenTypeSelect: false, propertyKey: selectedPropertyKey, propertyNamespace: selectedPropertyNamespace, property: selectedProperty, onPropertyChanged, onDelete: deleteProperty, onError: onPropertyErrorInternal, forceShowErrors: showErrors, initialErrors, getData, propertyConfigs, collectionEditable, collectionProperties: values.properties }, `edit_view_${selectedPropertyFullId}_${generationCounter}`),
|
|
12155
12219
|
!selectedProperty && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
|
|
12156
12220
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", className: "", children: emptyCollection ? t("add_first_property") : t("select_property_to_edit") }),
|
|
12157
12221
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: () => setNewPropertyDialogOpen(true), children: [
|
|
@@ -12161,7 +12225,7 @@
|
|
|
12161
12225
|
] }),
|
|
12162
12226
|
selectedProperty && core.isPropertyBuilder(selectedProperty) && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", className: "flex items-center justify-center", children: t("property_defined_as_builder") })
|
|
12163
12227
|
] }) }),
|
|
12164
|
-
asDialog && /* @__PURE__ */ jsxRuntime.jsx(PropertyFormDialog, { inArray: false, open: selectedPropertyIndex !== void 0, autoUpdateId: !selectedProperty, allowDataInference: !isNewCollection, existingProperty: true, autoOpenTypeSelect: false, propertyKey: selectedPropertyKey, propertyNamespace: selectedPropertyNamespace, property: selectedProperty, onPropertyChanged, onDelete: deleteProperty, onError: onPropertyErrorInternal, forceShowErrors: showErrors, initialErrors, getData, propertyConfigs, collectionEditable, collectionProperties: values.properties, onCancel: closePropertyDialog, onOkClicked: asDialog ? closePropertyDialog : void 0 }, `edit_view_${
|
|
12228
|
+
asDialog && /* @__PURE__ */ jsxRuntime.jsx(PropertyFormDialog, { inArray: false, open: selectedPropertyIndex !== void 0, autoUpdateId: !selectedProperty, allowDataInference: !isNewCollection, existingProperty: true, autoOpenTypeSelect: false, propertyKey: selectedPropertyKey, propertyNamespace: selectedPropertyNamespace, property: selectedProperty, onPropertyChanged, onDelete: deleteProperty, onError: onPropertyErrorInternal, forceShowErrors: showErrors, initialErrors, getData, propertyConfigs, collectionEditable, collectionProperties: values.properties, onCancel: closePropertyDialog, onOkClicked: asDialog ? closePropertyDialog : void 0 }, `edit_view_${selectedPropertyFullId}_${generationCounter}`)
|
|
12165
12229
|
] });
|
|
12166
12230
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12167
12231
|
body,
|