@firecms/core 3.0.0-beta.6 → 3.0.0-beta.8
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/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +17 -0
- package/dist/app/Scaffold.d.ts +30 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app/useApp.d.ts +16 -0
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/EntityPreview.d.ts +3 -2
- package/dist/components/ReferenceWidget.d.ts +3 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +5 -6
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +3 -5
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/EntityEditView.d.ts +17 -3
- package/dist/core/NavigationRoutes.d.ts +2 -2
- package/dist/core/index.d.ts +3 -4
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/StorageItemPreview.d.ts +4 -4
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
- package/dist/form/index.d.ts +0 -2
- package/dist/hooks/data/save.d.ts +1 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +10199 -10140
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +5 -0
- package/dist/preview/components/ReferencePreview.d.ts +2 -1
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/collections.d.ts +22 -1
- package/dist/types/datasource.d.ts +18 -8
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/plugins.d.ts +11 -3
- package/dist/types/properties.d.ts +15 -2
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/resolutions.d.ts +8 -8
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/package.json +130 -122
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/app/Scaffold.tsx +249 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +8 -10
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +9 -7
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +22 -15
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +9 -1
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -6
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +26 -24
- package/src/components/EntityPreview.tsx +9 -7
- package/src/components/EntityView.tsx +4 -4
- package/src/components/HomePage/NavigationCard.tsx +2 -2
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/ReferenceWidget.tsx +21 -11
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +4 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +4 -1
- package/src/components/VirtualTable/VirtualTable.tsx +13 -12
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +6 -6
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
- package/src/components/common/index.ts +1 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/common/types.tsx +3 -5
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +2 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -36
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +673 -134
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +36 -40
- package/src/core/NavigationRoutes.tsx +6 -7
- package/src/core/field_configs.tsx +1 -1
- package/src/core/index.tsx +3 -4
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +29 -7
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +20 -11
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
- package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +10 -39
- package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
- package/src/form/index.tsx +4 -4
- package/src/form/validation.ts +1 -17
- package/src/hooks/data/save.ts +2 -1
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +2 -3
- package/src/hooks/useBuildNavigationController.tsx +1 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +15 -15
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +12 -0
- package/src/internal/useBuildSideEntityController.tsx +72 -11
- package/src/preview/PropertyPreview.tsx +7 -4
- package/src/preview/PropertyPreviewProps.tsx +6 -0
- package/src/preview/components/BooleanPreview.tsx +2 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +22 -22
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/types/auth.tsx +1 -1
- package/src/types/collections.ts +28 -2
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +20 -16
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/fields.tsx +33 -33
- package/src/types/navigation.ts +1 -2
- package/src/types/plugins.tsx +12 -3
- package/src/types/properties.ts +17 -2
- package/src/types/storage.ts +1 -1
- package/src/util/entities.ts +4 -3
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +1 -0
- package/src/util/resolutions.ts +32 -31
- package/src/util/storage.ts +75 -21
- package/src/util/useStorageUploadController.tsx +21 -3
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/Drawer.d.ts +0 -23
- package/dist/core/Scaffold.d.ts +0 -55
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/form/EntityForm.d.ts +0 -77
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/src/core/Drawer.tsx +0 -191
- package/src/core/Scaffold.tsx +0 -281
- package/src/core/SideEntityView.tsx +0 -38
- package/src/form/EntityForm.tsx +0 -728
- package/src/internal/useBuildCustomizationController.tsx +0 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { ImagePreview } from "./ImagePreview";
|
|
4
4
|
import { getThumbnailMeasure } from "../util";
|
|
5
5
|
import { PreviewType } from "../../types";
|
|
6
6
|
import { PreviewSize } from "../PropertyPreviewProps";
|
|
7
|
-
import { DescriptionIcon, OpenInNewIcon, Tooltip, Typography } from "@firecms/ui";
|
|
7
|
+
import { cls, DescriptionIcon, OpenInNewIcon, Tooltip, Typography } from "@firecms/ui";
|
|
8
8
|
import { EmptyValue } from "./EmptyValue";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -14,12 +14,15 @@ export function UrlComponentPreview({
|
|
|
14
14
|
url,
|
|
15
15
|
previewType,
|
|
16
16
|
size,
|
|
17
|
-
hint
|
|
17
|
+
hint,
|
|
18
|
+
interactive = true
|
|
18
19
|
}: {
|
|
19
20
|
url: string,
|
|
20
21
|
previewType?: PreviewType,
|
|
21
22
|
size: PreviewSize,
|
|
22
|
-
hint?: string
|
|
23
|
+
hint?: string,
|
|
24
|
+
// for video controls
|
|
25
|
+
interactive?: boolean
|
|
23
26
|
}): React.ReactElement {
|
|
24
27
|
|
|
25
28
|
if (!previewType) {
|
|
@@ -43,17 +46,13 @@ export function UrlComponentPreview({
|
|
|
43
46
|
size={size}/>;
|
|
44
47
|
} else if (previewType === "audio") {
|
|
45
48
|
return <audio controls
|
|
49
|
+
className={"max-w-100%"}
|
|
46
50
|
src={url}>
|
|
47
51
|
Your browser does not support the
|
|
48
52
|
<code>audio</code> element.
|
|
49
53
|
</audio>;
|
|
50
54
|
} else if (previewType === "video") {
|
|
51
|
-
return <
|
|
52
|
-
className={`max-w-${size === "small" ? "sm" : "md"}`}
|
|
53
|
-
controls
|
|
54
|
-
>
|
|
55
|
-
<source src={url}/>
|
|
56
|
-
</video>;
|
|
55
|
+
return <VideoPreview size={size} src={url} interactive={interactive}/>;
|
|
57
56
|
} else {
|
|
58
57
|
return (
|
|
59
58
|
<a
|
|
@@ -66,7 +65,7 @@ export function UrlComponentPreview({
|
|
|
66
65
|
width: getThumbnailMeasure(size),
|
|
67
66
|
height: getThumbnailMeasure(size)
|
|
68
67
|
}}>
|
|
69
|
-
<DescriptionIcon className="
|
|
68
|
+
<DescriptionIcon className="text-gray-700 dark:text-gray-300"/>
|
|
70
69
|
{hint &&
|
|
71
70
|
<Tooltip title={hint}>
|
|
72
71
|
<Typography
|
|
@@ -77,3 +76,37 @@ export function UrlComponentPreview({
|
|
|
77
76
|
);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
79
|
+
|
|
80
|
+
function VideoPreview({
|
|
81
|
+
size,
|
|
82
|
+
src,
|
|
83
|
+
interactive
|
|
84
|
+
}: { size: PreviewSize, src: string, interactive: boolean }) {
|
|
85
|
+
|
|
86
|
+
const imageSize = useMemo(() => {
|
|
87
|
+
if (size === "tiny")
|
|
88
|
+
return "140px";
|
|
89
|
+
else if (size === "small")
|
|
90
|
+
return "240px";
|
|
91
|
+
else if (size === "medium")
|
|
92
|
+
return "100%";
|
|
93
|
+
else throw new Error("Invalid size");
|
|
94
|
+
}, [size]);
|
|
95
|
+
|
|
96
|
+
const videoProps = {
|
|
97
|
+
controls: interactive
|
|
98
|
+
};
|
|
99
|
+
return <video
|
|
100
|
+
style={{
|
|
101
|
+
position: "relative",
|
|
102
|
+
objectFit: "cover",
|
|
103
|
+
width: imageSize,
|
|
104
|
+
minWidth: "140px",
|
|
105
|
+
// height: imageSize,
|
|
106
|
+
maxHeight: "100%"
|
|
107
|
+
}}
|
|
108
|
+
{...videoProps}
|
|
109
|
+
className={cls("max-w-100% rounded", { "pointer-events-none": !interactive })}>
|
|
110
|
+
<source src={src}/>
|
|
111
|
+
</video>;
|
|
112
|
+
}
|
|
@@ -18,7 +18,6 @@ export function ArrayOfReferencesPreview({
|
|
|
18
18
|
const property = resolveArrayProperty({
|
|
19
19
|
propertyKey,
|
|
20
20
|
property: inputProperty,
|
|
21
|
-
propertyValue: value,
|
|
22
21
|
fields: customizationController.propertyConfigs
|
|
23
22
|
});
|
|
24
23
|
|
|
@@ -43,6 +42,8 @@ export function ArrayOfReferencesPreview({
|
|
|
43
42
|
previewProperties={ofProperty.previewProperties}
|
|
44
43
|
size={childSize}
|
|
45
44
|
reference={reference}
|
|
45
|
+
includeId={ofProperty.includeId}
|
|
46
|
+
includeEntityLink={ofProperty.includeEntityLink}
|
|
46
47
|
/>
|
|
47
48
|
</div>;
|
|
48
49
|
}
|
|
@@ -4,7 +4,7 @@ import { ResolvedProperty } from "../../types";
|
|
|
4
4
|
import { useCustomizationController } from "../../hooks";
|
|
5
5
|
import { PreviewSize, PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
6
6
|
import { PropertyPreview } from "../PropertyPreview";
|
|
7
|
-
import {
|
|
7
|
+
import { cls, defaultBorderMixin } from "@firecms/ui";
|
|
8
8
|
import { DEFAULT_ONE_OF_TYPE, DEFAULT_ONE_OF_VALUE } from "../../util/common";
|
|
9
9
|
import { ErrorBoundary } from "../../components";
|
|
10
10
|
|
|
@@ -23,7 +23,6 @@ export function ArrayOneOfPreview({
|
|
|
23
23
|
const property = resolveArrayProperty({
|
|
24
24
|
propertyKey,
|
|
25
25
|
property: inputProperty,
|
|
26
|
-
propertyValue: value,
|
|
27
26
|
fields: customizationController.propertyConfigs
|
|
28
27
|
});
|
|
29
28
|
|
|
@@ -50,7 +49,7 @@ export function ArrayOneOfPreview({
|
|
|
50
49
|
values.map((value, index) =>
|
|
51
50
|
<React.Fragment
|
|
52
51
|
key={"preview_array_" + value + "_" + index}>
|
|
53
|
-
<div className={
|
|
52
|
+
<div className={cls(defaultBorderMixin, "m-1 border-b last:border-b-0")}>
|
|
54
53
|
<ErrorBoundary>
|
|
55
54
|
{value && <PropertyPreview
|
|
56
55
|
propertyKey={propertyKey}
|
|
@@ -5,7 +5,7 @@ import { ResolvedProperty } from "../../types";
|
|
|
5
5
|
import { useCustomizationController } from "../../hooks";
|
|
6
6
|
import { PreviewSize, PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
7
7
|
import { PropertyPreview } from "../PropertyPreview";
|
|
8
|
-
import {
|
|
8
|
+
import { cls, defaultBorderMixin } from "@firecms/ui";
|
|
9
9
|
import { ErrorBoundary } from "../../components";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -23,7 +23,6 @@ export function ArrayPropertyPreview({
|
|
|
23
23
|
const property = resolveArrayProperty({
|
|
24
24
|
propertyKey,
|
|
25
25
|
property: inputProperty,
|
|
26
|
-
propertyValue: value,
|
|
27
26
|
fields: customizationController.propertyConfigs
|
|
28
27
|
});
|
|
29
28
|
|
|
@@ -49,7 +48,7 @@ export function ArrayPropertyPreview({
|
|
|
49
48
|
return of
|
|
50
49
|
? <React.Fragment
|
|
51
50
|
key={"preview_array_" + index}>
|
|
52
|
-
<div className={
|
|
51
|
+
<div className={cls(defaultBorderMixin, "m-1 border-b last:border-b-0")}>
|
|
53
52
|
<ErrorBoundary>
|
|
54
53
|
<PropertyPreview
|
|
55
54
|
propertyKey={propertyKey}
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { ResolvedMapProperty } from "../../types";
|
|
4
4
|
import { PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
5
5
|
import { PropertyPreview } from "../PropertyPreview";
|
|
6
|
-
import {
|
|
6
|
+
import { cls, defaultBorderMixin, Typography } from "@firecms/ui";
|
|
7
7
|
import { ErrorBoundary } from "../../components";
|
|
8
8
|
import { EmptyValue } from "../components/EmptyValue";
|
|
9
9
|
|
|
@@ -61,7 +61,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
61
61
|
return (
|
|
62
62
|
<div
|
|
63
63
|
key={`map_preview_table_${key}}`}
|
|
64
|
-
className={
|
|
64
|
+
className={cls(defaultBorderMixin, "last:border-b-0 border-b")}>
|
|
65
65
|
<div
|
|
66
66
|
className={"flex flex-row pt-0.5 pb-0.5 gap-2"}>
|
|
67
67
|
<div
|
|
@@ -87,7 +87,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
87
87
|
</div>
|
|
88
88
|
|
|
89
89
|
{(childProperty.dataType === "map" || childProperty === "array") &&
|
|
90
|
-
<div className={
|
|
90
|
+
<div className={cls(defaultBorderMixin, "border-l pl-4 ml-2 my-2")}>
|
|
91
91
|
<PropertyPreview
|
|
92
92
|
propertyKey={key}
|
|
93
93
|
value={(value)[key]}
|
|
@@ -113,7 +113,7 @@ export function KeyValuePreview({ value }: { value: any }) {
|
|
|
113
113
|
Object.entries(value).map(([key, childValue]) => (
|
|
114
114
|
<div
|
|
115
115
|
key={`map_preview_table_${key}}`}
|
|
116
|
-
className={
|
|
116
|
+
className={cls(defaultBorderMixin, "last:border-b-0 border-b")}>
|
|
117
117
|
<div
|
|
118
118
|
className={"flex flex-row pt-0.5 pb-0.5 gap-2"}>
|
|
119
119
|
<div
|
|
@@ -135,7 +135,7 @@ export function KeyValuePreview({ value }: { value: any }) {
|
|
|
135
135
|
</div>
|
|
136
136
|
</div>
|
|
137
137
|
{typeof childValue === "object" &&
|
|
138
|
-
<div className={
|
|
138
|
+
<div className={cls(defaultBorderMixin, "border-l pl-4")}>
|
|
139
139
|
<KeyValuePreview value={childValue}/>
|
|
140
140
|
</div>
|
|
141
141
|
}
|
|
@@ -6,7 +6,7 @@ import { PreviewType } from "../../types";
|
|
|
6
6
|
import { UrlComponentPreview } from "../components/UrlComponentPreview";
|
|
7
7
|
import { PropertyPreviewProps } from "../PropertyPreviewProps";
|
|
8
8
|
import { ErrorBoundary } from "../../components";
|
|
9
|
-
import { Chip,
|
|
9
|
+
import { Chip, cls, getColorSchemeForSeed } from "@firecms/ui";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @group Preview components
|
|
@@ -45,7 +45,7 @@ export function StringPropertyPreview({
|
|
|
45
45
|
if (!value) return <></>;
|
|
46
46
|
const lines = value.split("\n");
|
|
47
47
|
return value && value.includes("\n")
|
|
48
|
-
? <div className={
|
|
48
|
+
? <div className={cls("overflow-x-scroll", size === "tiny" ? "text-sm" : "")}>
|
|
49
49
|
{lines.map((str, index) =>
|
|
50
50
|
<React.Fragment key={`string_preview_${index}`}>
|
|
51
51
|
<span>{str}</span>
|
package/src/types/auth.tsx
CHANGED
package/src/types/collections.ts
CHANGED
|
@@ -112,7 +112,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
112
112
|
* `hidden` in the property definition,will be ignored.
|
|
113
113
|
* `propertiesOrder` has precedence over `hidden`.
|
|
114
114
|
*/
|
|
115
|
-
propertiesOrder?: Extract<keyof M, string>[];
|
|
115
|
+
propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* If enabled, content is loaded in batches. If `false` all entities in the
|
|
@@ -294,7 +294,16 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
294
294
|
* are writing custom code
|
|
295
295
|
*/
|
|
296
296
|
ownerId?: string;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Overrides for the entity view, like the data source or the storage source.
|
|
300
|
+
*/
|
|
297
301
|
overrides?: EntityOverrides;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Width of the side dialog (in pixels) when opening an entity in this collection.
|
|
305
|
+
*/
|
|
306
|
+
sideDialogWidth?: number | string;
|
|
298
307
|
}
|
|
299
308
|
|
|
300
309
|
/**
|
|
@@ -455,7 +464,10 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
|
|
|
455
464
|
* view.
|
|
456
465
|
* @param entity
|
|
457
466
|
*/
|
|
458
|
-
value?: (props: {
|
|
467
|
+
value?: (props: {
|
|
468
|
+
entity: Entity<M>,
|
|
469
|
+
context: FireCMSContext<any>
|
|
470
|
+
}) => string | number | Promise<string | number> | undefined;
|
|
459
471
|
}
|
|
460
472
|
|
|
461
473
|
/**
|
|
@@ -465,8 +477,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
|
|
|
465
477
|
*/
|
|
466
478
|
export type EntityCustomView<M extends Record<string, any> = any> =
|
|
467
479
|
{
|
|
480
|
+
/**
|
|
481
|
+
* Key of this custom view.
|
|
482
|
+
*/
|
|
468
483
|
key: string,
|
|
484
|
+
/**
|
|
485
|
+
* Name of this custom view.
|
|
486
|
+
*/
|
|
469
487
|
name: string,
|
|
488
|
+
/**
|
|
489
|
+
* If set to true, the actions of the entity will be included in the
|
|
490
|
+
* bottom of the panel (save buttons, delete buttons, etc.)
|
|
491
|
+
*/
|
|
492
|
+
includeActions?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* Builder for rendering the custom view
|
|
495
|
+
*/
|
|
470
496
|
Builder?: React.ComponentType<EntityCustomViewParams<M>>;
|
|
471
497
|
}
|
|
472
498
|
|
package/src/types/datasource.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Entity, EntityReference, EntityStatus, EntityValues, GeoPoint } from "./entities";
|
|
2
2
|
import { EntityCollection, FilterValues } from "./collections";
|
|
3
3
|
import { ResolvedEntityCollection } from "./resolved_entities";
|
|
4
|
+
import { FireCMSContext } from "./firecms_context";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @group Datasource
|
|
@@ -217,6 +218,18 @@ export interface DataSource {
|
|
|
217
218
|
*/
|
|
218
219
|
isFilterCombinationValid?(props: FilterCombinationValidProps): boolean;
|
|
219
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Called when the user clicks on the search bar in a collection view.
|
|
223
|
+
* Useful for initializing a text search index.
|
|
224
|
+
* @param props
|
|
225
|
+
*/
|
|
226
|
+
initTextSearch?: (props: {
|
|
227
|
+
context: FireCMSContext,
|
|
228
|
+
path: string,
|
|
229
|
+
collection: EntityCollection,
|
|
230
|
+
parentCollectionIds?: string[]
|
|
231
|
+
}) => Promise<boolean>;
|
|
232
|
+
|
|
220
233
|
}
|
|
221
234
|
|
|
222
235
|
export type FilterCombinationValidProps = {
|
|
@@ -363,30 +376,21 @@ export interface DataSourceDelegate {
|
|
|
363
376
|
*/
|
|
364
377
|
isFilterCombinationValid?(props: Omit<FilterCombinationValidProps, "collection">): boolean;
|
|
365
378
|
|
|
366
|
-
/**
|
|
367
|
-
* Convert a FireCMS reference to a reference that can be used by the datasource
|
|
368
|
-
* @param reference
|
|
369
|
-
*/
|
|
370
|
-
// buildReference: (reference: EntityReference) => any,
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
|
|
374
|
-
* @param geoPoint
|
|
375
|
-
*/
|
|
376
|
-
// buildGeoPoint: (geoPoint: GeoPoint) => any,
|
|
377
|
-
|
|
378
379
|
/**
|
|
379
380
|
* Get the object to generate the current time in the datasource
|
|
380
381
|
*/
|
|
381
382
|
currentTime(): any;
|
|
382
383
|
|
|
383
|
-
// buildDate: (date: Date) => any;
|
|
384
|
-
|
|
385
|
-
// buildDeleteFieldValue: () => any;
|
|
386
|
-
|
|
387
384
|
delegateToCMSModel: (data: any) => any;
|
|
388
385
|
|
|
389
386
|
cmsToDelegateModel: (data: any) => any;
|
|
390
387
|
|
|
391
388
|
setDateToMidnight: (input?: any) => any;
|
|
389
|
+
|
|
390
|
+
initTextSearch?: (props: {
|
|
391
|
+
context: FireCMSContext,
|
|
392
|
+
path: string,
|
|
393
|
+
collection: EntityCollection,
|
|
394
|
+
parentCollectionIds?: string[]
|
|
395
|
+
}) => Promise<boolean>;
|
|
392
396
|
}
|
|
@@ -4,11 +4,26 @@ import { Entity } from "./entities";
|
|
|
4
4
|
import { EntityCollection, SelectionController } from "./collections";
|
|
5
5
|
import { User } from "./user";
|
|
6
6
|
import { SideEntityController } from "./side_entity_controller";
|
|
7
|
-
import { EntityOverrides } from "./entity_overrides";
|
|
8
7
|
|
|
8
|
+
/**
|
|
9
|
+
* An entity action is a custom action that can be performed on an entity.
|
|
10
|
+
* They are displayed in the entity view and in the collection view.
|
|
11
|
+
*/
|
|
9
12
|
export type EntityAction<M extends object = any, UserType extends User = User> = {
|
|
13
|
+
/**
|
|
14
|
+
* Title of the action
|
|
15
|
+
*/
|
|
10
16
|
name: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Icon of the action
|
|
20
|
+
*/
|
|
11
21
|
icon?: React.ReactElement;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Callback when the action is clicked
|
|
25
|
+
* @param props
|
|
26
|
+
*/
|
|
12
27
|
onClick: (props: EntityActionClickProps<M, UserType>) => Promise<void> | void;
|
|
13
28
|
|
|
14
29
|
/**
|
|
@@ -25,8 +40,6 @@ export type EntityAction<M extends object = any, UserType extends User = User> =
|
|
|
25
40
|
|
|
26
41
|
}
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
|
|
30
43
|
export type EntityActionClickProps<M extends object, UserType extends User = User> = {
|
|
31
44
|
entity: Entity<M>;
|
|
32
45
|
context: FireCMSContext<UserType>;
|
package/src/types/fields.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EntityValues } from "./entities";
|
|
2
1
|
import { CMSType, PropertyOrBuilder } from "./properties";
|
|
3
2
|
import { ResolvedEntityCollection, ResolvedProperty } from "./resolved_entities";
|
|
3
|
+
import { FormexController } from "@firecms/formex";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* When building a custom field you need to create a React component that takes
|
|
@@ -21,11 +21,6 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
21
21
|
*/
|
|
22
22
|
value: T;
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Initial value of this field
|
|
26
|
-
*/
|
|
27
|
-
// initialValue: T | undefined;
|
|
28
|
-
|
|
29
24
|
/**
|
|
30
25
|
* Set value of field directly
|
|
31
26
|
*/
|
|
@@ -42,7 +37,7 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
42
37
|
/**
|
|
43
38
|
* Is the form currently submitting
|
|
44
39
|
*/
|
|
45
|
-
isSubmitting
|
|
40
|
+
isSubmitting?: boolean;
|
|
46
41
|
|
|
47
42
|
/**
|
|
48
43
|
* Should this field show the error indicator.
|
|
@@ -50,19 +45,19 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
50
45
|
* filled) but we don't want to show the error until the user has tried
|
|
51
46
|
* saving.
|
|
52
47
|
*/
|
|
53
|
-
showError
|
|
48
|
+
showError?: boolean;
|
|
54
49
|
|
|
55
50
|
/**
|
|
56
51
|
* Is there an error in this field. The error field has the same shape as
|
|
57
52
|
* the field, replacing values with a string containing the error.
|
|
58
53
|
* It takes the value `null` if there is no error
|
|
59
54
|
*/
|
|
60
|
-
error
|
|
55
|
+
error?: any | null;
|
|
61
56
|
|
|
62
57
|
/**
|
|
63
58
|
* Has this field been touched
|
|
64
59
|
*/
|
|
65
|
-
touched
|
|
60
|
+
touched?: boolean;
|
|
66
61
|
|
|
67
62
|
/**
|
|
68
63
|
* Property related to this field
|
|
@@ -72,38 +67,38 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
72
67
|
/**
|
|
73
68
|
* Should this field include a description
|
|
74
69
|
*/
|
|
75
|
-
includeDescription
|
|
70
|
+
includeDescription?: boolean;
|
|
76
71
|
|
|
77
72
|
/**
|
|
78
73
|
* Flag to indicate that the underlying value has been updated in the
|
|
79
74
|
* datasource
|
|
80
75
|
*/
|
|
81
|
-
underlyingValueHasChanged
|
|
76
|
+
underlyingValueHasChanged?: boolean;
|
|
82
77
|
|
|
83
78
|
/**
|
|
84
79
|
* Is this field part of an array
|
|
85
80
|
*/
|
|
86
|
-
partOfArray
|
|
81
|
+
partOfArray?: boolean;
|
|
87
82
|
|
|
88
83
|
/**
|
|
89
84
|
* Is this field part of a block (oneOf array)
|
|
90
85
|
*/
|
|
91
|
-
partOfBlock
|
|
86
|
+
partOfBlock?: boolean;
|
|
92
87
|
|
|
93
88
|
/**
|
|
94
89
|
* Is this field being rendered in the entity table popup
|
|
95
90
|
*/
|
|
96
|
-
tableMode
|
|
91
|
+
tableMode?: boolean;
|
|
97
92
|
|
|
98
93
|
/**
|
|
99
94
|
* Should this field autofocus on mount
|
|
100
95
|
*/
|
|
101
|
-
autoFocus
|
|
96
|
+
autoFocus?: boolean;
|
|
102
97
|
|
|
103
98
|
/**
|
|
104
99
|
* Additional properties set by the developer
|
|
105
100
|
*/
|
|
106
|
-
customProps
|
|
101
|
+
customProps?: CustomProps
|
|
107
102
|
|
|
108
103
|
/**
|
|
109
104
|
* Additional values related to the state of the form or the entity
|
|
@@ -113,7 +108,7 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
113
108
|
/**
|
|
114
109
|
* Flag to indicate if this field should be disabled
|
|
115
110
|
*/
|
|
116
|
-
disabled
|
|
111
|
+
disabled?: boolean;
|
|
117
112
|
|
|
118
113
|
}
|
|
119
114
|
|
|
@@ -124,37 +119,42 @@ export interface FieldProps<T extends CMSType = any, CustomProps = any, M extend
|
|
|
124
119
|
export interface FormContext<M extends Record<string, any> = any> {
|
|
125
120
|
|
|
126
121
|
/**
|
|
127
|
-
*
|
|
122
|
+
* Current values of the entity
|
|
128
123
|
*/
|
|
129
|
-
|
|
124
|
+
values: M;
|
|
130
125
|
|
|
131
126
|
/**
|
|
132
|
-
*
|
|
127
|
+
* Update the value of a field
|
|
128
|
+
* @param key
|
|
129
|
+
* @param value
|
|
130
|
+
* @param shouldValidate
|
|
133
131
|
*/
|
|
134
|
-
|
|
132
|
+
setFieldValue: (key: string, value: any, shouldValidate?: boolean) => void;
|
|
135
133
|
|
|
136
134
|
/**
|
|
137
|
-
*
|
|
135
|
+
* Save the entity.
|
|
138
136
|
*/
|
|
139
|
-
|
|
137
|
+
save: (values: M) => void;
|
|
140
138
|
|
|
141
139
|
/**
|
|
142
|
-
*
|
|
140
|
+
* Collection of the entity being modified
|
|
143
141
|
*/
|
|
144
|
-
|
|
142
|
+
collection?: ResolvedEntityCollection<M>;
|
|
145
143
|
|
|
146
144
|
/**
|
|
147
|
-
*
|
|
148
|
-
* @param key
|
|
149
|
-
* @param value
|
|
150
|
-
* @param shouldValidate
|
|
145
|
+
* Entity id, it can be null if it's a new entity
|
|
151
146
|
*/
|
|
152
|
-
|
|
147
|
+
entityId?: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Path this entity is located at
|
|
151
|
+
*/
|
|
152
|
+
path?: string;
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
155
|
+
* This is the underlying formex controller that powers the form
|
|
156
156
|
*/
|
|
157
|
-
|
|
157
|
+
formex: FormexController<M>;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
package/src/types/navigation.ts
CHANGED
|
@@ -57,10 +57,9 @@ export type NavigationController<EC extends EntityCollection = EntityCollection<
|
|
|
57
57
|
* The collection is resolved from the given path or alias.
|
|
58
58
|
*/
|
|
59
59
|
getCollection: (pathOrId: string,
|
|
60
|
-
entityId?: string,
|
|
61
60
|
includeUserOverride?: boolean) => EC | undefined;
|
|
62
61
|
/**
|
|
63
|
-
* Get the collection configuration from its parent
|
|
62
|
+
* Get the collection configuration from its parent ids.
|
|
64
63
|
*/
|
|
65
64
|
getCollectionFromIds: (ids: string[]) => EC | undefined;
|
|
66
65
|
|
package/src/types/plugins.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
2
|
|
|
3
3
|
import { FireCMSContext } from "./firecms_context";
|
|
4
|
-
import { CollectionActionsProps, EntityCollection } from "./collections";
|
|
4
|
+
import { CollectionActionsProps, EntityCollection, EntityTableController } from "./collections";
|
|
5
5
|
import { User } from "./user";
|
|
6
6
|
import { FieldProps, FormContext } from "./fields";
|
|
7
7
|
import { CMSType, Property } from "./properties";
|
|
@@ -98,6 +98,13 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
98
98
|
CollectionActionsStart?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_START__PROPS>[];
|
|
99
99
|
collectionActionsStartProps?: COL_ACTIONS_START__PROPS;
|
|
100
100
|
|
|
101
|
+
blockSearch?: (props: {
|
|
102
|
+
context: FireCMSContext,
|
|
103
|
+
path: string,
|
|
104
|
+
collection: EC,
|
|
105
|
+
parentCollectionIds?: string[]
|
|
106
|
+
}) => boolean;
|
|
107
|
+
|
|
101
108
|
showTextSearchBar?: (props: {
|
|
102
109
|
context: FireCMSContext,
|
|
103
110
|
path: string,
|
|
@@ -123,6 +130,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
123
130
|
parentCollectionIds: string[],
|
|
124
131
|
onHover: boolean,
|
|
125
132
|
collection: EC;
|
|
133
|
+
tableController: EntityTableController;
|
|
126
134
|
}>;
|
|
127
135
|
|
|
128
136
|
/**
|
|
@@ -133,6 +141,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
|
|
|
133
141
|
fullPath: string,
|
|
134
142
|
parentCollectionIds: string[],
|
|
135
143
|
collection: EC;
|
|
144
|
+
tableController: EntityTableController;
|
|
136
145
|
}>;
|
|
137
146
|
}
|
|
138
147
|
|
|
@@ -194,8 +203,8 @@ export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Reco
|
|
|
194
203
|
property: Property<T> | ResolvedProperty<T>;
|
|
195
204
|
Field: React.ComponentType<FieldProps<T, any, M>>;
|
|
196
205
|
plugin: FireCMSPlugin;
|
|
197
|
-
path
|
|
198
|
-
collection
|
|
206
|
+
path?: string;
|
|
207
|
+
collection?: EC;
|
|
199
208
|
};
|
|
200
209
|
|
|
201
210
|
export interface PluginGenericProps<UserType extends User = User> {
|