@firecms/core 3.0.0-canary.108 → 3.0.0-canary.109
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/PropertyIdCopyTooltip.d.ts +8 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/form/components/LabelWithIcon.d.ts +1 -1
- package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
- package/dist/form/components/index.d.ts +1 -0
- package/dist/index.es.js +285 -185
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +285 -185
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/app/Scaffold.tsx +13 -10
- package/src/components/ArrayContainer.tsx +9 -7
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +3 -1
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -1
- package/src/components/EntityPreview.tsx +2 -2
- package/src/components/PropertyIdCopyTooltip.tsx +48 -0
- package/src/components/SearchIconsView.tsx +2 -1
- package/src/components/index.tsx +1 -0
- package/src/core/DefaultAppBar.tsx +1 -1
- package/src/core/DrawerNavigationItem.tsx +28 -26
- package/src/core/EntityEditView.tsx +7 -13
- package/src/form/components/CustomIdField.tsx +4 -2
- package/src/form/components/FieldHelperText.tsx +1 -1
- package/src/form/components/LabelWithIcon.tsx +27 -19
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/StorageItemPreview.tsx +1 -0
- package/src/form/components/StorageUploadProgress.tsx +0 -1
- package/src/form/components/index.tsx +1 -0
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +7 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +18 -16
- package/src/form/field_bindings/BlockFieldBinding.tsx +7 -5
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +3 -2
- package/src/form/field_bindings/MapFieldBinding.tsx +10 -16
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +7 -5
- package/src/form/field_bindings/MultiSelectBinding.tsx +7 -5
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +8 -6
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +8 -5
- package/src/form/field_bindings/RepeatFieldBinding.tsx +7 -5
- package/src/form/field_bindings/SelectFieldBinding.tsx +44 -40
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +7 -5
- package/src/form/field_bindings/SwitchFieldBinding.tsx +7 -3
- package/src/form/field_bindings/TextFieldBinding.tsx +24 -22
- package/src/preview/components/ImagePreview.tsx +3 -1
- package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
- package/src/components/PropertyIdCopyTooltipContent.tsx +0 -27
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.109",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/editor": "^3.0.0-canary.
|
|
50
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
51
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
49
|
+
"@firecms/editor": "^3.0.0-canary.109",
|
|
50
|
+
"@firecms/formex": "^3.0.0-canary.109",
|
|
51
|
+
"@firecms/ui": "^3.0.0-canary.109",
|
|
52
52
|
"@hello-pangea/dnd": "^16.6.0",
|
|
53
53
|
"@radix-ui/react-portal": "^1.1.1",
|
|
54
54
|
"clsx": "^2.1.1",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dist",
|
|
101
101
|
"src"
|
|
102
102
|
],
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "ad45014069302bfff4dfc61065f1d193742ac0ca",
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
package/src/app/Scaffold.tsx
CHANGED
|
@@ -166,17 +166,20 @@ function DrawerWrapper(props: {
|
|
|
166
166
|
<Tooltip title="Open menu"
|
|
167
167
|
side="right"
|
|
168
168
|
sideOffset={12}
|
|
169
|
-
|
|
169
|
+
asChild={true}
|
|
170
170
|
>
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
171
|
+
<div
|
|
172
|
+
className="fixed top-2 left-3 !bg-gray-50 dark:!bg-gray-900 rounded-full w-fit z-20">
|
|
173
|
+
<IconButton
|
|
174
|
+
color="inherit"
|
|
175
|
+
aria-label="Open menu"
|
|
176
|
+
className="sticky top-2 left-3 "
|
|
177
|
+
onClick={() => props.setDrawerOpen(true)}
|
|
178
|
+
size="large"
|
|
179
|
+
>
|
|
180
|
+
<MenuIcon/>
|
|
181
|
+
</IconButton>
|
|
182
|
+
</div>
|
|
180
183
|
</Tooltip>
|
|
181
184
|
)}
|
|
182
185
|
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
AddIcon,
|
|
8
8
|
Button,
|
|
9
9
|
ContentCopyIcon,
|
|
10
|
-
fieldBackgroundHoverMixin,
|
|
10
|
+
fieldBackgroundHoverMixin,
|
|
11
|
+
HandleIcon,
|
|
11
12
|
IconButton,
|
|
12
13
|
Menu,
|
|
13
14
|
MenuItem,
|
|
@@ -240,7 +241,8 @@ export function ArrayContainerItem({
|
|
|
240
241
|
>
|
|
241
242
|
<div
|
|
242
243
|
className="flex items-start">
|
|
243
|
-
<div
|
|
244
|
+
<div
|
|
245
|
+
className="flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark bg-white dark:bg-gray-900 bg-opacity-80 dark:bg-opacity-80">
|
|
244
246
|
{buildEntry(index, internalId)}
|
|
245
247
|
</div>
|
|
246
248
|
<ArrayItemOptions direction={size === "small" ? "row" : "column"}
|
|
@@ -253,7 +255,6 @@ export function ArrayContainerItem({
|
|
|
253
255
|
</div>;
|
|
254
256
|
}
|
|
255
257
|
|
|
256
|
-
|
|
257
258
|
export function ArrayItemOptions({
|
|
258
259
|
direction,
|
|
259
260
|
disabled,
|
|
@@ -283,11 +284,13 @@ export function ArrayItemOptions({
|
|
|
283
284
|
open={menuOpen ? false : undefined}
|
|
284
285
|
side={direction === "column" ? "left" : undefined}
|
|
285
286
|
title="Drag to move. Click for more options">
|
|
286
|
-
|
|
287
287
|
<IconButton
|
|
288
288
|
size="small"
|
|
289
289
|
disabled={disabled}
|
|
290
|
-
onClick={() =>
|
|
290
|
+
onClick={(e) => {
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
setMenuOpen(true);
|
|
293
|
+
}}
|
|
291
294
|
onDragStart={(e: any) => {
|
|
292
295
|
setMenuOpen(false);
|
|
293
296
|
}}
|
|
@@ -298,7 +301,7 @@ export function ArrayItemOptions({
|
|
|
298
301
|
<Menu
|
|
299
302
|
portalContainer={iconRef.current}
|
|
300
303
|
open={menuOpen}
|
|
301
|
-
trigger={<div/>}>
|
|
304
|
+
trigger={<div tabIndex={-1}/>}>
|
|
302
305
|
|
|
303
306
|
<MenuItem dense onClick={(e) => {
|
|
304
307
|
setMenuOpen(false);
|
|
@@ -316,7 +319,6 @@ export function ArrayItemOptions({
|
|
|
316
319
|
</MenuItem>
|
|
317
320
|
|
|
318
321
|
</Menu>
|
|
319
|
-
|
|
320
322
|
</Tooltip>
|
|
321
323
|
|
|
322
324
|
</div>;
|
|
@@ -80,7 +80,9 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
80
80
|
<div className="w-34 flex justify-center">
|
|
81
81
|
|
|
82
82
|
{uncollapsedActions.map((action, index) => (
|
|
83
|
-
<Tooltip key={index}
|
|
83
|
+
<Tooltip key={index}
|
|
84
|
+
title={action.name}
|
|
85
|
+
asChild={true}>
|
|
84
86
|
<IconButton
|
|
85
87
|
onClick={(event: MouseEvent) => {
|
|
86
88
|
event.stopPropagation();
|
|
@@ -237,7 +237,7 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
|
|
|
237
237
|
|
|
238
238
|
{disabled && onHover && disabledTooltip &&
|
|
239
239
|
<div className="absolute top-1 right-1 text-xs">
|
|
240
|
-
<Tooltip title={disabledTooltip}>
|
|
240
|
+
<Tooltip title={disabledTooltip} >
|
|
241
241
|
<RemoveCircleIcon size={"smallest"} color={"disabled"} className={"text-gray-500"}/>
|
|
242
242
|
</Tooltip>
|
|
243
243
|
</div>}
|
|
@@ -11,7 +11,14 @@ export interface EntityTableCellActionsProps {
|
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export function EntityTableCellActions({
|
|
14
|
+
export function EntityTableCellActions({
|
|
15
|
+
showError,
|
|
16
|
+
disabled,
|
|
17
|
+
showExpandIcon,
|
|
18
|
+
selected,
|
|
19
|
+
openPopup,
|
|
20
|
+
children
|
|
21
|
+
}: EntityTableCellActionsProps) {
|
|
15
22
|
|
|
16
23
|
const ref = useRef<HTMLDivElement>(null);
|
|
17
24
|
const doOpenPopup = useCallback(() => {
|
|
@@ -54,13 +61,18 @@ export function EntityTableCellActions({ showError, disabled, showExpandIcon, se
|
|
|
54
61
|
|
|
55
62
|
{showError && <ErrorTooltip
|
|
56
63
|
side={"left"}
|
|
57
|
-
className={"flex items-center justify-center"}
|
|
58
|
-
style={{ width: 32, height: 32 }}
|
|
59
64
|
title={showError.message}>
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
<div
|
|
66
|
+
className={"flex items-center justify-center"}
|
|
67
|
+
style={{
|
|
68
|
+
width: 32,
|
|
69
|
+
height: 32
|
|
70
|
+
}}>
|
|
71
|
+
<ErrorOutlineIcon
|
|
72
|
+
size={"small"}
|
|
73
|
+
color={"error"}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
64
76
|
</ErrorTooltip>
|
|
65
77
|
}
|
|
66
78
|
|
|
@@ -781,7 +781,7 @@ function EntityIdHeaderWidget({
|
|
|
781
781
|
const [searchString, setSearchString] = React.useState("");
|
|
782
782
|
const sideEntityController = useSideEntityController();
|
|
783
783
|
return (
|
|
784
|
-
<Tooltip title={!openPopup ? "Find by ID" : undefined}>
|
|
784
|
+
<Tooltip title={!openPopup ? "Find by ID" : undefined} asChild={false}>
|
|
785
785
|
<Popover
|
|
786
786
|
open={openPopup}
|
|
787
787
|
onOpenChange={setOpenPopup}
|
|
@@ -143,11 +143,11 @@ export function EntityPreview({
|
|
|
143
143
|
</div>
|
|
144
144
|
|
|
145
145
|
{entity && includeEntityLink &&
|
|
146
|
-
<Tooltip title={`See details for ${entity.id}`}
|
|
147
|
-
className={size !== "smallest" ? "self-start" : ""}>
|
|
146
|
+
<Tooltip title={`See details for ${entity.id}`}>
|
|
148
147
|
<IconButton
|
|
149
148
|
color={"inherit"}
|
|
150
149
|
size={"small"}
|
|
150
|
+
className={size !== "smallest" ? "self-start" : ""}
|
|
151
151
|
onClick={(e) => {
|
|
152
152
|
e.stopPropagation();
|
|
153
153
|
analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ContentCopyIcon, IconButton, Tooltip, Typography } from "@firecms/ui";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
|
|
4
|
+
export function PropertyIdCopyTooltip({
|
|
5
|
+
propertyKey,
|
|
6
|
+
className,
|
|
7
|
+
children
|
|
8
|
+
}: {
|
|
9
|
+
propertyKey: string,
|
|
10
|
+
className?: string,
|
|
11
|
+
children: React.ReactNode
|
|
12
|
+
}) {
|
|
13
|
+
return <Tooltip title={<PropertyIdCopyTooltipContent propertyKey={propertyKey}/>}
|
|
14
|
+
delayDuration={800}
|
|
15
|
+
side={"top"}
|
|
16
|
+
asChild={false}
|
|
17
|
+
align={"start"}
|
|
18
|
+
sideOffset={8}
|
|
19
|
+
className={className}>
|
|
20
|
+
{children}
|
|
21
|
+
</Tooltip>
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function PropertyIdCopyTooltipContent({ propertyKey }: { propertyKey: string }) {
|
|
26
|
+
|
|
27
|
+
const [copied, setCopied] = useState(false);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className={"flex flex-row gap-2 items-center justify-center text-white"}>
|
|
31
|
+
<div>
|
|
32
|
+
<Typography variant={"caption"} className={"min-w-20 text-slate-400"}
|
|
33
|
+
color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
|
|
34
|
+
<Typography variant={"caption"} className={"text-white"}><code>{propertyKey}</code></Typography>
|
|
35
|
+
</div>
|
|
36
|
+
<IconButton size={"small"}>
|
|
37
|
+
<ContentCopyIcon size={"smallest"}
|
|
38
|
+
className={"text-white"}
|
|
39
|
+
onClick={useCallback(() => {
|
|
40
|
+
navigator.clipboard.writeText(propertyKey);
|
|
41
|
+
setCopied(true);
|
|
42
|
+
setTimeout(() => setCopied(false), 2000);
|
|
43
|
+
}, [propertyKey])}
|
|
44
|
+
/>
|
|
45
|
+
</IconButton>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -60,7 +60,8 @@ export function SearchIconsView({
|
|
|
60
60
|
<div className={"flex max-w-full flex-wrap mt-4"}>
|
|
61
61
|
{icons.map((icon: string) => {
|
|
62
62
|
return (
|
|
63
|
-
<Tooltip title={icon} key={icon}
|
|
63
|
+
<Tooltip title={icon} key={icon}
|
|
64
|
+
asChild={true}>
|
|
64
65
|
<IconButton
|
|
65
66
|
shape={"square"}
|
|
66
67
|
toggled={selectedIcon === icon}
|
package/src/components/index.tsx
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./EntityCollectionView/EntityCollectionViewActions";
|
|
|
19
19
|
export * from "./EntityCollectionView/useSelectionController";
|
|
20
20
|
|
|
21
21
|
export * from "./PropertyConfigBadge";
|
|
22
|
+
export * from "./PropertyIdCopyTooltip";
|
|
22
23
|
|
|
23
24
|
export * from "./EntityCollectionTable";
|
|
24
25
|
export * from "./NotFoundPage";
|
|
@@ -124,7 +124,7 @@ export const DefaultAppBar = function DefaultAppBar({
|
|
|
124
124
|
{typeof title === "string"
|
|
125
125
|
? <Typography variant="subtitle1"
|
|
126
126
|
noWrap
|
|
127
|
-
className={"
|
|
127
|
+
className={cls("!font-medium", drawerOpen ? "ml-2" : "")}>
|
|
128
128
|
{title}
|
|
129
129
|
</Typography>
|
|
130
130
|
: title}
|
|
@@ -24,34 +24,36 @@ export function DrawerNavigationItem({
|
|
|
24
24
|
{icon}
|
|
25
25
|
</div>;
|
|
26
26
|
|
|
27
|
-
const listItem = <
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
const listItem = <div>
|
|
28
|
+
<NavLink
|
|
29
|
+
onClick={onClick}
|
|
30
|
+
style={{
|
|
31
|
+
width: !drawerOpen ? "72px" : "280px",
|
|
32
|
+
transition: drawerOpen ? "width 150ms ease-in" : undefined
|
|
33
|
+
}}
|
|
34
|
+
className={({ isActive }: any) => cls("rounded-r-lg truncate",
|
|
35
|
+
"hover:bg-slate-300 hover:bg-opacity-75 dark:hover:bg-gray-700 dark:hover:bg-opacity-75 text-gray-800 dark:text-gray-200 hover:text-gray-900 hover:dark:text-white",
|
|
36
|
+
"flex flex-row items-center mr-8",
|
|
37
|
+
// "transition-all ease-in-out delay-100 duration-300",
|
|
38
|
+
// drawerOpen ? "w-full" : "w-18",
|
|
39
|
+
drawerOpen ? "pl-8 h-12" : "pl-6 h-11",
|
|
40
|
+
"font-medium text-sm",
|
|
41
|
+
isActive ? "bg-slate-200 bg-opacity-60 dark:bg-gray-800 dark:bg-opacity-30" : ""
|
|
42
|
+
)}
|
|
43
|
+
to={url}
|
|
44
|
+
>
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
{iconWrap}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
<div
|
|
49
|
+
className={cls(
|
|
50
|
+
drawerOpen ? "opacity-100" : "opacity-0 hidden",
|
|
51
|
+
"ml-4 font-inherit text-inherit"
|
|
52
|
+
)}>
|
|
53
|
+
{name.toUpperCase()}
|
|
54
|
+
</div>
|
|
55
|
+
</NavLink>
|
|
56
|
+
</div>;
|
|
55
57
|
|
|
56
58
|
return <Tooltip
|
|
57
59
|
open={drawerOpen ? false : tooltipsOpen}
|
|
@@ -64,7 +64,6 @@ import {
|
|
|
64
64
|
paperMixin,
|
|
65
65
|
Tab,
|
|
66
66
|
Tabs,
|
|
67
|
-
Tooltip,
|
|
68
67
|
Typography
|
|
69
68
|
} from "@firecms/ui";
|
|
70
69
|
import { useSideDialogContext } from "./index";
|
|
@@ -73,8 +72,7 @@ import { useAnalyticsController } from "../hooks/useAnalyticsController";
|
|
|
73
72
|
import { CustomIdField } from "../form/components/CustomIdField";
|
|
74
73
|
import { CustomFieldValidator, getYupEntitySchema } from "../form/validation";
|
|
75
74
|
import { ErrorFocus } from "../form/components/ErrorFocus";
|
|
76
|
-
import {
|
|
77
|
-
import { LabelWithIcon, PropertyFieldBinding } from "../form";
|
|
75
|
+
import { LabelWithIconAndTooltip, PropertyFieldBinding } from "../form";
|
|
78
76
|
import { ValidationError } from "yup";
|
|
79
77
|
|
|
80
78
|
const MAIN_TAB_VALUE = "main_##Q$SC^#S6";
|
|
@@ -764,13 +762,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
764
762
|
<div id={`form_field_${key}`}
|
|
765
763
|
key={`field_${resolvedCollection.name}_${key}`}>
|
|
766
764
|
<ErrorBoundary>
|
|
767
|
-
<
|
|
768
|
-
delayDuration={800}
|
|
769
|
-
side={"left"}
|
|
770
|
-
align={"start"}
|
|
771
|
-
sideOffset={16}>
|
|
772
|
-
<PropertyFieldBinding {...cmsFormFieldProps}/>
|
|
773
|
-
</Tooltip>
|
|
765
|
+
<PropertyFieldBinding {...cmsFormFieldProps}/>
|
|
774
766
|
</ErrorBoundary>
|
|
775
767
|
</div>
|
|
776
768
|
);
|
|
@@ -791,9 +783,11 @@ export function EntityEditViewInner<M extends Record<string, any>>({
|
|
|
791
783
|
})}</>;
|
|
792
784
|
return (
|
|
793
785
|
<div>
|
|
794
|
-
<
|
|
795
|
-
|
|
796
|
-
|
|
786
|
+
<LabelWithIconAndTooltip
|
|
787
|
+
propertyKey={key}
|
|
788
|
+
icon={<NotesIcon size={"small"}/>}
|
|
789
|
+
title={additionalField.name}
|
|
790
|
+
className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>
|
|
797
791
|
<div
|
|
798
792
|
className={cls(paperMixin, "min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar")}>
|
|
799
793
|
|
|
@@ -68,7 +68,8 @@ export function CustomIdField<M extends Record<string, any>>({
|
|
|
68
68
|
? (
|
|
69
69
|
<>
|
|
70
70
|
|
|
71
|
-
<Tooltip title={"Copy"}
|
|
71
|
+
<Tooltip title={"Copy"}
|
|
72
|
+
asChild={true}>
|
|
72
73
|
<IconButton onClick={(e) => copy(entity.id)}
|
|
73
74
|
aria-label="copy-id">
|
|
74
75
|
<ContentCopyIcon size={"small"}/>
|
|
@@ -76,7 +77,8 @@ export function CustomIdField<M extends Record<string, any>>({
|
|
|
76
77
|
</Tooltip>
|
|
77
78
|
|
|
78
79
|
{customizationController?.entityLinkBuilder &&
|
|
79
|
-
<Tooltip title={"Open in the console"}
|
|
80
|
+
<Tooltip title={"Open in the console"}
|
|
81
|
+
asChild={true}>
|
|
80
82
|
<IconButton component={"a"}
|
|
81
83
|
href={customizationController.entityLinkBuilder({ entity })}
|
|
82
84
|
rel="noopener noreferrer"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
|
|
3
3
|
interface LabelWithIconProps {
|
|
4
4
|
icon: React.ReactNode;
|
|
@@ -12,22 +12,30 @@ interface LabelWithIconProps {
|
|
|
12
12
|
* Render the label of with an icon and the title of a property
|
|
13
13
|
* @group Form custom fields
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
export const LabelWithIcon = forwardRef<HTMLDivElement, LabelWithIconProps>(
|
|
16
|
+
({
|
|
17
|
+
icon,
|
|
18
|
+
title,
|
|
19
|
+
small,
|
|
20
|
+
className,
|
|
21
|
+
required
|
|
22
|
+
}, ref) => {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={`inline-flex items-center my-0.5 ${small ? "gap-1" : "gap-2"} ${className ?? ""}`}
|
|
27
|
+
>
|
|
28
|
+
{icon}
|
|
29
|
+
<span
|
|
30
|
+
className={`text-start font-medium text-${small ? "base" : "sm"} origin-top-left transform ${
|
|
31
|
+
small ? "translate-x-2 scale-75" : ""
|
|
32
|
+
}`}
|
|
33
|
+
>
|
|
34
|
+
{(title ?? "") + (required ? " *" : "")}
|
|
31
35
|
</span>
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
LabelWithIcon.displayName = "LabelWithIcon";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LabelWithIcon } from "./LabelWithIcon";
|
|
3
|
+
import { PropertyIdCopyTooltip } from "../../components/PropertyIdCopyTooltip";
|
|
4
|
+
|
|
5
|
+
interface LabelWithIconAndTooltip {
|
|
6
|
+
icon: React.ReactNode;
|
|
7
|
+
title?: string;
|
|
8
|
+
small?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
propertyKey: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Render the label of with an icon and the title of a property
|
|
16
|
+
* @group Form custom fields
|
|
17
|
+
*/
|
|
18
|
+
export function LabelWithIconAndTooltip({
|
|
19
|
+
propertyKey,
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: LabelWithIconAndTooltip) {
|
|
23
|
+
return (
|
|
24
|
+
<PropertyIdCopyTooltip propertyKey={propertyKey} className={className}>
|
|
25
|
+
<LabelWithIcon {...props}/>
|
|
26
|
+
</PropertyIdCopyTooltip>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -4,7 +4,6 @@ import { useSnackbarController, useStorageSource } from "../../hooks";
|
|
|
4
4
|
import { StorageFieldItem } from "../../util/useStorageUploadController";
|
|
5
5
|
import { ErrorView } from "../../components";
|
|
6
6
|
import { cls, paperMixin, Skeleton } from "@firecms/ui";
|
|
7
|
-
import { EntityCollection, StorageSource } from "../../types";
|
|
8
7
|
|
|
9
8
|
export interface StorageUploadItemProps {
|
|
10
9
|
storagePath: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FieldProps } from "../../types";
|
|
3
|
-
import { FieldHelperText,
|
|
3
|
+
import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
|
|
4
4
|
import { PropertyFieldBinding } from "../PropertyFieldBinding";
|
|
5
5
|
import { ExpandablePanel, Typography } from "@firecms/ui";
|
|
6
6
|
import { getIconForProperty } from "../../util";
|
|
@@ -40,10 +40,12 @@ export function ArrayCustomShapedFieldBinding<T extends Array<any>>({
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
const title = (<>
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
<LabelWithIconAndTooltip
|
|
44
|
+
propertyKey={propertyKey}
|
|
45
|
+
icon={getIconForProperty(property, "small")}
|
|
46
|
+
required={property.validation?.required}
|
|
47
|
+
title={property.name}
|
|
48
|
+
className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
|
|
47
49
|
{Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
|
|
48
50
|
</>);
|
|
49
51
|
|
|
@@ -1,7 +1,7 @@
|
|
|
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, LabelWithIconAndTooltip } from "../components";
|
|
5
5
|
import { ErrorView } from "../../components";
|
|
6
6
|
import { getIconForProperty, getReferenceFrom } from "../../util";
|
|
7
7
|
|
|
@@ -80,25 +80,27 @@ export function ArrayOfReferencesFieldBinding({
|
|
|
80
80
|
if (!entryValue)
|
|
81
81
|
return <div>Internal ERROR</div>;
|
|
82
82
|
return (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
<ReferencePreview
|
|
84
|
+
key={internalId}
|
|
85
|
+
disabled={!ofProperty.path}
|
|
86
|
+
previewProperties={ofProperty.previewProperties}
|
|
87
|
+
size={"medium"}
|
|
88
|
+
onClick={onEntryClick}
|
|
89
|
+
hover={!disabled}
|
|
90
|
+
reference={entryValue}
|
|
91
|
+
includeId={ofProperty.includeId}
|
|
92
|
+
includeEntityLink={ofProperty.includeEntityLink}
|
|
93
|
+
/>
|
|
94
94
|
);
|
|
95
95
|
}, [ofProperty.path, ofProperty.previewProperties, value]);
|
|
96
96
|
|
|
97
97
|
const title = (<>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
<LabelWithIconAndTooltip
|
|
99
|
+
propertyKey={propertyKey}
|
|
100
|
+
icon={getIconForProperty(property, "small")}
|
|
101
|
+
required={property.validation?.required}
|
|
102
|
+
title={property.name}
|
|
103
|
+
className={"flex-grow text-text-secondary dark:text-text-secondary-dark"}/>
|
|
102
104
|
{Array.isArray(value) && <Typography variant={"caption"} className={"px-4"}>({value.length})</Typography>}
|
|
103
105
|
</>);
|
|
104
106
|
|