@firecms/core 3.0.0-canary.102 → 3.0.0-canary.104
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/popup_field/PopupFormField.d.ts +1 -1
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- 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/MarkdownEditorFieldBinding.d.ts +9 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
- package/dist/form/index.d.ts +2 -2
- package/dist/index.es.js +269 -817
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +268 -815
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +11 -1
- package/dist/types/datasource.d.ts +12 -12
- package/dist/types/entities.d.ts +1 -0
- package/dist/types/fields.d.ts +5 -13
- package/dist/types/navigation.d.ts +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/storage.d.ts +1 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +4 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -4
- package/src/components/common/useTableSearchHelper.ts +1 -0
- package/src/core/DefaultDrawer.tsx +1 -1
- package/src/core/EntityEditView.tsx +3 -4
- package/src/core/field_configs.tsx +2 -2
- package/src/form/PropertyFieldBinding.tsx +4 -8
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +4 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +3 -3
- package/src/form/field_bindings/BlockFieldBinding.tsx +5 -6
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +5 -5
- package/src/form/field_bindings/MapFieldBinding.tsx +6 -8
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +133 -0
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +5 -5
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +6 -7
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +2 -2
- package/src/form/index.tsx +2 -2
- package/src/hooks/data/save.ts +5 -1
- package/src/internal/useBuildDataSource.ts +29 -14
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/types/collections.ts +13 -1
- package/src/types/datasource.ts +13 -16
- package/src/types/entities.ts +2 -0
- package/src/types/fields.tsx +5 -15
- package/src/types/navigation.ts +1 -0
- package/src/util/index.ts +1 -0
- package/src/util/references.ts +3 -0
- package/src/util/storage.ts +1 -1
- package/src/util/useStorageUploadController.tsx +2 -2
- package/dist/form/PropertiesForm.d.ts +0 -8
- package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
- package/src/form/PropertiesForm.tsx +0 -81
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import { useCallback, useEffect, useState } from "react";
|
|
15
15
|
import { PreviewSize } from "../preview";
|
|
16
16
|
import { randomString } from "./strings";
|
|
17
|
-
import {
|
|
17
|
+
import { resolveStorageFilenameString, resolveStoragePathString } from "./storage";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Internal representation of an item in the storage
|
|
@@ -95,7 +95,7 @@ export function useStorageUploadController<M extends object>({
|
|
|
95
95
|
|
|
96
96
|
const fileNameBuilder = useCallback(async (file: File) => {
|
|
97
97
|
if (storage.fileName) {
|
|
98
|
-
const fileName = await
|
|
98
|
+
const fileName = await resolveStorageFilenameString({
|
|
99
99
|
input: storage.fileName,
|
|
100
100
|
storage,
|
|
101
101
|
values: entityValues,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PropertiesOrBuilders } from "../types";
|
|
2
|
-
import { FormexController } from "@firecms/formex";
|
|
3
|
-
export type PropertiesFormProps<M extends Record<string, any> = Record<string, any>> = {
|
|
4
|
-
properties: PropertiesOrBuilders<M>;
|
|
5
|
-
propertiesOrder?: string[];
|
|
6
|
-
formex: FormexController<M>;
|
|
7
|
-
};
|
|
8
|
-
export declare function PropertiesForm<M extends Record<string, any> = Record<string, any>>({ properties, propertiesOrder, formex }: PropertiesFormProps<M>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FieldProps } from "../../types";
|
|
2
|
-
/**
|
|
3
|
-
* Render a markdown field that allows edition and seeing the preview.
|
|
4
|
-
*
|
|
5
|
-
* This is one of the internal components that get mapped natively inside forms
|
|
6
|
-
* and tables to the specified properties.
|
|
7
|
-
* @group Form fields
|
|
8
|
-
*/
|
|
9
|
-
export declare function MarkdownFieldBinding({ propertyKey, value, setValue, error, showError, disabled, autoFocus, touched, property, tableMode, includeDescription, context }: FieldProps<string>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { FormContext, PropertiesOrBuilders, PropertyFieldBindingProps } from "../types";
|
|
2
|
-
import { Tooltip } from "@firecms/ui";
|
|
3
|
-
import { PropertyIdCopyTooltipContent } from "../components/PropertyIdCopyTooltipContent";
|
|
4
|
-
import { PropertyFieldBinding } from "./PropertyFieldBinding";
|
|
5
|
-
import { ErrorBoundary } from "../components";
|
|
6
|
-
import { isHidden, isReadOnly, resolveProperties } from "../util";
|
|
7
|
-
import { FormexController } from "@firecms/formex";
|
|
8
|
-
|
|
9
|
-
export type PropertiesFormProps<M extends Record<string, any> = Record<string, any>> = {
|
|
10
|
-
properties: PropertiesOrBuilders<M>;
|
|
11
|
-
propertiesOrder?: string[];
|
|
12
|
-
formex: FormexController<M>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function PropertiesForm<M extends Record<string, any> = Record<string, any>>({
|
|
16
|
-
properties,
|
|
17
|
-
propertiesOrder,
|
|
18
|
-
formex
|
|
19
|
-
}: PropertiesFormProps<M>) {
|
|
20
|
-
|
|
21
|
-
const resolvedProperties = resolveProperties({ properties });
|
|
22
|
-
|
|
23
|
-
const formContext: FormContext<M> = {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
setFieldValue: useCallback(formex.setFieldValue, []),
|
|
26
|
-
values: formex.values ?? {},
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
save: useCallback(() => {
|
|
29
|
-
throw new Error("Not implemented. You currently can't call save from a custom field, within a PropertiesForm (it works in standard Entity forms)");
|
|
30
|
-
}, []),
|
|
31
|
-
formex
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const formFields = (
|
|
35
|
-
<div className={"flex flex-col gap-8"}>
|
|
36
|
-
{(propertiesOrder ?? Object.keys(resolvedProperties))
|
|
37
|
-
.map((key) => {
|
|
38
|
-
|
|
39
|
-
const property = resolvedProperties[key];
|
|
40
|
-
if (!property) {
|
|
41
|
-
console.warn(`Property ${key} not found in collection PropertiesForm`);
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const disabled = formex.isSubmitting || isReadOnly(property) || Boolean(property.disabled);
|
|
46
|
-
const hidden = isHidden(property);
|
|
47
|
-
if (hidden) return null;
|
|
48
|
-
const cmsFormFieldProps: PropertyFieldBindingProps<any, M> = {
|
|
49
|
-
propertyKey: key,
|
|
50
|
-
disabled,
|
|
51
|
-
property,
|
|
52
|
-
includeDescription: property.description || property.longDescription,
|
|
53
|
-
context: formContext,
|
|
54
|
-
tableMode: false,
|
|
55
|
-
partOfArray: false,
|
|
56
|
-
partOfBlock: false,
|
|
57
|
-
autoFocus: false
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<div id={`form_field_${key}`}
|
|
62
|
-
key={`field_${key}`}>
|
|
63
|
-
<ErrorBoundary>
|
|
64
|
-
<Tooltip title={<PropertyIdCopyTooltipContent propertyId={key}/>}
|
|
65
|
-
delayDuration={800}
|
|
66
|
-
side={"left"}
|
|
67
|
-
align={"start"}
|
|
68
|
-
sideOffset={16}>
|
|
69
|
-
<PropertyFieldBinding {...cmsFormFieldProps}/>
|
|
70
|
-
</Tooltip>
|
|
71
|
-
</ErrorBoundary>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
})
|
|
75
|
-
.filter(Boolean)}
|
|
76
|
-
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
return <div></div>
|
|
81
|
-
}
|