@firecms/core 3.0.0-canary.1 → 3.0.0-canary.100
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/README.md +2 -2
- 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/CircularProgressCenter.d.ts +1 -1
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
- 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/CollectionTableToolbar.d.ts +1 -4
- 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/EntityCollectionView/EntityCollectionView.d.ts +13 -4
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
- package/dist/components/EntityPreview.d.ts +26 -7
- package/dist/components/EntityView.d.ts +11 -0
- package/dist/components/ErrorView.d.ts +1 -1
- package/dist/components/FieldCaption.d.ts +5 -0
- package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
- package/dist/components/HomePage/NavigationCard.d.ts +8 -0
- package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +3 -3
- package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
- package/dist/components/HomePage/index.d.ts +3 -1
- package/dist/components/ReferenceWidget.d.ts +6 -4
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +16 -13
- 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 +4 -6
- package/dist/components/common/useColumnsIds.d.ts +2 -1
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +6 -4
- package/dist/contexts/AuthControllerContext.d.ts +1 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/EntityEditView.d.ts +36 -0
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/core/NavigationRoutes.d.ts +3 -3
- package/dist/core/index.d.ts +3 -6
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/StorageItemPreview.d.ts +4 -3
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/form/components/index.d.ts +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
- package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
- package/dist/form/index.d.ts +1 -2
- package/dist/form/validation.d.ts +1 -1
- package/dist/hooks/data/delete.d.ts +2 -2
- package/dist/hooks/data/save.d.ts +2 -3
- package/dist/hooks/data/useDataSource.d.ts +2 -2
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/index.d.ts +4 -1
- package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
- package/dist/hooks/useBuildNavigationController.d.ts +6 -4
- package/dist/hooks/useProjectLog.d.ts +6 -2
- package/dist/hooks/useStorageSource.d.ts +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +16400 -12423
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19713 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +1 -12
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +6 -4
- package/dist/preview/components/BooleanPreview.d.ts +5 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +3 -8
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +38 -2
- package/dist/types/collections.d.ts +45 -8
- package/dist/types/datasource.d.ts +34 -20
- package/dist/types/entities.d.ts +6 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/entity_callbacks.d.ts +2 -2
- package/dist/types/entity_overrides.d.ts +6 -0
- package/dist/types/fields.d.ts +36 -30
- package/dist/types/index.d.ts +2 -1
- package/dist/types/navigation.d.ts +15 -14
- package/dist/types/permissions.d.ts +5 -1
- package/dist/types/plugins.d.ts +31 -23
- package/dist/types/properties.d.ts +34 -21
- package/dist/types/property_config.d.ts +2 -2
- package/dist/types/roles.d.ts +31 -0
- package/dist/types/storage.d.ts +11 -3
- package/dist/types/user.d.ts +5 -0
- package/dist/util/collections.d.ts +9 -1
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_list.d.ts +5 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +9 -3
- package/dist/util/index.d.ts +1 -0
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/references.d.ts +4 -2
- package/dist/util/resolutions.d.ts +15 -14
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/dist/util/useTraceUpdate.d.ts +1 -0
- package/package.json +128 -119
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/app/Scaffold.tsx +251 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/ArrayContainer.tsx +1 -1
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/DeleteEntityDialog.tsx +4 -4
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +11 -21
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -279
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +49 -45
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +20 -18
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +17 -9
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +95 -92
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +42 -0
- package/src/components/EntityPreview.tsx +210 -70
- package/src/components/EntityView.tsx +84 -0
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/FieldCaption.tsx +14 -0
- package/src/components/HomePage/DefaultHomePage.tsx +37 -24
- package/src/components/HomePage/NavigationCard.tsx +69 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
- package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
- package/src/components/HomePage/index.tsx +3 -1
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +4 -4
- package/src/components/ReferenceWidget.tsx +26 -16
- package/src/components/SearchIconsView.tsx +9 -6
- package/src/components/SelectableTable/SelectableTable.tsx +7 -7
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +38 -24
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
- package/src/components/VirtualTable/VirtualTable.tsx +70 -37
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +19 -15
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +11 -7
- 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 +4 -6
- package/src/components/common/useColumnsIds.tsx +23 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -1
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +6 -4
- package/src/contexts/AuthControllerContext.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +60 -37
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +1130 -0
- package/src/core/EntitySidePanel.tsx +3 -4
- package/src/core/FireCMS.tsx +55 -44
- package/src/core/NavigationRoutes.tsx +15 -8
- package/src/core/SideDialogs.tsx +1 -0
- package/src/core/field_configs.tsx +2 -3
- package/src/core/index.tsx +3 -6
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +38 -9
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +21 -10
- package/src/form/components/StorageUploadProgress.tsx +9 -8
- package/src/form/components/index.tsx +1 -0
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +10 -8
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +18 -18
- package/src/form/field_bindings/BlockFieldBinding.tsx +4 -5
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +62 -57
- package/src/form/field_bindings/MapFieldBinding.tsx +28 -20
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +3 -4
- package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +4 -11
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +21 -17
- package/src/form/field_bindings/RepeatFieldBinding.tsx +14 -11
- package/src/form/field_bindings/SelectFieldBinding.tsx +5 -6
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +28 -40
- package/src/form/field_bindings/SwitchFieldBinding.tsx +3 -4
- package/src/form/field_bindings/TextFieldBinding.tsx +10 -9
- package/src/form/index.tsx +5 -4
- package/src/form/validation.ts +4 -21
- package/src/hooks/data/delete.ts +3 -3
- package/src/hooks/data/save.ts +4 -2
- package/src/hooks/data/useCollectionFetch.tsx +1 -1
- package/src/hooks/data/useDataSource.tsx +7 -2
- package/src/hooks/data/useEntityFetch.tsx +4 -4
- package/src/hooks/index.tsx +6 -1
- package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/{core → hooks}/useBuildModeController.tsx +12 -6
- package/src/hooks/useBuildNavigationController.tsx +208 -92
- package/src/hooks/useProjectLog.tsx +30 -9
- package/src/hooks/useReferenceDialog.tsx +2 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useStorageSource.tsx +7 -2
- package/src/hooks/useValidateAuthenticator.tsx +115 -0
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +56 -44
- package/src/internal/useBuildSideEntityController.tsx +88 -21
- package/src/preview/PropertyPreview.tsx +11 -18
- package/src/preview/PropertyPreviewProps.tsx +4 -8
- package/src/preview/components/BooleanPreview.tsx +19 -4
- package/src/preview/components/EnumValuesChip.tsx +2 -2
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +74 -166
- 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 +8 -7
- package/src/types/analytics.ts +1 -0
- package/src/types/auth.tsx +51 -2
- package/src/types/collections.ts +52 -8
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +41 -24
- package/src/types/entities.ts +13 -1
- package/src/types/entity_actions.tsx +17 -0
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/entity_overrides.tsx +7 -0
- package/src/types/fields.tsx +39 -33
- package/src/types/firecms.tsx +0 -1
- package/src/types/index.ts +2 -1
- package/src/types/navigation.ts +17 -17
- package/src/types/permissions.ts +6 -1
- package/src/types/plugins.tsx +38 -31
- package/src/types/properties.ts +40 -22
- package/src/types/property_config.tsx +2 -2
- package/src/types/roles.ts +41 -0
- package/src/types/side_entity_controller.tsx +1 -0
- package/src/types/storage.ts +12 -3
- package/src/types/user.ts +7 -0
- package/src/util/collections.ts +22 -0
- package/src/util/entities.ts +5 -4
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +15 -10
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/icons.tsx +11 -3
- package/src/util/index.ts +1 -0
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +12 -8
- package/src/util/plurals.ts +0 -2
- package/src/util/references.ts +36 -5
- package/src/util/resolutions.ts +44 -39
- package/src/util/storage.ts +75 -21
- package/src/util/strings.ts +2 -2
- package/src/util/useStorageUploadController.tsx +21 -3
- package/src/util/useTraceUpdate.tsx +2 -1
- 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/form/EntityForm.d.ts +0 -77
- package/dist/internal/EntityView.d.ts +0 -22
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/dist/internal/useLocaleConfig.d.ts +0 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
- package/src/core/Drawer.tsx +0 -164
- package/src/core/Scaffold.tsx +0 -281
- package/src/form/EntityForm.tsx +0 -720
- package/src/internal/EntityView.tsx +0 -578
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
- /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
- /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
- /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
|
@@ -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, getColorSchemeForSeed } from "@firecms/ui";
|
|
9
|
+
import { Chip, cls, getColorSchemeForSeed } from "@firecms/ui";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @group Preview components
|
|
@@ -24,14 +24,14 @@ export function StringPropertyPreview({
|
|
|
24
24
|
return <EnumValuesChip
|
|
25
25
|
enumKey={enumKey}
|
|
26
26
|
enumValues={resolvedProperty.enumValues}
|
|
27
|
-
size={size
|
|
27
|
+
size={size}/>;
|
|
28
28
|
} else if (property.previewAsTag) {
|
|
29
29
|
const colorScheme = getColorSchemeForSeed(propertyKey ?? "");
|
|
30
30
|
return (
|
|
31
31
|
<ErrorBoundary>
|
|
32
32
|
<Chip
|
|
33
33
|
colorScheme={colorScheme}
|
|
34
|
-
size={size
|
|
34
|
+
size={size}>
|
|
35
35
|
{value}
|
|
36
36
|
</Chip>
|
|
37
37
|
</ErrorBoundary>);
|
|
@@ -45,15 +45,16 @@ 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={"overflow-x-scroll"}>
|
|
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>
|
|
52
52
|
{index !== lines.length - 1 && <br/>}
|
|
53
53
|
</React.Fragment>)}
|
|
54
54
|
</div>
|
|
55
|
-
:
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
: (size === "tiny"
|
|
56
|
+
? <span className={"text-sm"}>{value}</span>
|
|
57
|
+
: <>{value}</>
|
|
58
|
+
);
|
|
58
59
|
}
|
|
59
60
|
}
|
package/src/types/analytics.ts
CHANGED
package/src/types/auth.tsx
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { User } from "./user";
|
|
2
|
+
import { Role } from "./roles";
|
|
3
|
+
import { DataSourceDelegate } from "./datasource";
|
|
4
|
+
import { StorageSource } from "./storage";
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Controller for retrieving the logged user or performing auth related operations.
|
|
@@ -6,7 +9,7 @@ import { User } from "./user";
|
|
|
6
9
|
* to do it as the result of a hook.
|
|
7
10
|
* @group Hooks and utilities
|
|
8
11
|
*/
|
|
9
|
-
export type AuthController<UserType extends User =
|
|
12
|
+
export type AuthController<UserType extends User = any, ExtraData = any> = {
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* The user currently logged in
|
|
@@ -14,6 +17,11 @@ export type AuthController<UserType extends User = User> = {
|
|
|
14
17
|
*/
|
|
15
18
|
user: UserType | null;
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Roles related to the logged user
|
|
22
|
+
*/
|
|
23
|
+
roles?: Role[];
|
|
24
|
+
|
|
17
25
|
/**
|
|
18
26
|
* Initial loading flag. It is used not to display the login screen
|
|
19
27
|
* when the app first loads, and it has not been checked whether the user
|
|
@@ -21,10 +29,16 @@ export type AuthController<UserType extends User = User> = {
|
|
|
21
29
|
*/
|
|
22
30
|
initialLoading?: boolean;
|
|
23
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Loading flag. It is used to display a loading screen when the user is
|
|
34
|
+
* logging in or out.
|
|
35
|
+
*/
|
|
36
|
+
authLoading: boolean;
|
|
37
|
+
|
|
24
38
|
/**
|
|
25
39
|
* Sign out
|
|
26
40
|
*/
|
|
27
|
-
signOut: () => void
|
|
41
|
+
signOut: () => Promise<void>;
|
|
28
42
|
|
|
29
43
|
/**
|
|
30
44
|
* Error initializing the authentication
|
|
@@ -46,4 +60,39 @@ export type AuthController<UserType extends User = User> = {
|
|
|
46
60
|
*/
|
|
47
61
|
loginSkipped: boolean;
|
|
48
62
|
|
|
63
|
+
extra: ExtraData;
|
|
64
|
+
|
|
65
|
+
setExtra: (extra: ExtraData) => void;
|
|
66
|
+
|
|
67
|
+
// setUser?: (user: UserType | null) => void;
|
|
68
|
+
|
|
69
|
+
// setRoles?: (roles: Role[]) => void;
|
|
49
70
|
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Implement this function to allow access to specific users.
|
|
74
|
+
* @group Hooks and utilities
|
|
75
|
+
*/
|
|
76
|
+
export type Authenticator<UserType extends User = User, Controller extends AuthController<UserType> = AuthController<UserType>> = (props: {
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Logged-in user or null
|
|
80
|
+
*/
|
|
81
|
+
user: UserType | null;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* AuthController
|
|
85
|
+
*/
|
|
86
|
+
authController: Controller;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Connector to your database, e.g. your Firestore database
|
|
90
|
+
*/
|
|
91
|
+
dataSourceDelegate: DataSourceDelegate;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Used storage implementation
|
|
95
|
+
*/
|
|
96
|
+
storageSource: StorageSource;
|
|
97
|
+
|
|
98
|
+
}) => boolean | Promise<boolean>;
|
package/src/types/collections.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { EnumValues, PropertiesOrBuilders } from "./properties";
|
|
|
8
8
|
import { FormContext } from "./fields";
|
|
9
9
|
import { EntityAction } from "./entity_actions";
|
|
10
10
|
import { ExportConfig } from "./export_import";
|
|
11
|
+
import { EntityOverrides } from "./entity_overrides";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* This interface represents a view that includes a collection of entities.
|
|
@@ -16,7 +17,7 @@ import { ExportConfig } from "./export_import";
|
|
|
16
17
|
*
|
|
17
18
|
* @group Models
|
|
18
19
|
*/
|
|
19
|
-
export interface EntityCollection<M extends Record<string, any> = any, UserType extends User =
|
|
20
|
+
export interface EntityCollection<M extends Record<string, any> = any, UserType extends User = any> {
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* You can set an alias that will be used internally instead of the `path`.
|
|
@@ -76,6 +77,13 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
76
77
|
*/
|
|
77
78
|
properties: PropertiesOrBuilders<M>;
|
|
78
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Title property of the entity. This is the property that will be used
|
|
82
|
+
* as the title in entity related views and references.
|
|
83
|
+
* If not specified, the first property simple text property will be used.
|
|
84
|
+
*/
|
|
85
|
+
titleProperty?: keyof M;
|
|
86
|
+
|
|
79
87
|
/**
|
|
80
88
|
* Can this collection be edited by the end user.
|
|
81
89
|
* Defaults to `true`.
|
|
@@ -99,8 +107,12 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
99
107
|
* `subcollection:`. e.g. `subcollection:orders`.
|
|
100
108
|
* - If you are using a collection group, you will also have an
|
|
101
109
|
* additional `collectionGroupParent` column.
|
|
110
|
+
* You can use this prop to hide some properties from the table view.
|
|
111
|
+
* Note that if you set this prop, other ways to hide fields, like
|
|
112
|
+
* `hidden` in the property definition,will be ignored.
|
|
113
|
+
* `propertiesOrder` has precedence over `hidden`.
|
|
102
114
|
*/
|
|
103
|
-
propertiesOrder?: Extract<keyof M, string>[];
|
|
115
|
+
propertiesOrder?: (Extract<keyof M, string> | `subcollection:${string}`)[];
|
|
104
116
|
|
|
105
117
|
/**
|
|
106
118
|
* If enabled, content is loaded in batches. If `false` all entities in the
|
|
@@ -139,7 +151,7 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
139
151
|
* is being created, updated or deleted.
|
|
140
152
|
* Useful for adding your own logic or blocking the execution of the operation.
|
|
141
153
|
*/
|
|
142
|
-
callbacks?: EntityCallbacks<M>;
|
|
154
|
+
callbacks?: EntityCallbacks<M, UserType>;
|
|
143
155
|
|
|
144
156
|
/**
|
|
145
157
|
* Builder for rendering additional components such as buttons in the
|
|
@@ -276,6 +288,22 @@ export interface EntityCollection<M extends Record<string, any> = any, UserType
|
|
|
276
288
|
*
|
|
277
289
|
*/
|
|
278
290
|
exportable?: boolean | ExportConfig<UserType>;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* User id of the owner of this collection. This is used only by plugins, or if you
|
|
294
|
+
* are writing custom code
|
|
295
|
+
*/
|
|
296
|
+
ownerId?: string;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Overrides for the entity view, like the data source or the storage source.
|
|
300
|
+
*/
|
|
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;
|
|
279
307
|
}
|
|
280
308
|
|
|
281
309
|
/**
|
|
@@ -334,19 +362,18 @@ export interface CollectionActionsProps<M extends Record<string, any> = any, Use
|
|
|
334
362
|
/**
|
|
335
363
|
* Use this controller to retrieve the selected entities or modify them in
|
|
336
364
|
* an {@link EntityCollection}
|
|
337
|
-
* If you want to pass a `SelectionController` to
|
|
338
365
|
* @group Models
|
|
339
366
|
*/
|
|
340
367
|
export type SelectionController<M extends Record<string, any> = any> = {
|
|
341
368
|
selectedEntities: Entity<M>[];
|
|
342
369
|
setSelectedEntities: Dispatch<SetStateAction<Entity<M>[]>>;
|
|
343
370
|
isEntitySelected: (entity: Entity<M>) => boolean;
|
|
344
|
-
toggleEntitySelection: (entity: Entity<M
|
|
371
|
+
toggleEntitySelection: (entity: Entity<M>, newSelectedState?: boolean) => void;
|
|
345
372
|
}
|
|
346
373
|
|
|
347
374
|
/**
|
|
348
375
|
* Filter conditions in a `Query.where()` clause are specified using the
|
|
349
|
-
* strings
|
|
376
|
+
* strings `<`, `<=`, `==`, `>=`, `>`, `array-contains`, `in`, and `array-contains-any`.
|
|
350
377
|
* @group Models
|
|
351
378
|
*/
|
|
352
379
|
export type WhereFilterOp =
|
|
@@ -436,7 +463,10 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
|
|
|
436
463
|
* view.
|
|
437
464
|
* @param entity
|
|
438
465
|
*/
|
|
439
|
-
value?: (props: {
|
|
466
|
+
value?: (props: {
|
|
467
|
+
entity: Entity<M>,
|
|
468
|
+
context: FireCMSContext<any>
|
|
469
|
+
}) => string | number | Promise<string | number> | undefined;
|
|
440
470
|
}
|
|
441
471
|
|
|
442
472
|
/**
|
|
@@ -446,8 +476,22 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any,
|
|
|
446
476
|
*/
|
|
447
477
|
export type EntityCustomView<M extends Record<string, any> = any> =
|
|
448
478
|
{
|
|
479
|
+
/**
|
|
480
|
+
* Key of this custom view.
|
|
481
|
+
*/
|
|
449
482
|
key: string,
|
|
483
|
+
/**
|
|
484
|
+
* Name of this custom view.
|
|
485
|
+
*/
|
|
450
486
|
name: string,
|
|
487
|
+
/**
|
|
488
|
+
* If set to true, the actions of the entity will be included in the
|
|
489
|
+
* bottom of the panel (save buttons, delete buttons, etc.)
|
|
490
|
+
*/
|
|
491
|
+
includeActions?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Builder for rendering the custom view
|
|
494
|
+
*/
|
|
451
495
|
Builder?: React.ComponentType<EntityCustomViewParams<M>>;
|
|
452
496
|
}
|
|
453
497
|
|
|
@@ -508,7 +552,7 @@ export type EntityTableController<M extends Record<string, any> = any> = {
|
|
|
508
552
|
filterValues?: FilterValues<Extract<keyof M, string>>;
|
|
509
553
|
setFilterValues?: (filterValues: FilterValues<Extract<keyof M, string>>) => void;
|
|
510
554
|
sortBy?: [Extract<keyof M, string>, "asc" | "desc"];
|
|
511
|
-
setSortBy?: (sortBy
|
|
555
|
+
setSortBy?: (sortBy?: [Extract<keyof M, string>, "asc" | "desc"]) => void;
|
|
512
556
|
searchString?: string;
|
|
513
557
|
setSearchString?: (searchString?: string) => void;
|
|
514
558
|
clearFilter?: () => void;
|
package/src/types/datasource.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Entity,
|
|
1
|
+
import { Entity, EntityStatus, EntityValues } 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
|
|
@@ -8,7 +9,7 @@ import { ResolvedEntityCollection } from "./resolved_entities";
|
|
|
8
9
|
export interface FetchEntityProps<M extends Record<string, any> = any> {
|
|
9
10
|
path: string;
|
|
10
11
|
entityId: string;
|
|
11
|
-
collection?: EntityCollection<M>
|
|
12
|
+
collection?: EntityCollection<M, any>
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -65,9 +66,8 @@ export interface DeleteEntityProps<M extends Record<string, any> = any> {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* A Firestore implementation of this interface can be found in {@link useFirestoreDataSource}
|
|
69
|
+
* Component in charge of communicating with the data source.
|
|
70
|
+
* Usually you won't need to implement this interface, but a {@link DataSourceDelegate} instead.
|
|
71
71
|
* @group Datasource
|
|
72
72
|
*/
|
|
73
73
|
export interface DataSource {
|
|
@@ -216,6 +216,19 @@ export interface DataSource {
|
|
|
216
216
|
* @param props
|
|
217
217
|
*/
|
|
218
218
|
isFilterCombinationValid?(props: FilterCombinationValidProps): boolean;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Called when the user clicks on the search bar in a collection view.
|
|
222
|
+
* Useful for initializing a text search index.
|
|
223
|
+
* @param props
|
|
224
|
+
*/
|
|
225
|
+
initTextSearch?: (props: {
|
|
226
|
+
context: FireCMSContext,
|
|
227
|
+
path: string,
|
|
228
|
+
collection: EntityCollection,
|
|
229
|
+
parentCollectionIds?: string[]
|
|
230
|
+
}) => Promise<boolean>;
|
|
231
|
+
|
|
219
232
|
}
|
|
220
233
|
|
|
221
234
|
export type FilterCombinationValidProps = {
|
|
@@ -240,6 +253,17 @@ export type ListenCollectionDelegateProps<M extends Record<string, any> = any> =
|
|
|
240
253
|
};
|
|
241
254
|
|
|
242
255
|
export interface DataSourceDelegate {
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Key that identifies this data source delegate
|
|
259
|
+
*/
|
|
260
|
+
key: string;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* If the data source has been initialised
|
|
264
|
+
*/
|
|
265
|
+
initialised?: boolean;
|
|
266
|
+
|
|
243
267
|
/**
|
|
244
268
|
* Fetch data from a collection
|
|
245
269
|
* @param path
|
|
@@ -318,8 +342,8 @@ export interface DataSourceDelegate {
|
|
|
318
342
|
/**
|
|
319
343
|
* Save entity to the specified path
|
|
320
344
|
* @param path
|
|
321
|
-
* @param
|
|
322
|
-
* @param
|
|
345
|
+
* @param entityId
|
|
346
|
+
* @param values
|
|
323
347
|
* @param status
|
|
324
348
|
*/
|
|
325
349
|
saveEntity<M extends Record<string, any> = any>({
|
|
@@ -362,28 +386,21 @@ export interface DataSourceDelegate {
|
|
|
362
386
|
*/
|
|
363
387
|
isFilterCombinationValid?(props: Omit<FilterCombinationValidProps, "collection">): boolean;
|
|
364
388
|
|
|
365
|
-
/**
|
|
366
|
-
* Convert a FireCMS reference to a reference that can be used by the datasource
|
|
367
|
-
* @param reference
|
|
368
|
-
*/
|
|
369
|
-
buildReference: (reference: EntityReference) => any,
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Convert a FireCMS GeoPoint to a GeoPoint that can be used by the datasource
|
|
373
|
-
* @param geoPoint
|
|
374
|
-
*/
|
|
375
|
-
buildGeoPoint: (geoPoint: GeoPoint) => any,
|
|
376
|
-
|
|
377
389
|
/**
|
|
378
390
|
* Get the object to generate the current time in the datasource
|
|
379
391
|
*/
|
|
380
|
-
currentTime()
|
|
381
|
-
|
|
382
|
-
buildDate: (date: Date) => any;
|
|
383
|
-
|
|
384
|
-
buildDeleteFieldValue: () => any;
|
|
392
|
+
currentTime?: () => any;
|
|
385
393
|
|
|
386
394
|
delegateToCMSModel: (data: any) => any;
|
|
387
395
|
|
|
396
|
+
cmsToDelegateModel: (data: any) => any;
|
|
397
|
+
|
|
388
398
|
setDateToMidnight: (input?: any) => any;
|
|
399
|
+
|
|
400
|
+
initTextSearch?: (props: {
|
|
401
|
+
context: FireCMSContext,
|
|
402
|
+
path: string,
|
|
403
|
+
collection: EntityCollection,
|
|
404
|
+
parentCollectionIds?: string[]
|
|
405
|
+
}) => Promise<boolean>;
|
|
389
406
|
}
|
package/src/types/entities.ts
CHANGED
|
@@ -37,7 +37,7 @@ export type EntityValues<M extends object> = M;
|
|
|
37
37
|
/**
|
|
38
38
|
* Class used to create a reference to an entity in a different path
|
|
39
39
|
*/
|
|
40
|
-
export class EntityReference
|
|
40
|
+
export class EntityReference {
|
|
41
41
|
/**
|
|
42
42
|
* ID of the entity
|
|
43
43
|
*/
|
|
@@ -56,6 +56,10 @@ export class EntityReference<M extends Record<string, any> = any> {
|
|
|
56
56
|
get pathWithId() {
|
|
57
57
|
return `${this.path}/${this.id}`;
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
isEntityReference() {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
export class GeoPoint {
|
|
@@ -74,3 +78,11 @@ export class GeoPoint {
|
|
|
74
78
|
this.longitude = longitude;
|
|
75
79
|
}
|
|
76
80
|
}
|
|
81
|
+
|
|
82
|
+
export class Vector {
|
|
83
|
+
readonly value: number[];
|
|
84
|
+
|
|
85
|
+
constructor(value: number[]) {
|
|
86
|
+
this.value = value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -5,9 +5,25 @@ import { EntityCollection, SelectionController } from "./collections";
|
|
|
5
5
|
import { User } from "./user";
|
|
6
6
|
import { SideEntityController } from "./side_entity_controller";
|
|
7
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
|
+
*/
|
|
8
12
|
export type EntityAction<M extends object = any, UserType extends User = User> = {
|
|
13
|
+
/**
|
|
14
|
+
* Title of the action
|
|
15
|
+
*/
|
|
9
16
|
name: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Icon of the action
|
|
20
|
+
*/
|
|
10
21
|
icon?: React.ReactElement;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Callback when the action is clicked
|
|
25
|
+
* @param props
|
|
26
|
+
*/
|
|
11
27
|
onClick: (props: EntityActionClickProps<M, UserType>) => Promise<void> | void;
|
|
12
28
|
|
|
13
29
|
/**
|
|
@@ -21,6 +37,7 @@ export type EntityAction<M extends object = any, UserType extends User = User> =
|
|
|
21
37
|
* Show this action in the form, defaults to true
|
|
22
38
|
*/
|
|
23
39
|
includeInForm?: boolean;
|
|
40
|
+
|
|
24
41
|
}
|
|
25
42
|
|
|
26
43
|
export type EntityActionClickProps<M extends object, UserType extends User = User> = {
|
|
@@ -78,7 +78,7 @@ export interface EntityOnFetchProps<M extends Record<string, any> = any, UserTyp
|
|
|
78
78
|
/**
|
|
79
79
|
* Collection of the entity
|
|
80
80
|
*/
|
|
81
|
-
collection: EntityCollection<M>;
|
|
81
|
+
collection: EntityCollection<M, UserType>;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Full path of the CMS where this collection is being fetched.
|
|
@@ -193,7 +193,7 @@ export interface EntityOnDeleteProps<M extends Record<string, any> = any, UserTy
|
|
|
193
193
|
/**
|
|
194
194
|
* Context of the app status
|
|
195
195
|
*/
|
|
196
|
-
context: FireCMSContext
|
|
196
|
+
context: FireCMSContext<UserType>;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
/**
|