@firecms/core 3.0.0-canary.102 → 3.0.0-canary.103
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 +264 -816
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +263 -814
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +5 -0
- 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/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/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 +6 -0
- package/src/types/datasource.ts +13 -16
- package/src/types/entities.ts +2 -0
- package/src/types/fields.tsx +5 -15
- package/src/util/index.ts +1 -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
|
@@ -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
|
-
}
|