@firecms/core 3.0.0-beta.10 → 3.0.0-beta.11
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/ArrayContainer.d.ts +17 -5
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +6 -3
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +1 -1
- package/dist/core/EntityEditView.d.ts +1 -1
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/index.d.ts +0 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
- package/dist/hooks/data/delete.d.ts +4 -4
- package/dist/hooks/data/save.d.ts +3 -3
- package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/useAuthController.d.ts +1 -1
- package/dist/hooks/useBuildNavigationController.d.ts +3 -3
- package/dist/hooks/useFireCMSContext.d.ts +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
- package/dist/index.es.js +17515 -14786
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +17912 -15184
- package/dist/index.umd.js.map +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/util.d.ts +3 -3
- package/dist/types/auth.d.ts +7 -9
- package/dist/types/collections.d.ts +14 -13
- package/dist/types/datasource.d.ts +0 -4
- package/dist/types/entity_actions.d.ts +4 -4
- package/dist/types/entity_callbacks.d.ts +16 -16
- package/dist/types/export_import.d.ts +4 -4
- package/dist/types/fields.d.ts +18 -2
- package/dist/types/firecms.d.ts +2 -2
- package/dist/types/firecms_context.d.ts +1 -1
- package/dist/types/permissions.d.ts +4 -4
- package/dist/types/plugins.d.ts +8 -8
- package/dist/types/property_config.d.ts +0 -2
- package/dist/types/user.d.ts +1 -0
- package/dist/util/builders.d.ts +2 -2
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_synonyms.d.ts +0 -1
- package/dist/util/icons.d.ts +3 -1
- package/dist/util/objects.d.ts +1 -0
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/property_utils.d.ts +2 -2
- package/dist/util/resolutions.d.ts +6 -6
- package/package.json +131 -125
- package/src/app/Scaffold.tsx +4 -4
- package/src/components/ArrayContainer.tsx +79 -17
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ConfirmationDialog.tsx +2 -2
- package/src/components/DeleteEntityDialog.tsx +9 -18
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +4 -1
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +14 -14
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +2 -2
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +6 -4
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +8 -9
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -11
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -5
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +79 -69
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +9 -10
- package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
- package/src/components/EntityPreview.tsx +39 -30
- package/src/components/EntityView.tsx +5 -5
- package/src/components/ErrorView.tsx +3 -3
- package/src/components/HomePage/DefaultHomePage.tsx +1 -0
- package/src/components/HomePage/FavouritesView.tsx +6 -11
- package/src/components/HomePage/NavigationCard.tsx +1 -1
- package/src/components/HomePage/NavigationCardBinding.tsx +4 -9
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/PropertyConfigBadge.tsx +1 -1
- package/src/components/PropertyIdCopyTooltip.tsx +1 -1
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +2 -2
- package/src/components/SelectableTable/SelectableTable.tsx +2 -2
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +4 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +3 -1
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +7 -5
- package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +2 -0
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +2 -2
- package/src/contexts/SnackbarProvider.tsx +2 -0
- package/src/core/DefaultAppBar.tsx +12 -11
- package/src/core/DefaultDrawer.tsx +11 -9
- package/src/core/DrawerNavigationItem.tsx +4 -4
- package/src/core/EntityEditView.tsx +50 -52
- package/src/core/FireCMS.tsx +5 -5
- package/src/core/SideDialogs.tsx +1 -1
- package/src/core/field_configs.tsx +4 -4
- package/src/form/PropertyFieldBinding.tsx +27 -20
- package/src/form/components/CustomIdField.tsx +2 -0
- package/src/form/components/StorageItemPreview.tsx +3 -3
- package/src/form/components/index.tsx +0 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +3 -2
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +16 -10
- package/src/form/field_bindings/BlockFieldBinding.tsx +41 -23
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +10 -7
- package/src/form/field_bindings/MapFieldBinding.tsx +58 -39
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +4 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +25 -20
- package/src/form/field_bindings/SelectFieldBinding.tsx +5 -4
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +1 -1
- package/src/form/field_bindings/SwitchFieldBinding.tsx +25 -25
- package/src/form/field_bindings/TextFieldBinding.tsx +3 -3
- package/src/hooks/data/delete.ts +4 -4
- package/src/hooks/data/save.ts +7 -8
- package/src/hooks/data/useCollectionFetch.tsx +2 -2
- package/src/hooks/data/useEntityFetch.tsx +5 -5
- package/src/hooks/useAuthController.tsx +1 -1
- package/src/hooks/useBuildNavigationController.tsx +5 -6
- package/src/hooks/useFireCMSContext.tsx +5 -5
- package/src/hooks/useResolvedNavigationFrom.tsx +5 -5
- package/src/hooks/useValidateAuthenticator.tsx +3 -3
- package/src/internal/useBuildDataSource.ts +1 -1
- package/src/internal/useUnsavedChangesDialog.tsx +2 -2
- package/src/preview/PropertyPreview.tsx +3 -3
- package/src/preview/PropertyPreviewProps.tsx +1 -1
- package/src/preview/components/BooleanPreview.tsx +1 -1
- package/src/preview/components/EmptyValue.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +5 -6
- package/src/preview/components/UrlComponentPreview.tsx +4 -4
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -2
- package/src/preview/property_previews/MapPropertyPreview.tsx +4 -4
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +12 -12
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/preview/util.ts +10 -10
- package/src/types/auth.tsx +8 -12
- package/src/types/collections.ts +14 -13
- package/src/types/datasource.ts +0 -5
- package/src/types/entity_actions.tsx +4 -4
- package/src/types/entity_callbacks.ts +18 -18
- package/src/types/export_import.ts +4 -4
- package/src/types/fields.tsx +20 -2
- package/src/types/firecms.tsx +2 -2
- package/src/types/firecms_context.tsx +1 -1
- package/src/types/permissions.ts +5 -5
- package/src/types/plugins.tsx +8 -8
- package/src/types/property_config.tsx +0 -2
- package/src/types/user.ts +2 -0
- package/src/util/builders.ts +6 -6
- package/src/util/entities.ts +3 -1
- package/src/util/icon_list.ts +1 -0
- package/src/util/icon_synonyms.ts +0 -1
- package/src/util/icons.tsx +12 -8
- package/src/util/objects.ts +20 -0
- package/src/util/permissions.ts +8 -8
- package/src/util/property_utils.tsx +10 -3
- package/src/util/references.ts +8 -2
- package/src/util/resolutions.ts +8 -8
- package/src/util/useStorageUploadController.tsx +1 -1
- package/dist/form/components/FormikArrayContainer.d.ts +0 -19
- package/src/form/components/FormikArrayContainer.tsx +0 -47
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ArrayProperty, CMSType, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
|
|
2
|
-
export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence,
|
|
2
|
+
export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, propertyConfigs, ignoreMissingFields }: {
|
|
3
3
|
collection: EntityCollection<M> | ResolvedEntityCollection<M>;
|
|
4
4
|
path: string;
|
|
5
5
|
entityId?: string;
|
|
6
6
|
values?: Partial<EntityValues<M>>;
|
|
7
7
|
previousValues?: Partial<EntityValues<M>>;
|
|
8
8
|
userConfigPersistence?: UserConfigurationPersistence;
|
|
9
|
-
|
|
9
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
10
10
|
ignoreMissingFields?: boolean;
|
|
11
11
|
}) => ResolvedEntityCollection<M>;
|
|
12
12
|
/**
|
|
@@ -23,7 +23,7 @@ export declare function resolveProperty<T extends CMSType = CMSType, M extends R
|
|
|
23
23
|
entityId?: string;
|
|
24
24
|
index?: number;
|
|
25
25
|
fromBuilder?: boolean;
|
|
26
|
-
|
|
26
|
+
propertyConfigs?: Record<string, PropertyConfig<any>>;
|
|
27
27
|
ignoreMissingFields?: boolean;
|
|
28
28
|
}): ResolvedProperty<T> | null;
|
|
29
29
|
export declare function getArrayResolvedProperties<M>({ propertyKey, propertyValue, property, ...props }: {
|
|
@@ -37,7 +37,7 @@ export declare function getArrayResolvedProperties<M>({ propertyKey, propertyVal
|
|
|
37
37
|
entityId?: string;
|
|
38
38
|
index?: number;
|
|
39
39
|
fromBuilder?: boolean;
|
|
40
|
-
|
|
40
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
41
41
|
}): ResolvedProperty[];
|
|
42
42
|
export declare function resolveArrayProperty<T extends any[], M>({ propertyKey, property, ignoreMissingFields, ...props }: {
|
|
43
43
|
propertyKey?: string;
|
|
@@ -48,7 +48,7 @@ export declare function resolveArrayProperty<T extends any[], M>({ propertyKey,
|
|
|
48
48
|
entityId?: string;
|
|
49
49
|
index?: number;
|
|
50
50
|
fromBuilder?: boolean;
|
|
51
|
-
|
|
51
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
52
52
|
ignoreMissingFields?: boolean;
|
|
53
53
|
}): ResolvedArrayProperty;
|
|
54
54
|
/**
|
|
@@ -65,7 +65,7 @@ export declare function resolveProperties<M extends Record<string, any>>({ prope
|
|
|
65
65
|
entityId?: string;
|
|
66
66
|
index?: number;
|
|
67
67
|
fromBuilder?: boolean;
|
|
68
|
-
|
|
68
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
69
69
|
ignoreMissingFields?: boolean;
|
|
70
70
|
}): ResolvedProperties<M>;
|
|
71
71
|
/**
|
package/package.json
CHANGED
|
@@ -1,131 +1,137 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"name": "@firecms/core",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "3.0.0-beta.11",
|
|
5
|
+
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
|
+
"funding": {
|
|
7
|
+
"url": "https://github.com/sponsors/firecmsco"
|
|
8
|
+
},
|
|
9
|
+
"author": "FireCMS",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/firecmsco/firecms.git",
|
|
14
|
+
"directory": "packages/firecms_core"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.umd.js",
|
|
17
|
+
"module": "./dist/index.es.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"source": "src/index.ts",
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=14"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"firebase",
|
|
25
|
+
"cms",
|
|
26
|
+
"admin",
|
|
27
|
+
"admin panel",
|
|
28
|
+
"firebase panel",
|
|
29
|
+
"firestore",
|
|
30
|
+
"headless",
|
|
31
|
+
"headless cms",
|
|
32
|
+
"content manager"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"watch": "vite build --watch",
|
|
36
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
37
|
+
"prepublishOnly": "run-s build",
|
|
38
|
+
"createTag": "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags",
|
|
39
|
+
"test:lint": "eslint \"src/**\" --quiet",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
|
|
42
|
+
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
43
|
+
},
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"import": "./dist/index.es.js",
|
|
47
|
+
"require": "./dist/index.umd.js",
|
|
48
|
+
"types": "./dist/index.d.ts"
|
|
8
49
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
50
|
+
"./package.json": "./package.json"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@firecms/editor": "^3.0.0-beta.11",
|
|
54
|
+
"@firecms/formex": "^3.0.0-beta.11",
|
|
55
|
+
"@firecms/ui": "^3.0.0-beta.11",
|
|
56
|
+
"@hello-pangea/dnd": "^17.0.0",
|
|
57
|
+
"@radix-ui/react-portal": "^1.1.2",
|
|
58
|
+
"clsx": "^2.1.1",
|
|
59
|
+
"date-fns": "^3.6.0",
|
|
60
|
+
"fuse.js": "^7.0.0",
|
|
61
|
+
"history": "^5.3.0",
|
|
62
|
+
"markdown-it": "^14.1.0",
|
|
63
|
+
"notistack": "^3.0.1",
|
|
64
|
+
"object-hash": "^3.0.0",
|
|
65
|
+
"react-dropzone": "^14.3.5",
|
|
66
|
+
"react-fast-compare": "^3.2.2",
|
|
67
|
+
"react-image-file-resizer": "^0.4.8",
|
|
68
|
+
"react-transition-group": "^4.4.5",
|
|
69
|
+
"react-use-measure": "^2.1.1",
|
|
70
|
+
"react-window": "^1.8.10",
|
|
71
|
+
"yup": "^0.32.11"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"firebase": "^10.5.2",
|
|
75
|
+
"react": "^18.3.1",
|
|
76
|
+
"react-dom": "^18.3.1",
|
|
77
|
+
"react-router": "^6.28.0",
|
|
78
|
+
"react-router-dom": "^6.28.0"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@jest/globals": "^29.7.0",
|
|
82
|
+
"@testing-library/react": "^16.0.1",
|
|
83
|
+
"@testing-library/user-event": "^14.5.2",
|
|
84
|
+
"@types/jest": "^29.5.14",
|
|
85
|
+
"@types/node": "^20.17.9",
|
|
86
|
+
"@types/object-hash": "^3.0.6",
|
|
87
|
+
"@types/react": "^18.3.11",
|
|
88
|
+
"@types/react-dom": "^18.3.1",
|
|
89
|
+
"@types/react-measure": "^2.0.12",
|
|
90
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
91
|
+
"babel-plugin-react-compiler": "beta",
|
|
92
|
+
"cross-env": "^7.0.3",
|
|
93
|
+
"eslint-plugin-react-compiler": "beta",
|
|
94
|
+
"firebase": "^10.14.1",
|
|
95
|
+
"jest": "^29.7.0",
|
|
96
|
+
"npm-run-all": "^4.1.5",
|
|
97
|
+
"react-router": "^6.28.0",
|
|
98
|
+
"react-router-dom": "^6.28.0",
|
|
99
|
+
"ts-jest": "^29.2.5",
|
|
100
|
+
"ts-node": "^10.9.2",
|
|
101
|
+
"tsd": "^0.31.2",
|
|
102
|
+
"typescript": "^5.7.2",
|
|
103
|
+
"vite": "^5.4.11"
|
|
104
|
+
},
|
|
105
|
+
"files": [
|
|
106
|
+
"dist",
|
|
107
|
+
"src"
|
|
108
|
+
],
|
|
109
|
+
"gitHead": "cb6d419faf2664cfd6cb2603a834e4bf499a92bb",
|
|
110
|
+
"publishConfig": {
|
|
111
|
+
"access": "public"
|
|
112
|
+
},
|
|
113
|
+
"eslintConfig": {
|
|
114
|
+
"extends": [
|
|
115
|
+
"react-app",
|
|
116
|
+
"react-app/jest"
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"jest": {
|
|
120
|
+
"transform": {
|
|
121
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
18
122
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"headless cms",
|
|
28
|
-
"content manager"
|
|
123
|
+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
124
|
+
"moduleFileExtensions": [
|
|
125
|
+
"ts",
|
|
126
|
+
"tsx",
|
|
127
|
+
"js",
|
|
128
|
+
"jsx",
|
|
129
|
+
"json",
|
|
130
|
+
"node"
|
|
29
131
|
],
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"prepublishOnly": "run-s build",
|
|
34
|
-
"createTag": "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags",
|
|
35
|
-
"test:lint": "eslint \"src/**\" --quiet",
|
|
36
|
-
"test": "jest",
|
|
37
|
-
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
|
|
38
|
-
"generateIcons": "ts-node --esm src/icons/generateIcons.ts"
|
|
39
|
-
},
|
|
40
|
-
"exports": {
|
|
41
|
-
".": {
|
|
42
|
-
"import": "./dist/index.es.js",
|
|
43
|
-
"require": "./dist/index.umd.js",
|
|
44
|
-
"types": "./dist/index.d.ts"
|
|
45
|
-
},
|
|
46
|
-
"./package.json": "./package.json"
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"@firecms/editor": "^3.0.0-beta.10",
|
|
50
|
-
"@firecms/formex": "^3.0.0-beta.10",
|
|
51
|
-
"@firecms/ui": "^3.0.0-beta.10",
|
|
52
|
-
"@hello-pangea/dnd": "^17.0.0",
|
|
53
|
-
"@radix-ui/react-portal": "^1.1.2",
|
|
54
|
-
"clsx": "^2.1.1",
|
|
55
|
-
"date-fns": "^3.6.0",
|
|
56
|
-
"fuse.js": "^7.0.0",
|
|
57
|
-
"history": "^5.3.0",
|
|
58
|
-
"markdown-it": "^14.1.0",
|
|
59
|
-
"notistack": "^3.0.1",
|
|
60
|
-
"object-hash": "^3.0.0",
|
|
61
|
-
"react-dropzone": "^14.2.9",
|
|
62
|
-
"react-fast-compare": "^3.2.2",
|
|
63
|
-
"react-image-file-resizer": "^0.4.8",
|
|
64
|
-
"react-transition-group": "^4.4.5",
|
|
65
|
-
"react-use-measure": "^2.1.1",
|
|
66
|
-
"react-window": "^1.8.10",
|
|
67
|
-
"yup": "^0.32.11"
|
|
68
|
-
},
|
|
69
|
-
"peerDependencies": {
|
|
70
|
-
"firebase": "^10.5.2",
|
|
71
|
-
"react": "^18.3.1",
|
|
72
|
-
"react-dom": "^18.3.1",
|
|
73
|
-
"react-router": "^6.25.1",
|
|
74
|
-
"react-router-dom": "^6.25.1"
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"@jest/globals": "^29.7.0",
|
|
78
|
-
"@testing-library/react": "^16.0.1",
|
|
79
|
-
"@testing-library/user-event": "^14.5.2",
|
|
80
|
-
"@types/jest": "^29.5.13",
|
|
81
|
-
"@types/node": "^20.16.11",
|
|
82
|
-
"@types/object-hash": "^3.0.6",
|
|
83
|
-
"@types/react": "^18.3.11",
|
|
84
|
-
"@types/react-dom": "^18.3.0",
|
|
85
|
-
"@types/react-measure": "^2.0.12",
|
|
86
|
-
"@vitejs/plugin-react": "^4.3.2",
|
|
87
|
-
"cross-env": "^7.0.3",
|
|
88
|
-
"firebase": "^10.14.0",
|
|
89
|
-
"jest": "^29.7.0",
|
|
90
|
-
"npm-run-all": "^4.1.5",
|
|
91
|
-
"react-router": "^6.26.2",
|
|
92
|
-
"react-router-dom": "^6.26.2",
|
|
93
|
-
"ts-jest": "^29.2.5",
|
|
94
|
-
"ts-node": "^10.9.2",
|
|
95
|
-
"tsd": "^0.31.2",
|
|
96
|
-
"typescript": "^5.6.3",
|
|
97
|
-
"vite": "^5.4.8"
|
|
98
|
-
},
|
|
99
|
-
"files": [
|
|
100
|
-
"dist",
|
|
101
|
-
"src"
|
|
102
|
-
],
|
|
103
|
-
"gitHead": "f844c3f86094efec6c33313c3f106f30cdcd309f",
|
|
104
|
-
"publishConfig": {
|
|
105
|
-
"access": "public"
|
|
106
|
-
},
|
|
107
|
-
"eslintConfig": {
|
|
108
|
-
"extends": [
|
|
109
|
-
"react-app",
|
|
110
|
-
"react-app/jest"
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
"jest": {
|
|
114
|
-
"transform": {
|
|
115
|
-
"^.+\\.tsx?$": "ts-jest"
|
|
116
|
-
},
|
|
117
|
-
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
118
|
-
"moduleFileExtensions": [
|
|
119
|
-
"ts",
|
|
120
|
-
"tsx",
|
|
121
|
-
"js",
|
|
122
|
-
"jsx",
|
|
123
|
-
"json",
|
|
124
|
-
"node"
|
|
125
|
-
],
|
|
126
|
-
"testEnvironment": "node",
|
|
127
|
-
"moduleNameMapper": {
|
|
128
|
-
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js"
|
|
129
|
-
}
|
|
132
|
+
"testEnvironment": "node",
|
|
133
|
+
"moduleNameMapper": {
|
|
134
|
+
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js"
|
|
130
135
|
}
|
|
136
|
+
}
|
|
131
137
|
}
|
package/src/app/Scaffold.tsx
CHANGED
|
@@ -91,7 +91,7 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
|
91
91
|
autoOpenDrawer
|
|
92
92
|
}}>
|
|
93
93
|
<div
|
|
94
|
-
className={cls("flex h-screen w-screen bg-
|
|
94
|
+
className={cls("flex h-screen w-screen bg-surface-50 dark:bg-surface-900 text-surface-900 dark:text-white overflow-hidden", className)}
|
|
95
95
|
style={{
|
|
96
96
|
paddingTop: "env(safe-area-inset-top)",
|
|
97
97
|
paddingLeft: "env(safe-area-inset-left)",
|
|
@@ -168,7 +168,7 @@ function DrawerWrapper(props: {
|
|
|
168
168
|
sideOffset={12}
|
|
169
169
|
asChild={true}>
|
|
170
170
|
<div
|
|
171
|
-
className="ml-2 fixed top-1 left-2 sm:top-2 sm:left-
|
|
171
|
+
className="ml-2 fixed top-1 left-2 sm:top-2 sm:left-2 !bg-surface-50 dark:!bg-surface-900 rounded-full w-fit z-20">
|
|
172
172
|
<IconButton
|
|
173
173
|
color="inherit"
|
|
174
174
|
aria-label="Open menu"
|
|
@@ -209,7 +209,7 @@ function DrawerWrapper(props: {
|
|
|
209
209
|
aria-label="Open drawer"
|
|
210
210
|
onClick={() => props.setDrawerOpen(true)}
|
|
211
211
|
size="large"
|
|
212
|
-
className="absolute sm:top-2 sm:left-
|
|
212
|
+
className="absolute sm:top-2 sm:left-4 top-1 left-2"
|
|
213
213
|
>
|
|
214
214
|
<MenuIcon/>
|
|
215
215
|
</IconButton>
|
|
@@ -217,7 +217,7 @@ function DrawerWrapper(props: {
|
|
|
217
217
|
transparent={true}
|
|
218
218
|
open={props.open}
|
|
219
219
|
onOpenChange={props.setDrawerOpen}
|
|
220
|
-
title={"
|
|
220
|
+
title={"Navigation drawer"}
|
|
221
221
|
overlayClassName={"bg-white bg-opacity-80"}
|
|
222
222
|
>
|
|
223
223
|
{innerDrawer}
|
|
@@ -6,10 +6,12 @@ import { getHashValue } from "../util";
|
|
|
6
6
|
import {
|
|
7
7
|
AddIcon,
|
|
8
8
|
Button,
|
|
9
|
+
cls,
|
|
9
10
|
ContentCopyIcon,
|
|
10
|
-
fieldBackgroundHoverMixin,
|
|
11
11
|
HandleIcon,
|
|
12
12
|
IconButton,
|
|
13
|
+
KeyboardArrowDownIcon,
|
|
14
|
+
KeyboardArrowUpIcon,
|
|
13
15
|
Menu,
|
|
14
16
|
MenuItem,
|
|
15
17
|
RemoveIcon,
|
|
@@ -17,11 +19,21 @@ import {
|
|
|
17
19
|
useOutsideAlerter
|
|
18
20
|
} from "@firecms/ui";
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
export type ArrayEntryParams = {
|
|
23
|
+
index: number,
|
|
24
|
+
internalId: number,
|
|
25
|
+
isDragging: boolean,
|
|
26
|
+
storedProps?: object,
|
|
27
|
+
storeProps: (props: object) => void
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ArrayEntryBuilder = (params: ArrayEntryParams) => React.ReactNode;
|
|
31
|
+
|
|
32
|
+
export interface ArrayContainerProps<T> {
|
|
21
33
|
droppableId: string;
|
|
22
34
|
value: T[];
|
|
23
35
|
addLabel: string;
|
|
24
|
-
buildEntry:
|
|
36
|
+
buildEntry: ArrayEntryBuilder;
|
|
25
37
|
disabled?: boolean;
|
|
26
38
|
size?: "small" | "medium";
|
|
27
39
|
onInternalIdAdded?: (id: number) => void;
|
|
@@ -68,6 +80,12 @@ export function ArrayContainer<T>({
|
|
|
68
80
|
? Object.values(internalIdsRef.current)
|
|
69
81
|
: []);
|
|
70
82
|
|
|
83
|
+
const itemCustomPropsRef = useRef<Record<number, object>>({});
|
|
84
|
+
|
|
85
|
+
const updateItemCustomProps = useCallback((internalId: number, customProps: object) => {
|
|
86
|
+
itemCustomPropsRef.current[internalId] = customProps;
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
71
89
|
useEffect(() => {
|
|
72
90
|
if (hasValue && value && value.length !== internalIds.length) {
|
|
73
91
|
const newInternalIds = value.map((v, index) => {
|
|
@@ -116,6 +134,18 @@ export function ArrayContainer<T>({
|
|
|
116
134
|
onValueChange([...value.slice(0, index + 1), copyingItem, ...value.slice(index + 1)]);
|
|
117
135
|
};
|
|
118
136
|
|
|
137
|
+
const addInIndex = (index: number) => {
|
|
138
|
+
const id = getRandomId();
|
|
139
|
+
const newIds: number[] = [
|
|
140
|
+
...internalIds.splice(0, index),
|
|
141
|
+
id,
|
|
142
|
+
...internalIds.slice(index)];
|
|
143
|
+
if (onInternalIdAdded)
|
|
144
|
+
onInternalIdAdded(id);
|
|
145
|
+
setInternalIds(newIds);
|
|
146
|
+
onValueChange([...value.slice(0, index), newDefaultEntry, ...value.slice(index)]);
|
|
147
|
+
}
|
|
148
|
+
|
|
119
149
|
const onDragEnd = (result: any) => {
|
|
120
150
|
// dropped outside the list
|
|
121
151
|
if (!result.destination) {
|
|
@@ -150,13 +180,16 @@ export function ArrayContainer<T>({
|
|
|
150
180
|
remove={remove}
|
|
151
181
|
copy={copy}
|
|
152
182
|
isDragging={snapshot.isDragging}
|
|
183
|
+
storedProps={itemCustomPropsRef.current[internalId]}
|
|
184
|
+
updateItemCustomProps={updateItemCustomProps}
|
|
185
|
+
addInIndex={addInIndex}
|
|
153
186
|
/>
|
|
154
187
|
);
|
|
155
188
|
}}
|
|
156
189
|
>
|
|
157
190
|
{(droppableProvided, droppableSnapshot) => (
|
|
158
191
|
<div
|
|
159
|
-
className={className}
|
|
192
|
+
className={cls("space-y-1", className)}
|
|
160
193
|
{...droppableProvided.droppableProps}
|
|
161
194
|
ref={droppableProvided.innerRef}>
|
|
162
195
|
{hasValue && internalIds.map((internalId: number, index: number) => {
|
|
@@ -177,6 +210,9 @@ export function ArrayContainer<T>({
|
|
|
177
210
|
remove={remove}
|
|
178
211
|
copy={copy}
|
|
179
212
|
isDragging={snapshot.isDragging}
|
|
213
|
+
storedProps={itemCustomPropsRef.current[internalId]}
|
|
214
|
+
updateItemCustomProps={updateItemCustomProps}
|
|
215
|
+
addInIndex={addInIndex}
|
|
180
216
|
/>
|
|
181
217
|
)}
|
|
182
218
|
</Draggable>
|
|
@@ -209,10 +245,13 @@ type ArrayContainerItemProps = {
|
|
|
209
245
|
internalId: number,
|
|
210
246
|
size?: "small" | "medium",
|
|
211
247
|
disabled: boolean,
|
|
212
|
-
buildEntry:
|
|
248
|
+
buildEntry: ArrayEntryBuilder,
|
|
213
249
|
remove: (index: number) => void,
|
|
214
250
|
copy: (index: number) => void,
|
|
251
|
+
addInIndex?: (index: number) => void,
|
|
215
252
|
isDragging: boolean,
|
|
253
|
+
storedProps?: object,
|
|
254
|
+
updateItemCustomProps: (internalId: number, props: object) => void
|
|
216
255
|
};
|
|
217
256
|
|
|
218
257
|
export function ArrayContainerItem({
|
|
@@ -223,36 +262,39 @@ export function ArrayContainerItem({
|
|
|
223
262
|
disabled,
|
|
224
263
|
buildEntry,
|
|
225
264
|
remove,
|
|
265
|
+
addInIndex,
|
|
226
266
|
copy,
|
|
227
|
-
isDragging
|
|
267
|
+
isDragging,
|
|
268
|
+
storedProps,
|
|
269
|
+
updateItemCustomProps
|
|
228
270
|
}: ArrayContainerItemProps) {
|
|
229
271
|
|
|
230
|
-
const [onHover, setOnHover] = React.useState(false);
|
|
231
|
-
const setOnHoverTrue = useCallback(() => setOnHover(true), []);
|
|
232
|
-
const setOnHoverFalse = useCallback(() => setOnHover(false), []);
|
|
233
|
-
|
|
234
272
|
return <div
|
|
235
|
-
onMouseEnter={setOnHoverTrue}
|
|
236
|
-
onMouseMove={setOnHoverTrue}
|
|
237
|
-
onMouseLeave={setOnHoverFalse}
|
|
238
273
|
ref={provided.innerRef}
|
|
239
274
|
{...provided.draggableProps}
|
|
240
275
|
style={provided.draggableProps.style}
|
|
241
276
|
className={`${
|
|
242
|
-
|
|
243
|
-
}
|
|
277
|
+
!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""
|
|
278
|
+
} rounded-md opacity-100`}
|
|
244
279
|
>
|
|
245
280
|
<div
|
|
246
281
|
className="flex items-start">
|
|
247
282
|
<div
|
|
248
283
|
className="flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark">
|
|
249
|
-
{buildEntry(
|
|
284
|
+
{buildEntry({
|
|
285
|
+
index,
|
|
286
|
+
internalId,
|
|
287
|
+
isDragging,
|
|
288
|
+
storedProps,
|
|
289
|
+
storeProps: (props: object) => updateItemCustomProps(internalId, props)
|
|
290
|
+
})}
|
|
250
291
|
</div>
|
|
251
292
|
<ArrayItemOptions direction={size === "small" ? "row" : "column"}
|
|
252
293
|
disabled={disabled}
|
|
253
294
|
remove={remove}
|
|
254
295
|
index={index}
|
|
255
296
|
provided={provided}
|
|
297
|
+
addInIndex={addInIndex}
|
|
256
298
|
copy={copy}/>
|
|
257
299
|
</div>
|
|
258
300
|
</div>;
|
|
@@ -265,13 +307,15 @@ export function ArrayItemOptions({
|
|
|
265
307
|
index,
|
|
266
308
|
provided,
|
|
267
309
|
copy,
|
|
310
|
+
addInIndex
|
|
268
311
|
}: {
|
|
269
312
|
direction?: "row" | "column",
|
|
270
313
|
disabled: boolean,
|
|
271
314
|
remove: (index: number) => void,
|
|
272
315
|
index: number,
|
|
273
316
|
provided: any,
|
|
274
|
-
copy: (index: number) => void
|
|
317
|
+
copy: (index: number) => void,
|
|
318
|
+
addInIndex?: (index: number) => void
|
|
275
319
|
}) {
|
|
276
320
|
|
|
277
321
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
@@ -321,6 +365,24 @@ export function ArrayItemOptions({
|
|
|
321
365
|
Copy
|
|
322
366
|
</MenuItem>
|
|
323
367
|
|
|
368
|
+
{addInIndex && <MenuItem dense
|
|
369
|
+
onClick={() => {
|
|
370
|
+
setMenuOpen(false);
|
|
371
|
+
addInIndex(index);
|
|
372
|
+
}}>
|
|
373
|
+
<KeyboardArrowUpIcon size={"small"}/>
|
|
374
|
+
Add on top
|
|
375
|
+
</MenuItem>}
|
|
376
|
+
|
|
377
|
+
{addInIndex && <MenuItem dense
|
|
378
|
+
onClick={() => {
|
|
379
|
+
setMenuOpen(false);
|
|
380
|
+
addInIndex(index + 1);
|
|
381
|
+
}}>
|
|
382
|
+
<KeyboardArrowDownIcon size={"small"}/>
|
|
383
|
+
Add below
|
|
384
|
+
</MenuItem>}
|
|
385
|
+
|
|
324
386
|
</Menu>
|
|
325
387
|
</Tooltip>
|
|
326
388
|
|
|
@@ -13,7 +13,7 @@ export function CircularProgressCenter({ text, ...props }: CircularProgressProps
|
|
|
13
13
|
}) {
|
|
14
14
|
return (
|
|
15
15
|
<div
|
|
16
|
-
className="flex w-full h-screen max-h-full max-w-full bg-
|
|
16
|
+
className="flex w-full h-screen max-h-full max-w-full bg-surface-50 dark:bg-surface-900 gap-4">
|
|
17
17
|
<div className="m-auto flex flex-col gap-2 items-center">
|
|
18
18
|
<CircularProgress {...props}/>
|
|
19
19
|
{text && <Typography
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { Button, Dialog, DialogActions, DialogContent, LoadingButton, Typography } from "@firecms/ui";
|
|
3
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, LoadingButton, Typography } from "@firecms/ui";
|
|
4
4
|
|
|
5
5
|
export function ConfirmationDialog({
|
|
6
6
|
open,
|
|
@@ -22,8 +22,8 @@ export function ConfirmationDialog({
|
|
|
22
22
|
open={open}
|
|
23
23
|
onOpenChange={(open) => !open ? onCancel() : undefined}
|
|
24
24
|
>
|
|
25
|
+
<DialogTitle variant={"h6"} className={"mb-2"}>{title}</DialogTitle>
|
|
25
26
|
<DialogContent>
|
|
26
|
-
<Typography variant={"h6"} className={"mb-2"}>{title}</Typography>
|
|
27
27
|
{body}
|
|
28
28
|
</DialogContent>
|
|
29
29
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entity, EntityCallbacks, EntityCollection } from "../types";
|
|
2
2
|
import React, { useCallback, useMemo, useState } from "react";
|
|
3
|
-
import { Button, CircularProgress, Dialog, DialogActions, DialogContent,
|
|
3
|
+
import { Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle } from "@firecms/ui";
|
|
4
4
|
import {
|
|
5
5
|
deleteEntityWithCallbacks,
|
|
6
6
|
useCustomizationController,
|
|
@@ -40,25 +40,17 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
40
40
|
const snackbarController = useSnackbarController();
|
|
41
41
|
const [loading, setLoading] = useState(false);
|
|
42
42
|
|
|
43
|
-
const [entityOrEntities, setUsedEntityOrEntities] = React.useState<Entity<M> | Entity<M>[]>();
|
|
44
|
-
|
|
45
|
-
const [multipleEntities, setMultipleEntities] = React.useState<boolean>();
|
|
46
43
|
const context = useFireCMSContext();
|
|
44
|
+
const entityOrEntities = Array.isArray(entityOrEntitiesToDelete) && entityOrEntitiesToDelete.length === 1
|
|
45
|
+
? entityOrEntitiesToDelete[0]
|
|
46
|
+
: entityOrEntitiesToDelete;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
if (entityOrEntitiesToDelete) {
|
|
50
|
-
const revisedEntityOrEntities = Array.isArray(entityOrEntitiesToDelete) && entityOrEntitiesToDelete.length === 1
|
|
51
|
-
? entityOrEntitiesToDelete[0]
|
|
52
|
-
: entityOrEntitiesToDelete;
|
|
53
|
-
setUsedEntityOrEntities(revisedEntityOrEntities);
|
|
54
|
-
setMultipleEntities(Array.isArray(revisedEntityOrEntities));
|
|
55
|
-
}
|
|
56
|
-
}, [entityOrEntitiesToDelete]);
|
|
48
|
+
const multipleEntities = Array.isArray(entityOrEntities);
|
|
57
49
|
|
|
58
50
|
const resolvedCollection = useMemo(() => resolveCollection<M>({
|
|
59
51
|
collection,
|
|
60
52
|
path,
|
|
61
|
-
|
|
53
|
+
propertyConfigs: customizationController.propertyConfigs
|
|
62
54
|
}), [collection, path]);
|
|
63
55
|
|
|
64
56
|
const handleCancel = useCallback(() => {
|
|
@@ -181,11 +173,10 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
181
173
|
open={open}
|
|
182
174
|
onOpenChange={(open) => !open ? onClose() : undefined}
|
|
183
175
|
>
|
|
176
|
+
<DialogTitle id="delete-dialog-title">
|
|
177
|
+
{dialogTitle}
|
|
178
|
+
</DialogTitle>
|
|
184
179
|
<DialogContent fullHeight={true}>
|
|
185
|
-
<Typography variant={"subtitle2"} className={"p-4"}>
|
|
186
|
-
{dialogTitle}
|
|
187
|
-
</Typography>
|
|
188
|
-
|
|
189
180
|
{!multipleEntities && <div className={"p-4"}>{content}</div>}
|
|
190
181
|
</DialogContent>
|
|
191
182
|
<DialogActions>
|
|
@@ -66,9 +66,12 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
66
66
|
return (
|
|
67
67
|
<div
|
|
68
68
|
className={cls(
|
|
69
|
-
"h-full flex items-center justify-center flex-col bg-
|
|
69
|
+
"h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10",
|
|
70
70
|
frozen ? "sticky left-0" : ""
|
|
71
71
|
)}
|
|
72
|
+
onClick={useCallback((event: any) => {
|
|
73
|
+
event.stopPropagation();
|
|
74
|
+
}, [])}
|
|
72
75
|
style={{
|
|
73
76
|
width,
|
|
74
77
|
position: frozen ? "sticky" : "initial",
|