@rebasepro/admin 0.7.0 → 0.8.0
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/LICENSE +21 -0
- package/dist/{CollectionEditorDialog-iGgS4rLX.js → CollectionEditorDialog-BO_aQ-Z4.js} +7 -7
- package/dist/CollectionEditorDialog-BO_aQ-Z4.js.map +1 -0
- package/dist/{PropertyEditView-C9yhLyja.js → PropertyEditView-DKzOpMjR.js} +64 -38
- package/dist/PropertyEditView-DKzOpMjR.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-Dqx27GD8.js → RouterCollectionsStudioView-BQTIExjA.js} +4 -4
- package/dist/{RouterCollectionsStudioView-Dqx27GD8.js.map → RouterCollectionsStudioView-BQTIExjA.js.map} +1 -1
- package/dist/collection_editor/_cms_internals.d.ts +1 -1
- package/dist/collection_editor/api/generateCollectionApi.d.ts +3 -2
- package/dist/collection_editor/serializable_types.d.ts +5 -9
- package/dist/collection_editor/serializable_utils.d.ts +2 -2
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +1 -2
- package/dist/collection_editor_ui.js +4 -4
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/index.d.ts +1 -1
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +12 -21
- package/dist/components/field_configs.d.ts +1 -1
- package/dist/editor/editor.d.ts +0 -6
- package/dist/editor.js +1 -3
- package/dist/editor.js.map +1 -1
- package/dist/form/components/StorageUploadProgress.d.ts +6 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/{history-ChHgyyvM.js → history-B3cqBzEV.js} +2 -2
- package/dist/{history-ChHgyyvM.js.map → history-B3cqBzEV.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/preview/components/StorageThumbnail.d.ts +3 -1
- package/dist/{src-DOX2nOyh.js → src-cxV1ODRG.js} +178 -460
- package/dist/src-cxV1ODRG.js.map +1 -0
- package/dist/types/components/PropertyPreviewProps.d.ts +2 -1
- package/dist/types/fields.d.ts +4 -6
- package/package.json +18 -18
- package/src/collection_editor/_cms_internals.ts +1 -1
- package/src/collection_editor/api/generateCollectionApi.ts +3 -2
- package/src/collection_editor/pgColumnToProperty.ts +2 -2
- package/src/collection_editor/serializable_types.ts +14 -27
- package/src/collection_editor/serializable_utils.ts +25 -37
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +41 -24
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +0 -9
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +35 -1
- package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +1 -1
- package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +0 -1
- package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +7 -29
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +2 -2
- package/src/components/DefaultDrawer.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +11 -9
- package/src/components/EntityCollectionTable/fields/TableMultipleRelationField.tsx +2 -1
- package/src/components/EntityCollectionTable/fields/TableRelationField.tsx +2 -1
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +23 -20
- package/src/components/EntityCollectionTable/index.tsx +1 -1
- package/src/components/EntityCollectionTable/table_bindings.tsx +24 -44
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +1 -1
- package/src/components/EntityCollectionView/EntityCollectionListView.tsx +12 -1
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +8 -25
- package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
- package/src/components/EntityCollectionView/useBoardDataController.tsx +12 -40
- package/src/components/EntityCollectionView/useEntityPreviewSlots.ts +3 -3
- package/src/components/EntityDetailView.tsx +2 -2
- package/src/components/EntityEditView.tsx +2 -2
- package/src/components/EntityEditViewFormActions.tsx +3 -3
- package/src/components/HomePage/ContentHomePage.tsx +1 -1
- package/src/components/RebaseCMS.tsx +2 -3
- package/src/components/RebaseNavigation.tsx +3 -2
- package/src/components/RelationSelector.tsx +2 -2
- package/src/components/SelectableTable/SelectableTable.tsx +11 -3
- package/src/components/SelectableTable/SelectionStore.ts +18 -48
- package/src/components/common/default_entity_actions.tsx +15 -4
- package/src/components/field_configs.tsx +0 -14
- package/src/editor/editor.tsx +4 -7
- package/src/form/EntityFormActions.tsx +2 -2
- package/src/form/EntityFormBinding.tsx +1 -1
- package/src/form/components/StorageUploadProgress.tsx +9 -2
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +12 -1
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +4 -4
- package/src/form/field_bindings/RelationFieldBinding.tsx +5 -7
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +19 -15
- package/src/form/index.tsx +0 -1
- package/src/index.ts +1 -1
- package/src/preview/PropertyPreview.tsx +1 -16
- package/src/preview/components/StorageThumbnail.tsx +24 -7
- package/src/types/components/PropertyPreviewProps.tsx +1 -1
- package/src/types/fields.tsx +2 -7
- package/src/util/previews.ts +20 -0
- package/src/util/propertyConfigMapper.ts +3 -3
- package/src/util/property_utils.tsx +1 -2
- package/dist/CollectionEditorDialog-iGgS4rLX.js.map +0 -1
- package/dist/PropertyEditView-C9yhLyja.js.map +0 -1
- package/dist/components/EntityCollectionTable/fields/VirtualTableDateField.d.ts +0 -12
- package/dist/components/EntityCollectionTable/fields/VirtualTableInput.d.ts +0 -10
- package/dist/components/EntityCollectionTable/fields/VirtualTableNumberInput.d.ts +0 -9
- package/dist/components/EntityCollectionTable/fields/VirtualTableSwitch.d.ts +0 -8
- package/dist/form/field_bindings/ReferenceAsStringFieldBinding.d.ts +0 -11
- package/dist/src-DOX2nOyh.js.map +0 -1
- package/src/components/EntityCollectionTable/fields/VirtualTableDateField.tsx +0 -39
- package/src/components/EntityCollectionTable/fields/VirtualTableInput.tsx +0 -90
- package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +0 -83
- package/src/components/EntityCollectionTable/fields/VirtualTableSwitch.tsx +0 -32
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +0 -141
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { cls, DateTimeField, focusedDisabled } from "@rebasepro/ui";
|
|
3
|
-
import { useCustomizationController } from "@rebasepro/core";
|
|
4
|
-
|
|
5
|
-
export function VirtualTableDateField(props: {
|
|
6
|
-
name: string;
|
|
7
|
-
error: Error | undefined;
|
|
8
|
-
mode?: "date" | "date_time";
|
|
9
|
-
timezone?: string;
|
|
10
|
-
internalValue: Date | undefined | null;
|
|
11
|
-
updateValue: (newValue: (Date | null)) => void;
|
|
12
|
-
focused: boolean;
|
|
13
|
-
disabled: boolean;
|
|
14
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
15
|
-
}) {
|
|
16
|
-
|
|
17
|
-
const { locale } = useCustomizationController();
|
|
18
|
-
const {
|
|
19
|
-
disabled,
|
|
20
|
-
error,
|
|
21
|
-
mode,
|
|
22
|
-
timezone,
|
|
23
|
-
internalValue,
|
|
24
|
-
updateValue
|
|
25
|
-
} = props;
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<DateTimeField
|
|
29
|
-
value={internalValue ?? undefined}
|
|
30
|
-
onChange={(dateValue) => updateValue(dateValue ?? null)}
|
|
31
|
-
invisible={true}
|
|
32
|
-
inputClassName={cls("w-full h-full", focusedDisabled)}
|
|
33
|
-
className={cls("w-full h-full", focusedDisabled)}
|
|
34
|
-
mode={mode}
|
|
35
|
-
timezone={timezone}
|
|
36
|
-
locale={locale}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { useDebouncedCallback, focusedDisabled, TextareaAutosize } from "@rebasepro/ui";
|
|
4
|
-
|
|
5
|
-
export function VirtualTableInput(props: {
|
|
6
|
-
error: Error | undefined;
|
|
7
|
-
value: string;
|
|
8
|
-
multiline: boolean;
|
|
9
|
-
focused: boolean;
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
updateValue: (newValue: (string | null)) => void;
|
|
12
|
-
onBlur?: () => void;
|
|
13
|
-
}) {
|
|
14
|
-
|
|
15
|
-
const ref = React.useRef<HTMLTextAreaElement>(null);
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
disabled,
|
|
19
|
-
value,
|
|
20
|
-
multiline,
|
|
21
|
-
updateValue,
|
|
22
|
-
focused
|
|
23
|
-
} = props;
|
|
24
|
-
|
|
25
|
-
const prevValue = useRef<string | null>(value);
|
|
26
|
-
|
|
27
|
-
const [internalValue, setInternalValue] = useState<typeof value>(value);
|
|
28
|
-
const focusedState = useRef<boolean>(false);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (prevValue.current !== value && value !== internalValue)
|
|
32
|
-
setInternalValue(value);
|
|
33
|
-
prevValue.current = value;
|
|
34
|
-
}, [value]);
|
|
35
|
-
|
|
36
|
-
const doUpdate = React.useCallback(() => {
|
|
37
|
-
const emptyInitialValue = !value;
|
|
38
|
-
if (emptyInitialValue && !internalValue)
|
|
39
|
-
return;
|
|
40
|
-
if (internalValue !== value && internalValue !== prevValue.current) {
|
|
41
|
-
prevValue.current = internalValue;
|
|
42
|
-
updateValue(internalValue);
|
|
43
|
-
}
|
|
44
|
-
}, [internalValue, updateValue, value]);
|
|
45
|
-
useDebouncedCallback(internalValue, doUpdate, !focused, 400);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (ref.current && focused && !focusedState.current) {
|
|
48
|
-
focusedState.current = true;
|
|
49
|
-
ref.current.focus({ preventScroll: true });
|
|
50
|
-
ref.current.selectionStart = ref.current.value.length;
|
|
51
|
-
ref.current.selectionEnd = ref.current.value.length;
|
|
52
|
-
} else {
|
|
53
|
-
focusedState.current = focused;
|
|
54
|
-
}
|
|
55
|
-
}, [focused, ref]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<TextareaAutosize
|
|
59
|
-
className={focusedDisabled}
|
|
60
|
-
ref={ref}
|
|
61
|
-
style={{
|
|
62
|
-
padding: 0,
|
|
63
|
-
margin: 0,
|
|
64
|
-
width: "100%",
|
|
65
|
-
color: "unset",
|
|
66
|
-
fontWeight: "unset",
|
|
67
|
-
fontSize: "unset",
|
|
68
|
-
fontFamily: "unset",
|
|
69
|
-
background: "unset",
|
|
70
|
-
border: "unset",
|
|
71
|
-
resize: "none",
|
|
72
|
-
outline: "none"
|
|
73
|
-
}}
|
|
74
|
-
value={internalValue ?? ""}
|
|
75
|
-
onChange={(evt) => {
|
|
76
|
-
const newValue = evt.target.value as string;
|
|
77
|
-
if (multiline || !newValue.endsWith("\n"))
|
|
78
|
-
setInternalValue(newValue);
|
|
79
|
-
}}
|
|
80
|
-
onFocus={() => {
|
|
81
|
-
focusedState.current = true;
|
|
82
|
-
}}
|
|
83
|
-
onBlur={() => {
|
|
84
|
-
focusedState.current = false;
|
|
85
|
-
doUpdate();
|
|
86
|
-
if (props.onBlur) props.onBlur();
|
|
87
|
-
}}
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { useDebouncedCallback, cls, focusedDisabled, TextField } from "@rebasepro/ui";
|
|
3
|
-
|
|
4
|
-
export function VirtualTableNumberInput(props: {
|
|
5
|
-
error: Error | undefined;
|
|
6
|
-
value: number;
|
|
7
|
-
align: "right" | "left" | "center";
|
|
8
|
-
updateValue: (newValue: (number | null)) => void;
|
|
9
|
-
focused: boolean;
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
}) {
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
align,
|
|
15
|
-
value,
|
|
16
|
-
updateValue,
|
|
17
|
-
focused
|
|
18
|
-
} = props;
|
|
19
|
-
const propStringValue = (value && typeof value === "number") ? value.toString() : "";
|
|
20
|
-
const [internalValue, setInternalValue] = useState<string | null>(propStringValue);
|
|
21
|
-
|
|
22
|
-
const prevValue = useRef<number | null>(value);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (prevValue.current !== value && String(value) !== internalValue)
|
|
26
|
-
setInternalValue(value ? value.toString() : null);
|
|
27
|
-
prevValue.current = value;
|
|
28
|
-
}, [value]);
|
|
29
|
-
|
|
30
|
-
const doUpdate = React.useCallback(() => {
|
|
31
|
-
if (internalValue !== propStringValue) {
|
|
32
|
-
if (internalValue !== undefined && internalValue !== null) {
|
|
33
|
-
const numberValue = parseFloat(internalValue);
|
|
34
|
-
if (isNaN(numberValue))
|
|
35
|
-
return;
|
|
36
|
-
if (numberValue !== undefined && numberValue !== null)
|
|
37
|
-
updateValue(numberValue);
|
|
38
|
-
} else {
|
|
39
|
-
updateValue(null);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}, [internalValue, value]);
|
|
44
|
-
useDebouncedCallback(internalValue, doUpdate, !focused, 400);
|
|
45
|
-
useEffect(
|
|
46
|
-
() => {
|
|
47
|
-
if (!focused && propStringValue !== internalValue)
|
|
48
|
-
setInternalValue(value !== undefined && value !== null ? value.toString() : null);
|
|
49
|
-
},
|
|
50
|
-
[value, focused]
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (inputRef.current && focused) {
|
|
57
|
-
inputRef.current.focus({ preventScroll: true });
|
|
58
|
-
}
|
|
59
|
-
}, [focused, inputRef]);
|
|
60
|
-
|
|
61
|
-
const regexp = /^-?[0-9]+[,.]?[0-9]*$/;
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<TextField
|
|
65
|
-
inputRef={inputRef}
|
|
66
|
-
invisible={true}
|
|
67
|
-
size="small"
|
|
68
|
-
className="w-full"
|
|
69
|
-
inputClassName={cls("p-0 m-0 bg-transparent border-none outline-hidden font-normal leading-normal text-unset", focusedDisabled)}
|
|
70
|
-
inputStyle={{
|
|
71
|
-
textAlign: align
|
|
72
|
-
}}
|
|
73
|
-
value={internalValue ?? ""}
|
|
74
|
-
onChange={(evt) => {
|
|
75
|
-
const newValue = evt.target.value.replace(",", ".");
|
|
76
|
-
if (newValue.length === 0)
|
|
77
|
-
setInternalValue(null);
|
|
78
|
-
if (regexp.test(newValue) || newValue.startsWith("-"))
|
|
79
|
-
setInternalValue(newValue);
|
|
80
|
-
}}
|
|
81
|
-
/>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from "react";
|
|
2
|
-
import { BooleanSwitch } from "@rebasepro/ui";
|
|
3
|
-
|
|
4
|
-
export function VirtualTableSwitch(props: {
|
|
5
|
-
error: Error | undefined;
|
|
6
|
-
internalValue?: boolean;
|
|
7
|
-
focused: boolean;
|
|
8
|
-
disabled: boolean;
|
|
9
|
-
updateValue: (newValue: (boolean | null)) => void;
|
|
10
|
-
}) {
|
|
11
|
-
const {
|
|
12
|
-
internalValue,
|
|
13
|
-
updateValue,
|
|
14
|
-
focused
|
|
15
|
-
} = props;
|
|
16
|
-
const ref = React.useRef<HTMLButtonElement>(null);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (ref.current && focused) {
|
|
20
|
-
ref.current.focus({ preventScroll: true });
|
|
21
|
-
}
|
|
22
|
-
}, [focused, ref]);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<BooleanSwitch
|
|
26
|
-
ref={ref}
|
|
27
|
-
size={"small"}
|
|
28
|
-
value={Boolean(internalValue)}
|
|
29
|
-
onValueChange={updateValue}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { useEntitySelectionDialog } from "../../hooks/useEntitySelectionDialog";
|
|
2
|
-
import type { EntityCollection } from "@rebasepro/types";
|
|
3
|
-
import type { FieldProps } from "../../types/fields";
|
|
4
|
-
import type { Property, StringProperty } from "@rebasepro/types";
|
|
5
|
-
import React, { useCallback, useMemo } from "react";
|
|
6
|
-
import { Entity, EntityReference } from "@rebasepro/types";
|
|
7
|
-
import { ReadOnlyFieldBinding } from "./ReadOnlyFieldBinding";
|
|
8
|
-
import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
|
|
9
|
-
import { ErrorView } from "@rebasepro/core";
|
|
10
|
-
import { ReferencePreview } from "../../preview";
|
|
11
|
-
import { IconForView } from "@rebasepro/core";
|
|
12
|
-
import { getIconForProperty } from "../../util/property_utils";
|
|
13
|
-
import { useClearRestoreValue } from "../useClearRestoreValue";
|
|
14
|
-
import { EntityPreviewContainer } from "../../components/EntityPreview";
|
|
15
|
-
import { cls } from "@rebasepro/ui";
|
|
16
|
-
import { useCollectionRegistryController } from "../../index";
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Field that opens a reference selection dialog and stores the entity ID as a string.
|
|
20
|
-
*
|
|
21
|
-
* This is one of the internal components that get mapped natively inside forms
|
|
22
|
-
* and tables to the specified properties.
|
|
23
|
-
* @group Form fields
|
|
24
|
-
*/
|
|
25
|
-
export function ReferenceAsStringFieldBinding(props: FieldProps<StringProperty>) {
|
|
26
|
-
if (typeof props.property.reference?.path !== "string") {
|
|
27
|
-
return <ReadOnlyFieldBinding {...props as FieldProps<Property>}/>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return <ReferenceAsStringFieldBindingInternal {...props}/>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function ReferenceAsStringFieldBindingInternal({
|
|
34
|
-
propertyKey,
|
|
35
|
-
value,
|
|
36
|
-
setValue,
|
|
37
|
-
error,
|
|
38
|
-
showError,
|
|
39
|
-
isSubmitting,
|
|
40
|
-
disabled,
|
|
41
|
-
minimalistView,
|
|
42
|
-
property,
|
|
43
|
-
includeDescription,
|
|
44
|
-
size = "medium"
|
|
45
|
-
}: FieldProps<StringProperty>) {
|
|
46
|
-
if (!property.reference?.path) {
|
|
47
|
-
throw new Error("Property path is required for ReferenceAsStringFieldBinding");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
useClearRestoreValue({
|
|
51
|
-
property,
|
|
52
|
-
value,
|
|
53
|
-
setValue
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const collectionRegistryController = useCollectionRegistryController();
|
|
57
|
-
const path = property.reference!.path;
|
|
58
|
-
const collection: EntityCollection | undefined = useMemo(() => {
|
|
59
|
-
return path ? collectionRegistryController.getCollection(path) : undefined;
|
|
60
|
-
}, [path]);
|
|
61
|
-
|
|
62
|
-
const referenceValue: EntityReference | undefined = useMemo(() => {
|
|
63
|
-
if (value && path) {
|
|
64
|
-
return new EntityReference({ id: value,
|
|
65
|
-
path });
|
|
66
|
-
}
|
|
67
|
-
return undefined;
|
|
68
|
-
}, [value, path]);
|
|
69
|
-
|
|
70
|
-
if (!collection) {
|
|
71
|
-
throw Error(`Couldn't find the corresponding collection for the path: ${path}`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const onSingleEntitySelected = useCallback((e: Entity<Record<string, unknown>> | null) => {
|
|
75
|
-
setValue(e ? String(e.id) : null);
|
|
76
|
-
}, [setValue]);
|
|
77
|
-
|
|
78
|
-
const referenceDialogController = useEntitySelectionDialog({
|
|
79
|
-
multiselect: false,
|
|
80
|
-
path,
|
|
81
|
-
collection,
|
|
82
|
-
onSingleEntitySelected,
|
|
83
|
-
selectedEntityIds: value ? [value] : undefined,
|
|
84
|
-
fixedFilter: property.reference?.fixedFilter
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const onEntryClick = (e: React.SyntheticEvent) => {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
referenceDialogController.open();
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<>
|
|
95
|
-
{!minimalistView && <LabelWithIconAndTooltip
|
|
96
|
-
propertyKey={propertyKey}
|
|
97
|
-
icon={getIconForProperty(property, "small")}
|
|
98
|
-
required={property.validation?.required}
|
|
99
|
-
title={property.name ?? propertyKey}
|
|
100
|
-
className={"h-8 text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
|
|
101
|
-
|
|
102
|
-
{!collection && <ErrorView
|
|
103
|
-
error={"The specified collection does not exist. Check console"}/>}
|
|
104
|
-
|
|
105
|
-
{collection && <>
|
|
106
|
-
|
|
107
|
-
{referenceValue && <ReferencePreview
|
|
108
|
-
disabled={!path}
|
|
109
|
-
previewProperties={property.reference?.ui?.previewProperties}
|
|
110
|
-
hover={!disabled}
|
|
111
|
-
size={size}
|
|
112
|
-
onClick={disabled || isSubmitting ? undefined : onEntryClick}
|
|
113
|
-
reference={referenceValue}
|
|
114
|
-
includeEntityLink={property.reference?.includeEntityLink}
|
|
115
|
-
includeId={property.reference?.includeId}
|
|
116
|
-
/>}
|
|
117
|
-
|
|
118
|
-
{!value && <div className="justify-center text-left">
|
|
119
|
-
<EntityPreviewContainer
|
|
120
|
-
className={cls("px-6 h-16 text-sm font-medium flex items-center gap-6",
|
|
121
|
-
disabled || isSubmitting
|
|
122
|
-
? "text-surface-accent-500"
|
|
123
|
-
: "cursor-pointer text-surface-accent-700 dark:text-surface-accent-300 hover:bg-surface-accent-50 dark:hover:bg-surface-800 group-hover:bg-surface-accent-50 dark:group-hover:bg-surface-800")}
|
|
124
|
-
onClick={onEntryClick}
|
|
125
|
-
size={"medium"}>
|
|
126
|
-
<IconForView collectionOrView={collection}
|
|
127
|
-
className={"text-surface-300 dark:text-surface-600"}/>
|
|
128
|
-
{`Edit ${property.name}`.toUpperCase()}
|
|
129
|
-
</EntityPreviewContainer>
|
|
130
|
-
</div>}
|
|
131
|
-
</>}
|
|
132
|
-
|
|
133
|
-
<FieldHelperText includeDescription={includeDescription}
|
|
134
|
-
showError={showError}
|
|
135
|
-
error={error}
|
|
136
|
-
disabled={disabled}
|
|
137
|
-
property={property}/>
|
|
138
|
-
|
|
139
|
-
</>
|
|
140
|
-
);
|
|
141
|
-
}
|