@firecms/collection_editor 3.0.0-alpha.24 → 3.0.0-alpha.26
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/CollectionViewHeaderAction.d.ts +8 -0
- package/dist/components/PropertyAddColumnComponent.d.ts +6 -0
- package/dist/components/collection_editor/PropertyEditView.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1522 -1360
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +8 -1
- package/dist/types/config_controller.d.ts +10 -1
- package/package.json +4 -4
- package/src/ConfigControllerProvider.tsx +2 -2
- package/src/components/CollectionViewHeaderAction.tsx +1 -1
- package/src/components/collection_editor/CollectionDetailsForm.tsx +1 -0
- package/src/components/collection_editor/PropertyEditView.tsx +11 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CollectionEditorPermissionsBuilder } from "./config_permissions";
|
|
2
|
-
import { EntityCollection } from "@firecms/core";
|
|
2
|
+
import { EntityCollection, Property } from "@firecms/core";
|
|
3
3
|
/**
|
|
4
4
|
* Controller to open the collection editor dialog.
|
|
5
5
|
* @category Hooks and utilities
|
|
@@ -21,6 +21,13 @@ export interface CollectionEditorController {
|
|
|
21
21
|
parentCollection?: EntityCollection<any, any, any>;
|
|
22
22
|
redirect: boolean;
|
|
23
23
|
}) => void;
|
|
24
|
+
editProperty: (props: {
|
|
25
|
+
propertyKey?: string;
|
|
26
|
+
property?: Property;
|
|
27
|
+
currentPropertiesOrder?: string[];
|
|
28
|
+
editedCollectionPath: string;
|
|
29
|
+
parentPathSegments: string[];
|
|
30
|
+
}) => void;
|
|
24
31
|
configPermissions: CollectionEditorPermissionsBuilder;
|
|
25
32
|
rootPathSuggestions?: string[];
|
|
26
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CMSType } from "@firecms/core";
|
|
1
|
+
import { CMSType, Property } from "@firecms/core";
|
|
2
2
|
import { PersistedCollection } from "./persisted_collection";
|
|
3
3
|
/**
|
|
4
4
|
* Use this controller to access the configuration that is stored externally,
|
|
@@ -10,6 +10,7 @@ export interface CollectionsConfigController {
|
|
|
10
10
|
saveCollection: <M extends {
|
|
11
11
|
[Key: string]: CMSType;
|
|
12
12
|
}>(params: SaveCollectionParams<M>) => Promise<void>;
|
|
13
|
+
saveProperty: (params: SavePropertyParams) => Promise<void>;
|
|
13
14
|
deleteCollection: (props: DeleteCollectionParams) => Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
export type SaveCollectionParams<M extends Record<string, any>> = {
|
|
@@ -18,6 +19,14 @@ export type SaveCollectionParams<M extends Record<string, any>> = {
|
|
|
18
19
|
previousPath?: string;
|
|
19
20
|
parentPathSegments?: string[];
|
|
20
21
|
};
|
|
22
|
+
export type SavePropertyParams = {
|
|
23
|
+
path: string;
|
|
24
|
+
propertyKey: string;
|
|
25
|
+
namespace?: string;
|
|
26
|
+
newPropertiesOrder?: string[];
|
|
27
|
+
property: Property;
|
|
28
|
+
parentPathSegments?: string[];
|
|
29
|
+
};
|
|
21
30
|
export type DeleteCollectionParams = {
|
|
22
31
|
path: string;
|
|
23
32
|
parentPathSegments?: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.26",
|
|
4
4
|
"main": "./dist/index.umd.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@firecms/data_import": "^3.0.0-alpha.
|
|
18
|
-
"@firecms/schema_inference": "^3.0.0-alpha.
|
|
17
|
+
"@firecms/data_import": "^3.0.0-alpha.26",
|
|
18
|
+
"@firecms/schema_inference": "^3.0.0-alpha.26"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": "^18.2.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "6cf98e00ea1eee087526615c741eeeedfaf400b7"
|
|
80
80
|
}
|
|
@@ -246,8 +246,8 @@ export const ConfigControllerProvider = React.memo(
|
|
|
246
246
|
open={Boolean(currentPropertyDialog)}
|
|
247
247
|
includeIdAndName={true}
|
|
248
248
|
existingProperty={Boolean(currentPropertyDialog?.propertyKey)}
|
|
249
|
-
autoUpdateId={!currentPropertyDialog?.propertyKey}
|
|
250
|
-
autoOpenTypeSelect={!currentPropertyDialog?.propertyKey}
|
|
249
|
+
autoUpdateId={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}
|
|
250
|
+
autoOpenTypeSelect={!currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey}
|
|
251
251
|
inArray={false}
|
|
252
252
|
getData={getData && currentDialog?.fullPath ? () => getData(currentDialog.fullPath!) : undefined}
|
|
253
253
|
onPropertyChanged={({
|
|
@@ -21,7 +21,7 @@ export function CollectionViewHeaderAction({
|
|
|
21
21
|
return (
|
|
22
22
|
<Tooltip title={"Edit"}>
|
|
23
23
|
<IconButton
|
|
24
|
-
className={onHover ? "bg-white dark:bg-gray-950" :
|
|
24
|
+
className={onHover ? "bg-white dark:bg-gray-950" : "hidden"}
|
|
25
25
|
onClick={() => {
|
|
26
26
|
collectionEditorController.editProperty({
|
|
27
27
|
propertyKey,
|
|
@@ -242,6 +242,7 @@ export function CollectionDetailsForm({
|
|
|
242
242
|
<div className={"col-span-12"}>
|
|
243
243
|
<Field name={"alias"}
|
|
244
244
|
as={DebouncedTextField}
|
|
245
|
+
disabled={!isNewCollection}
|
|
245
246
|
label={"Alias"}
|
|
246
247
|
validate={validateAlias}
|
|
247
248
|
error={touched.alias && Boolean(errors.alias)}/>
|
|
@@ -290,6 +290,7 @@ function PropertyEditView({
|
|
|
290
290
|
customFields: Record<string, FieldConfig>;
|
|
291
291
|
} & FormikProps<PropertyWithId>) {
|
|
292
292
|
|
|
293
|
+
const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);
|
|
293
294
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
294
295
|
const [selectedFieldConfigId, setSelectedFieldConfigId] = useState<string | undefined>(values?.dataType ? getFieldId(values) : undefined);
|
|
295
296
|
|
|
@@ -439,13 +440,14 @@ function PropertyEditView({
|
|
|
439
440
|
</InfoLabel>}
|
|
440
441
|
|
|
441
442
|
<div className="flex mt-2 justify-between">
|
|
442
|
-
<div className={"w-full"}>
|
|
443
|
+
<div className={"w-full flex flex-col gap-2"}>
|
|
443
444
|
<Select
|
|
444
445
|
className={"w-full"}
|
|
445
446
|
error={Boolean(selectedWidgetError)}
|
|
446
447
|
value={selectedFieldConfigId ?? ""}
|
|
447
448
|
placeholder={"Select a property widget"}
|
|
448
|
-
open={
|
|
449
|
+
open={selectOpen}
|
|
450
|
+
onOpenChange={setSelectOpen}
|
|
449
451
|
position={"item-aligned"}
|
|
450
452
|
disabled={disabled}
|
|
451
453
|
renderValue={(value) => {
|
|
@@ -497,8 +499,13 @@ function PropertyEditView({
|
|
|
497
499
|
</Select>
|
|
498
500
|
|
|
499
501
|
{selectedWidgetError &&
|
|
500
|
-
<Typography variant="caption"
|
|
501
|
-
|
|
502
|
+
<Typography variant="caption"
|
|
503
|
+
className={"ml-3.5"}
|
|
504
|
+
color={"error"}>Required</Typography>}
|
|
505
|
+
|
|
506
|
+
{/*<Typography variant="caption" className={"ml-3.5"}>Define your own custom properties and*/}
|
|
507
|
+
{/* components</Typography>*/}
|
|
508
|
+
|
|
502
509
|
</div>
|
|
503
510
|
|
|
504
511
|
{onDelete && values?.id &&
|