@firecms/core 3.0.0-alpha.57 → 3.0.0-alpha.59
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/components/EntityCollectionTable/internal/default_entity_actions.d.ts +1 -0
- package/dist/{form/components → components}/LabelWithIcon.d.ts +1 -2
- package/dist/components/ReferenceWidget.d.ts +27 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/form/components/index.d.ts +0 -1
- package/dist/index.es.js +882 -789
- 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/types/firecms_context.d.ts +9 -9
- package/package.json +3 -3
- package/src/components/EntityCollectionTable/internal/default_entity_actions.tsx +17 -2
- package/src/{form/components → components}/LabelWithIcon.tsx +1 -2
- package/src/components/ReferenceWidget.tsx +143 -0
- package/src/components/index.tsx +2 -0
- package/src/form/components/index.tsx +0 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +2 -1
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -1
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +3 -1
- package/src/form/field_bindings/MapFieldBinding.tsx +2 -1
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -1
- package/src/form/field_bindings/MultiSelectBinding.tsx +2 -1
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -1
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +2 -1
- package/src/form/field_bindings/RepeatFieldBinding.tsx +2 -1
- package/src/form/field_bindings/SelectFieldBinding.tsx +2 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +2 -1
- package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
- package/src/form/field_bindings/TextFieldBinding.tsx +2 -1
- package/src/types/firecms_context.tsx +10 -11
- package/dist/form/components/ReferenceWidget.d.ts +0 -24
- package/src/form/components/ReferenceWidget.tsx +0 -255
|
@@ -22,15 +22,6 @@ import { DialogsController } from "./dialogs_controller";
|
|
|
22
22
|
* @see useFireCMSContext
|
|
23
23
|
*/
|
|
24
24
|
export type FireCMSContext<UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>> = {
|
|
25
|
-
/**
|
|
26
|
-
* Format of the dates in the CMS.
|
|
27
|
-
* Defaults to 'MMMM dd, yyyy, HH:mm:ss'
|
|
28
|
-
*/
|
|
29
|
-
dateTimeFormat?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Locale of the CMS, currently only affecting dates
|
|
32
|
-
*/
|
|
33
|
-
locale?: Locale;
|
|
34
25
|
/**
|
|
35
26
|
* Connector to your database, e.g. your Firestore database
|
|
36
27
|
*/
|
|
@@ -99,6 +90,15 @@ export type FireCMSContext<UserType extends User = User, AuthControllerType exte
|
|
|
99
90
|
* You can also define an entity view from the UI.
|
|
100
91
|
*/
|
|
101
92
|
entityViews?: EntityCustomView[];
|
|
93
|
+
/**
|
|
94
|
+
* Format of the dates in the CMS.
|
|
95
|
+
* Defaults to 'MMMM dd, yyyy, HH:mm:ss'
|
|
96
|
+
*/
|
|
97
|
+
dateTimeFormat?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Locale of the CMS, currently only affecting dates
|
|
100
|
+
*/
|
|
101
|
+
locale?: Locale;
|
|
102
102
|
components?: {
|
|
103
103
|
/**
|
|
104
104
|
* Component to render when a reference is missing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.59",
|
|
4
4
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
5
5
|
"funding": {
|
|
6
6
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@firecms/ui": "^3.0.0-alpha.
|
|
48
|
+
"@firecms/ui": "^3.0.0-alpha.59",
|
|
49
49
|
"@fontsource/ibm-plex-mono": "^5.0.8",
|
|
50
50
|
"@fontsource/roboto": "^5.0.8",
|
|
51
51
|
"@hello-pangea/dnd": "^16.5.0",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"dist",
|
|
117
117
|
"src"
|
|
118
118
|
],
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "9d82460b4b28c7b31d097ff3e0e28f77c05b1023",
|
|
120
120
|
"publishConfig": {
|
|
121
121
|
"access": "public"
|
|
122
122
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityAction } from "../../../types";
|
|
2
2
|
import { DeleteEntityDialog } from "./DeleteEntityDialog";
|
|
3
|
-
import { ArchiveIcon, DeleteIcon, FileCopyIcon, KeyboardTabIcon } from "@firecms/ui";
|
|
3
|
+
import { ArchiveIcon, DeleteIcon, FileCopyIcon, KeyboardTabIcon, OpenInNewIcon } from "@firecms/ui";
|
|
4
4
|
|
|
5
5
|
export const editEntityAction: EntityAction = {
|
|
6
6
|
icon: <KeyboardTabIcon/>,
|
|
@@ -61,12 +61,27 @@ export const archiveEntityAction: EntityAction = {
|
|
|
61
61
|
onClick({
|
|
62
62
|
entity,
|
|
63
63
|
collection,
|
|
64
|
-
context
|
|
64
|
+
context: {
|
|
65
|
+
dataSource,
|
|
66
|
+
}
|
|
65
67
|
}): Promise<void> {
|
|
66
68
|
// Add your code here
|
|
67
69
|
return Promise.resolve(undefined);
|
|
68
70
|
}
|
|
69
71
|
}
|
|
72
|
+
export const openWebsiteAction: EntityAction = {
|
|
73
|
+
icon: <OpenInNewIcon/>,
|
|
74
|
+
name: "See in website",
|
|
75
|
+
onClick({
|
|
76
|
+
entity,
|
|
77
|
+
collection,
|
|
78
|
+
context,
|
|
79
|
+
}): Promise<void> {
|
|
80
|
+
// open a new tab
|
|
81
|
+
window.open(`https://example.com/${entity.id}`, "_blank");
|
|
82
|
+
return Promise.resolve(undefined);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
70
85
|
|
|
71
86
|
export const deleteEntityAction: EntityAction = {
|
|
72
87
|
icon: <DeleteIcon/>,
|
|
@@ -9,8 +9,7 @@ interface LabelWithIconProps {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Render the label of
|
|
13
|
-
* icon.
|
|
12
|
+
* Render the label of with an icon and the title of a property
|
|
14
13
|
* @group Form custom fields
|
|
15
14
|
*/
|
|
16
15
|
export function LabelWithIcon({
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { Entity, EntityCollection, EntityReference, FilterValues } from "../types";
|
|
4
|
+
import { getReferenceFrom } from "../util";
|
|
5
|
+
import { PreviewSize, ReferencePreview } from "../preview";
|
|
6
|
+
import { useNavigationController, useReferenceDialog } from "../hooks";
|
|
7
|
+
import { Button, cn } from "@firecms/ui";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This field allows selecting reference/s.
|
|
11
|
+
*/
|
|
12
|
+
export function ReferenceWidget<M extends Record<string, any>>({
|
|
13
|
+
name,
|
|
14
|
+
multiselect = false,
|
|
15
|
+
path,
|
|
16
|
+
disabled,
|
|
17
|
+
value,
|
|
18
|
+
onReferenceSelected,
|
|
19
|
+
onMultipleReferenceSelected,
|
|
20
|
+
previewProperties,
|
|
21
|
+
forceFilter,
|
|
22
|
+
size,
|
|
23
|
+
className
|
|
24
|
+
}: {
|
|
25
|
+
name?: string,
|
|
26
|
+
multiselect?: boolean,
|
|
27
|
+
value: EntityReference | EntityReference[] | null,
|
|
28
|
+
onReferenceSelected?: (params: {
|
|
29
|
+
reference: EntityReference | null,
|
|
30
|
+
entity: Entity<M> | null
|
|
31
|
+
}) => void,
|
|
32
|
+
onMultipleReferenceSelected?: (params: {
|
|
33
|
+
references: EntityReference[] | null,
|
|
34
|
+
entities: Entity<M>[] | null
|
|
35
|
+
}) => void,
|
|
36
|
+
path: string,
|
|
37
|
+
disabled?: boolean,
|
|
38
|
+
previewProperties?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Allow selection of entities that pass the given filter only.
|
|
41
|
+
*/
|
|
42
|
+
forceFilter?: FilterValues<string>;
|
|
43
|
+
size: PreviewSize;
|
|
44
|
+
className?: string;
|
|
45
|
+
}) {
|
|
46
|
+
|
|
47
|
+
const navigationController = useNavigationController();
|
|
48
|
+
|
|
49
|
+
const collection: EntityCollection | undefined = useMemo(() => {
|
|
50
|
+
return navigationController.getCollection(path);
|
|
51
|
+
}, [path, navigationController]);
|
|
52
|
+
|
|
53
|
+
if (!collection) {
|
|
54
|
+
throw Error(`Couldn't find the corresponding collection for the path: ${path}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const onSingleEntitySelected = useCallback((entity: Entity<M> | null) => {
|
|
58
|
+
if (disabled)
|
|
59
|
+
return;
|
|
60
|
+
if (onReferenceSelected) {
|
|
61
|
+
const reference = entity ? getReferenceFrom(entity) : null;
|
|
62
|
+
onReferenceSelected?.({ reference, entity });
|
|
63
|
+
}
|
|
64
|
+
}, [disabled, onReferenceSelected]);
|
|
65
|
+
|
|
66
|
+
const onMultipleEntitiesSelected = useCallback((entities: Entity<M>[]) => {
|
|
67
|
+
if (disabled)
|
|
68
|
+
return;
|
|
69
|
+
if (onMultipleReferenceSelected) {
|
|
70
|
+
const references = entities ? entities.map(e => getReferenceFrom(e)) : null;
|
|
71
|
+
onMultipleReferenceSelected({ references, entities });
|
|
72
|
+
}
|
|
73
|
+
}, [disabled, onReferenceSelected]);
|
|
74
|
+
|
|
75
|
+
const referenceDialogController = useReferenceDialog({
|
|
76
|
+
multiselect,
|
|
77
|
+
path,
|
|
78
|
+
collection,
|
|
79
|
+
onSingleEntitySelected,
|
|
80
|
+
onMultipleEntitiesSelected,
|
|
81
|
+
forceFilter
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const clearValue = useCallback((e: React.MouseEvent) => {
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
if (multiselect) {
|
|
88
|
+
onMultipleEntitiesSelected([]);
|
|
89
|
+
} else {
|
|
90
|
+
onSingleEntitySelected(null);
|
|
91
|
+
}
|
|
92
|
+
}, [onReferenceSelected]);
|
|
93
|
+
|
|
94
|
+
let child: React.ReactNode;
|
|
95
|
+
|
|
96
|
+
const onEntryClick = () => {
|
|
97
|
+
if (disabled)
|
|
98
|
+
return;
|
|
99
|
+
referenceDialogController.open();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
if (Array.isArray(value)) {
|
|
103
|
+
child = <div className={"flex flex-col gap-4"}>
|
|
104
|
+
{value.map((ref, index) => {
|
|
105
|
+
return <ReferencePreview
|
|
106
|
+
key={`reference_preview_${index}`}
|
|
107
|
+
onClick={onEntryClick}
|
|
108
|
+
reference={ref}
|
|
109
|
+
disabled={disabled}
|
|
110
|
+
previewProperties={previewProperties}
|
|
111
|
+
size={size}/>
|
|
112
|
+
})}
|
|
113
|
+
</div>
|
|
114
|
+
} else if (value instanceof EntityReference) {
|
|
115
|
+
child = <ReferencePreview
|
|
116
|
+
reference={value}
|
|
117
|
+
onClick={onEntryClick}
|
|
118
|
+
disabled={disabled}
|
|
119
|
+
previewProperties={previewProperties}
|
|
120
|
+
size={size}/>
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
return <div className={cn("text-sm font-medium text-gray-500",
|
|
124
|
+
"min-w-80 flex flex-col gap-4",
|
|
125
|
+
"relative transition-colors duration-200 ease-in rounded font-medium",
|
|
126
|
+
disabled ? "bg-opacity-50" : "hover:bg-opacity-75",
|
|
127
|
+
"text-opacity-50 dark:text-white dark:text-opacity-50",
|
|
128
|
+
className
|
|
129
|
+
)}
|
|
130
|
+
>
|
|
131
|
+
|
|
132
|
+
{child}
|
|
133
|
+
{!value && <div className="justify-center text-left">
|
|
134
|
+
<Button variant="outlined"
|
|
135
|
+
color="primary"
|
|
136
|
+
disabled={disabled}
|
|
137
|
+
onClick={onEntryClick}>
|
|
138
|
+
Edit {name}
|
|
139
|
+
</Button>
|
|
140
|
+
</div>}
|
|
141
|
+
|
|
142
|
+
</div>;
|
|
143
|
+
}
|
package/src/components/index.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FieldProps } from "../../types";
|
|
3
|
-
import { FieldHelperText
|
|
3
|
+
import { FieldHelperText } from "../components";
|
|
4
4
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
5
5
|
import { useClearRestoreValue, useFireCMSContext } from "../../hooks";
|
|
6
6
|
import { ExpandablePanel } from "@firecms/ui";
|
|
7
7
|
import { getIconForProperty } from "../../util";
|
|
8
|
+
import { LabelWithIcon } from "../../components";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Array field used for custom
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
import { Entity, EntityCollection, EntityReference, FieldProps, ResolvedProperty } from "../../types";
|
|
3
3
|
import { ReferencePreview } from "../../preview";
|
|
4
|
-
import { FieldHelperText, FormikArrayContainer
|
|
4
|
+
import { FieldHelperText, FormikArrayContainer } from "../components";
|
|
5
|
+
import { LabelWithIcon } from "../../components";
|
|
5
6
|
import { getIconForProperty, getReferenceFrom } from "../../util";
|
|
6
7
|
|
|
7
8
|
import { useClearRestoreValue, useNavigationController, useReferenceDialog } from "../../hooks";
|
|
@@ -2,7 +2,8 @@ import React, { useCallback, useEffect, useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { FastField, FieldProps as FormikFieldProps, useFormikContext } from "formik";
|
|
4
4
|
|
|
5
|
-
import { FieldHelperText, FormikArrayContainer
|
|
5
|
+
import { FieldHelperText, FormikArrayContainer } from "../components";
|
|
6
|
+
import { LabelWithIcon } from "../../components";
|
|
6
7
|
import { useClearRestoreValue } from "../../hooks";
|
|
7
8
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
8
9
|
import { EnumValuesChip } from "../../preview";
|
|
@@ -2,7 +2,8 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { FieldProps } from "../../types";
|
|
4
4
|
|
|
5
|
-
import { FieldHelperText
|
|
5
|
+
import { FieldHelperText } from "../components";
|
|
6
|
+
import { LabelWithIcon } from "../../components";
|
|
6
7
|
import { useClearRestoreValue, useFireCMSContext } from "../../hooks";
|
|
7
8
|
import { getIconForProperty } from "../../util";
|
|
8
9
|
import { DateTimeField } from "@firecms/ui";
|
|
@@ -2,7 +2,9 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
import { DataType, EntityReference, FieldProps, GeoPoint } from "../../types";
|
|
3
3
|
|
|
4
4
|
import { ArrayContainer } from "../../components";
|
|
5
|
-
import { FieldHelperText
|
|
5
|
+
import { FieldHelperText } from "../components";
|
|
6
|
+
|
|
7
|
+
import { LabelWithIcon } from "../../components";
|
|
6
8
|
import {
|
|
7
9
|
AddIcon,
|
|
8
10
|
ArrowDropDownIcon,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FieldProps, Properties, ResolvedProperties } from "../../types";
|
|
3
3
|
|
|
4
|
+
import { LabelWithIcon } from "../../components";
|
|
4
5
|
import { getIconForProperty, isHidden, pick } from "../../util";
|
|
5
|
-
import { FieldHelperText
|
|
6
|
+
import { FieldHelperText } from "../components";
|
|
6
7
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
7
8
|
import { ExpandablePanel, InputLabel, Select, SelectItem } from "@firecms/ui";
|
|
8
9
|
|
|
@@ -4,7 +4,8 @@ import React, { useDeferredValue, useEffect, useRef } from "react";
|
|
|
4
4
|
import MarkdownIt from "markdown-it";
|
|
5
5
|
import MdEditor, { Plugins } from "react-markdown-editor-lite";
|
|
6
6
|
|
|
7
|
-
import { FieldHelperText
|
|
7
|
+
import { FieldHelperText } from "../components";
|
|
8
|
+
import { LabelWithIcon } from "../../components";
|
|
8
9
|
import { FieldProps } from "../../types";
|
|
9
10
|
import { getIconForProperty } from "../../util";
|
|
10
11
|
import {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { EnumType, FieldProps, ResolvedProperty } from "../../types";
|
|
4
|
-
import { FieldHelperText
|
|
4
|
+
import { FieldHelperText } from "../components";
|
|
5
|
+
import { LabelWithIcon } from "../../components";
|
|
5
6
|
import { useClearRestoreValue } from "../../hooks";
|
|
6
7
|
import { EnumValuesChip } from "../../preview";
|
|
7
8
|
import { enumToObjectEntries, getIconForProperty, getLabelOrConfigFrom } from "../../util";
|
|
@@ -3,7 +3,8 @@ import React from "react";
|
|
|
3
3
|
import { Entity, FieldProps } from "../../types";
|
|
4
4
|
|
|
5
5
|
import { PropertyPreview } from "../../preview";
|
|
6
|
-
import { FieldHelperText
|
|
6
|
+
import { FieldHelperText } from "../components";
|
|
7
|
+
import { LabelWithIcon } from "../../components";
|
|
7
8
|
import { getIconForProperty } from "../../util";
|
|
8
9
|
import { cn, paperMixin } from "@firecms/ui";
|
|
9
10
|
import { ErrorBoundary } from "../../components";
|
|
@@ -3,7 +3,8 @@ import React, { useCallback, useMemo } from "react";
|
|
|
3
3
|
import { Entity, EntityCollection, EntityReference, FieldProps } from "../../types";
|
|
4
4
|
import { useClearRestoreValue, useNavigationController, useReferenceDialog } from "../../hooks";
|
|
5
5
|
import { ReadOnlyFieldBinding } from "./ReadOnlyFieldBinding";
|
|
6
|
-
import { FieldHelperText
|
|
6
|
+
import { FieldHelperText } from "../components";
|
|
7
|
+
import { LabelWithIcon } from "../../components";
|
|
7
8
|
import { ReferencePreview } from "../../preview";
|
|
8
9
|
import { getIconForProperty, getReferenceFrom } from "../../util";
|
|
9
10
|
import { Button } from "@firecms/ui";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { CMSType, FieldProps, ResolvedProperty } from "../../types";
|
|
3
|
-
import { FieldHelperText, FormikArrayContainer
|
|
3
|
+
import { FieldHelperText, FormikArrayContainer } from "../components";
|
|
4
|
+
import { LabelWithIcon } from "../../components";
|
|
4
5
|
import { useClearRestoreValue } from "../../hooks";
|
|
5
6
|
import { getIconForProperty } from "../../util";
|
|
6
7
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { EnumType, FieldProps } from "../../types";
|
|
4
|
-
import { FieldHelperText
|
|
4
|
+
import { FieldHelperText } from "../components";
|
|
5
|
+
import { LabelWithIcon } from "../../components";
|
|
5
6
|
import { useClearRestoreValue } from "../../hooks";
|
|
6
7
|
import { EnumValuesChip } from "../../preview";
|
|
7
8
|
import { getIconForProperty } from "../../util";
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
} from "../../types";
|
|
11
11
|
import { useDropzone } from "react-dropzone";
|
|
12
12
|
import { PreviewSize } from "../../preview";
|
|
13
|
-
import { FieldHelperText
|
|
13
|
+
import { FieldHelperText } from "../components";
|
|
14
|
+
import { LabelWithIcon } from "../../components";
|
|
14
15
|
|
|
15
16
|
import { getIconForProperty, isReadOnly } from "../../util";
|
|
16
17
|
import { useClearRestoreValue, useSnackbarController, useStorageSource } from "../../hooks";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { FieldProps } from "../../types";
|
|
4
|
-
import { LabelWithIcon } from "../components";
|
|
5
4
|
import { useClearRestoreValue } from "../../hooks";
|
|
6
5
|
import { getIconForProperty } from "../../util";
|
|
7
6
|
import { FieldHelperText } from "../components/FieldHelperText";
|
|
8
7
|
import { BooleanSwitchWithLabel } from "@firecms/ui";
|
|
8
|
+
import { LabelWithIcon } from "../../components";
|
|
9
9
|
|
|
10
10
|
type SwitchFieldProps = FieldProps<boolean>;
|
|
11
11
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { FieldProps, PreviewType } from "../../types";
|
|
4
|
-
import { FieldHelperText
|
|
4
|
+
import { FieldHelperText } from "../components";
|
|
5
5
|
import { useClearRestoreValue } from "../../hooks";
|
|
6
6
|
import { getIconForProperty } from "../../util";
|
|
7
7
|
import { ClearIcon, Collapse, IconButton, TextField } from "@firecms/ui";
|
|
8
8
|
import { PropertyPreview } from "../../preview";
|
|
9
|
+
import { LabelWithIcon } from "../../components";
|
|
9
10
|
|
|
10
11
|
interface TextFieldProps<T extends string | number> extends FieldProps<T> {
|
|
11
12
|
allowInfinity?: boolean
|
|
@@ -24,17 +24,6 @@ import { DialogsController } from "./dialogs_controller";
|
|
|
24
24
|
*/
|
|
25
25
|
export type FireCMSContext<UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>> = {
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* Format of the dates in the CMS.
|
|
29
|
-
* Defaults to 'MMMM dd, yyyy, HH:mm:ss'
|
|
30
|
-
*/
|
|
31
|
-
dateTimeFormat?: string;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Locale of the CMS, currently only affecting dates
|
|
35
|
-
*/
|
|
36
|
-
locale?: Locale;
|
|
37
|
-
|
|
38
27
|
/**
|
|
39
28
|
* Connector to your database, e.g. your Firestore database
|
|
40
29
|
*/
|
|
@@ -117,6 +106,16 @@ export type FireCMSContext<UserType extends User = User, AuthControllerType exte
|
|
|
117
106
|
*/
|
|
118
107
|
entityViews?: EntityCustomView[];
|
|
119
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Format of the dates in the CMS.
|
|
111
|
+
* Defaults to 'MMMM dd, yyyy, HH:mm:ss'
|
|
112
|
+
*/
|
|
113
|
+
dateTimeFormat?: string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Locale of the CMS, currently only affecting dates
|
|
117
|
+
*/
|
|
118
|
+
locale?: Locale;
|
|
120
119
|
|
|
121
120
|
components?: {
|
|
122
121
|
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { EntityReference, FilterValues } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* This field allows selecting reference/s.
|
|
4
|
-
* @param name
|
|
5
|
-
* @param path
|
|
6
|
-
* @param disabled
|
|
7
|
-
* @param value
|
|
8
|
-
* @param setValue
|
|
9
|
-
* @param previewProperties
|
|
10
|
-
* @param forceFilter
|
|
11
|
-
* @constructor
|
|
12
|
-
*/
|
|
13
|
-
export declare function ReferenceWidget<M extends Record<string, any>>({ name, path, disabled, value, setValue, previewProperties, forceFilter }: {
|
|
14
|
-
name?: string;
|
|
15
|
-
value?: EntityReference;
|
|
16
|
-
setValue: (value: EntityReference | null) => void;
|
|
17
|
-
path: string;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
previewProperties?: string[];
|
|
20
|
-
/**
|
|
21
|
-
* Allow selection of entities that pass the given filter only.
|
|
22
|
-
*/
|
|
23
|
-
forceFilter?: FilterValues<string>;
|
|
24
|
-
}): import("react/jsx-runtime").JSX.Element;
|