@firecms/core 3.0.0-beta.8 → 3.0.0-beta.9
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/app/Drawer.d.ts +1 -1
- package/dist/app/Scaffold.d.ts +1 -1
- package/dist/components/ArrayContainer.d.ts +2 -1
- package/dist/components/CircularProgressCenter.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +0 -1
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +1 -1
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +1 -1
- package/dist/components/EntityPreview.d.ts +1 -1
- package/dist/components/ErrorView.d.ts +1 -1
- package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
- package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +10 -6
- package/dist/components/common/useColumnsIds.d.ts +2 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/core/DefaultAppBar.d.ts +1 -1
- package/dist/core/DefaultDrawer.d.ts +1 -1
- package/dist/core/DrawerNavigationItem.d.ts +2 -1
- package/dist/core/EntityEditView.d.ts +3 -3
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/core/NavigationRoutes.d.ts +1 -1
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- package/dist/form/components/FormikArrayContainer.d.ts +2 -1
- package/dist/form/components/LabelWithIcon.d.ts +1 -1
- package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
- package/dist/form/components/index.d.ts +1 -0
- 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 +11 -0
- package/dist/form/field_bindings/{MultiSelectBinding.d.ts → MultiSelectFieldBinding.d.ts} +1 -1
- 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/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/index.d.ts +3 -3
- package/dist/form/useClearRestoreValue.d.ts +2 -2
- package/dist/hooks/useProjectLog.d.ts +2 -2
- package/dist/index.es.js +14127 -11014
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19987 -587
- 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/components/ReferencePreview.d.ts +1 -1
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/collections.d.ts +12 -3
- package/dist/types/datasource.d.ts +35 -22
- package/dist/types/entities.d.ts +1 -0
- package/dist/types/entity_overrides.d.ts +2 -2
- package/dist/types/fields.d.ts +20 -15
- package/dist/types/navigation.d.ts +1 -0
- package/dist/types/properties.d.ts +18 -18
- package/dist/types/side_dialogs_controller.d.ts +10 -0
- package/dist/types/storage.d.ts +75 -0
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_list.d.ts +5 -1
- package/dist/util/icons.d.ts +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/property_utils.d.ts +1 -1
- package/dist/util/resolutions.d.ts +15 -1
- package/dist/util/storage.d.ts +1 -1
- package/dist/util/useStorageUploadController.d.ts +2 -2
- package/package.json +15 -17
- package/src/app/Drawer.tsx +1 -1
- package/src/app/Scaffold.tsx +22 -27
- package/src/components/ArrayContainer.tsx +15 -10
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +4 -9
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +2 -2
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +4 -2
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +21 -14
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +12 -4
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +17 -19
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +26 -25
- package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
- package/src/components/EntityPreview.tsx +30 -31
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/HomePage/DefaultHomePage.tsx +24 -18
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- package/src/components/HomePage/SmallNavigationCard.tsx +1 -2
- package/src/components/PropertyIdCopyTooltip.tsx +48 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +7 -6
- package/src/components/SearchIconsView.tsx +5 -2
- package/src/components/SelectableTable/SelectableTable.tsx +2 -4
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +1 -1
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +54 -7
- package/src/components/VirtualTable/VirtualTable.tsx +33 -9
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -9
- package/src/components/VirtualTable/VirtualTableProps.tsx +12 -8
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -3
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -1
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +14 -28
- package/src/components/common/useColumnsIds.tsx +13 -0
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -12
- package/src/components/common/useTableSearchHelper.ts +1 -0
- package/src/components/index.tsx +1 -0
- package/src/core/DefaultAppBar.tsx +3 -3
- package/src/core/DefaultDrawer.tsx +18 -12
- package/src/core/DrawerNavigationItem.tsx +31 -27
- package/src/core/EntityEditView.tsx +136 -109
- package/src/core/FireCMS.tsx +2 -2
- package/src/core/NavigationRoutes.tsx +1 -1
- package/src/core/SideDialogs.tsx +1 -0
- package/src/core/field_configs.tsx +5 -5
- package/src/form/PropertyFieldBinding.tsx +24 -14
- package/src/form/components/CustomIdField.tsx +4 -2
- package/src/form/components/FieldHelperText.tsx +1 -1
- package/src/form/components/FormikArrayContainer.tsx +4 -1
- package/src/form/components/LabelWithIcon.tsx +27 -19
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/StorageItemPreview.tsx +1 -0
- package/src/form/components/StorageUploadProgress.tsx +0 -1
- package/src/form/components/index.tsx +1 -0
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +22 -14
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +24 -22
- package/src/form/field_bindings/BlockFieldBinding.tsx +13 -11
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +8 -7
- package/src/form/field_bindings/MapFieldBinding.tsx +16 -24
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +150 -0
- package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +25 -20
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +9 -7
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +27 -18
- package/src/form/field_bindings/RepeatFieldBinding.tsx +27 -17
- package/src/form/field_bindings/SelectFieldBinding.tsx +17 -10
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +36 -17
- package/src/form/field_bindings/SwitchFieldBinding.tsx +9 -5
- package/src/form/field_bindings/TextFieldBinding.tsx +26 -23
- package/src/form/index.tsx +4 -9
- package/src/form/useClearRestoreValue.tsx +2 -2
- package/src/hooks/data/delete.ts +2 -1
- package/src/hooks/data/save.ts +5 -2
- package/src/hooks/data/useDataSource.tsx +11 -3
- package/src/hooks/useBuildNavigationController.tsx +10 -3
- package/src/hooks/useProjectLog.tsx +18 -7
- package/src/internal/useBuildDataSource.ts +59 -76
- package/src/internal/useBuildSideDialogsController.tsx +1 -0
- package/src/internal/useBuildSideEntityController.tsx +17 -4
- package/src/internal/useUnsavedChangesDialog.tsx +3 -1
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/preview/PropertyPreviewProps.tsx +1 -1
- package/src/preview/components/BooleanPreview.tsx +1 -1
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +4 -2
- package/src/preview/components/ReferencePreview.tsx +2 -13
- package/src/preview/components/UrlComponentPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +1 -1
- package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/preview/util.ts +2 -2
- package/src/types/auth.tsx +1 -1
- package/src/types/collections.ts +15 -4
- package/src/types/datasource.ts +42 -27
- package/src/types/entities.ts +2 -0
- package/src/types/entity_overrides.tsx +2 -2
- package/src/types/fields.tsx +23 -17
- package/src/types/navigation.ts +1 -0
- package/src/types/properties.ts +18 -17
- package/src/types/side_dialogs_controller.tsx +13 -0
- package/src/types/storage.ts +82 -0
- package/src/util/entities.ts +1 -1
- package/src/util/icon_list.ts +14 -9
- package/src/util/icons.tsx +8 -2
- package/src/util/index.ts +1 -0
- package/src/util/plurals.ts +0 -2
- package/src/util/property_utils.tsx +1 -1
- package/src/util/references.ts +3 -0
- package/src/util/resolutions.ts +43 -11
- package/src/util/storage.ts +6 -2
- package/src/util/useStorageUploadController.tsx +15 -7
- package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
- package/dist/form/PropertiesForm.d.ts +0 -8
- package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
- package/src/components/PropertyIdCopyTooltipContent.tsx +0 -27
- package/src/form/PropertiesForm.tsx +0 -81
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.9",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -46,63 +46,61 @@
|
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@firecms/
|
|
50
|
-
"@firecms/
|
|
51
|
-
"@
|
|
49
|
+
"@firecms/editor": "^3.0.0-beta.9",
|
|
50
|
+
"@firecms/formex": "^3.0.0-beta.9",
|
|
51
|
+
"@firecms/ui": "^3.0.0-beta.9",
|
|
52
52
|
"@hello-pangea/dnd": "^16.6.0",
|
|
53
53
|
"@radix-ui/react-portal": "^1.1.1",
|
|
54
54
|
"clsx": "^2.1.1",
|
|
55
55
|
"date-fns": "^3.6.0",
|
|
56
|
+
"fuse.js": "^7.0.0",
|
|
56
57
|
"history": "^5.3.0",
|
|
57
|
-
"js-search": "^2.0.1",
|
|
58
58
|
"markdown-it": "^14.1.0",
|
|
59
59
|
"notistack": "^3.0.1",
|
|
60
60
|
"object-hash": "^3.0.0",
|
|
61
61
|
"react-dropzone": "^14.2.3",
|
|
62
62
|
"react-fast-compare": "^3.2.2",
|
|
63
63
|
"react-image-file-resizer": "^0.4.8",
|
|
64
|
-
"react-markdown-editor-lite": "^1.3.4",
|
|
65
64
|
"react-transition-group": "^4.4.5",
|
|
66
65
|
"react-use-measure": "^2.1.1",
|
|
67
66
|
"react-window": "^1.8.10",
|
|
68
|
-
"typeface-rubik": "^1.1.13",
|
|
69
67
|
"yup": "^0.32.11"
|
|
70
68
|
},
|
|
71
69
|
"peerDependencies": {
|
|
72
70
|
"firebase": "^10.5.2",
|
|
73
71
|
"react": "^18.3.1",
|
|
74
72
|
"react-dom": "^18.3.1",
|
|
75
|
-
"react-router": "^6.
|
|
76
|
-
"react-router-dom": "^6.
|
|
73
|
+
"react-router": "^6.25.1",
|
|
74
|
+
"react-router-dom": "^6.25.1"
|
|
77
75
|
},
|
|
78
76
|
"devDependencies": {
|
|
79
77
|
"@jest/globals": "^29.7.0",
|
|
80
78
|
"@testing-library/react": "^15.0.7",
|
|
81
79
|
"@testing-library/user-event": "^14.5.2",
|
|
82
80
|
"@types/jest": "^29.5.12",
|
|
83
|
-
"@types/node": "^20.14.
|
|
81
|
+
"@types/node": "^20.14.12",
|
|
84
82
|
"@types/object-hash": "^3.0.6",
|
|
85
83
|
"@types/react": "^18.3.3",
|
|
86
84
|
"@types/react-dom": "^18.3.0",
|
|
87
85
|
"@types/react-measure": "^2.0.12",
|
|
88
86
|
"@vitejs/plugin-react": "^4.3.1",
|
|
89
87
|
"cross-env": "^7.0.3",
|
|
90
|
-
"firebase": "^10.12.
|
|
88
|
+
"firebase": "^10.12.4",
|
|
91
89
|
"jest": "^29.7.0",
|
|
92
90
|
"npm-run-all": "^4.1.5",
|
|
93
|
-
"react-router": "^6.
|
|
94
|
-
"react-router-dom": "^6.
|
|
95
|
-
"ts-jest": "^29.
|
|
91
|
+
"react-router": "^6.25.1",
|
|
92
|
+
"react-router-dom": "^6.25.1",
|
|
93
|
+
"ts-jest": "^29.2.3",
|
|
96
94
|
"ts-node": "^10.9.2",
|
|
97
95
|
"tsd": "^0.31.1",
|
|
98
|
-
"typescript": "^5.5.
|
|
99
|
-
"vite": "^5.3.
|
|
96
|
+
"typescript": "^5.5.4",
|
|
97
|
+
"vite": "^5.3.4"
|
|
100
98
|
},
|
|
101
99
|
"files": [
|
|
102
100
|
"dist",
|
|
103
101
|
"src"
|
|
104
102
|
],
|
|
105
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "a2fffa74049d185e674aae9f70b462f011edd1c2",
|
|
106
104
|
"publishConfig": {
|
|
107
105
|
"access": "public"
|
|
108
106
|
},
|
package/src/app/Drawer.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { DefaultDrawer } from "../core";
|
|
|
7
7
|
* If you want to customise the drawer, you can create your own component and pass it as a child.
|
|
8
8
|
* For custom drawers, you can use the {@link useApp} to open and close the drawer.
|
|
9
9
|
*
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
*/
|
|
12
12
|
export function Drawer({
|
|
13
13
|
children,
|
package/src/app/Scaffold.tsx
CHANGED
|
@@ -36,7 +36,7 @@ export interface ScaffoldProps {
|
|
|
36
36
|
* This component needs a parent {@link FireCMS}
|
|
37
37
|
*
|
|
38
38
|
* @param props
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
* @group Core
|
|
41
41
|
*/
|
|
42
42
|
export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
@@ -79,6 +79,7 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
|
79
79
|
|
|
80
80
|
const computedDrawerOpen: boolean = drawerOpen || Boolean(largeLayout && autoOpenDrawer && onHover);
|
|
81
81
|
|
|
82
|
+
const hasAppBar = Boolean(appBarChildren.length > 0);
|
|
82
83
|
return (
|
|
83
84
|
<AppContext.Provider value={{
|
|
84
85
|
logo,
|
|
@@ -115,9 +116,11 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
|
115
116
|
|
|
116
117
|
<main
|
|
117
118
|
className="flex flex-col flex-grow overflow-auto">
|
|
118
|
-
<DrawerHeader/>
|
|
119
|
+
{hasAppBar && <DrawerHeader/>}
|
|
119
120
|
<div
|
|
120
|
-
className={cls(defaultBorderMixin, "flex-grow overflow-auto lg:m-0 lg:mx-4 lg:mb-4 lg:rounded-lg lg:border lg:border-solid m-0 mt-1"
|
|
121
|
+
className={cls(defaultBorderMixin, "flex-grow overflow-auto lg:m-0 lg:mx-4 lg:mb-4 lg:rounded-lg lg:border lg:border-solid m-0 mt-1", {
|
|
122
|
+
"lg:mt-4": !hasAppBar
|
|
123
|
+
})}>
|
|
121
124
|
|
|
122
125
|
<ErrorBoundary>
|
|
123
126
|
{otherChildren}
|
|
@@ -163,17 +166,19 @@ function DrawerWrapper(props: {
|
|
|
163
166
|
<Tooltip title="Open menu"
|
|
164
167
|
side="right"
|
|
165
168
|
sideOffset={12}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
asChild={true}>
|
|
170
|
+
<div
|
|
171
|
+
className="ml-2 fixed top-2 left-3 !bg-gray-50 dark:!bg-gray-900 rounded-full w-fit z-20">
|
|
172
|
+
<IconButton
|
|
173
|
+
color="inherit"
|
|
174
|
+
aria-label="Open menu"
|
|
175
|
+
className="sticky top-2 left-3 "
|
|
176
|
+
onClick={() => props.setDrawerOpen(true)}
|
|
177
|
+
size="large"
|
|
178
|
+
>
|
|
179
|
+
<MenuIcon/>
|
|
180
|
+
</IconButton>
|
|
181
|
+
</div>
|
|
177
182
|
</Tooltip>
|
|
178
183
|
)}
|
|
179
184
|
|
|
@@ -205,7 +210,7 @@ function DrawerWrapper(props: {
|
|
|
205
210
|
aria-label="Open drawer"
|
|
206
211
|
onClick={() => props.setDrawerOpen(true)}
|
|
207
212
|
size="large"
|
|
208
|
-
className="absolute top-2 left-
|
|
213
|
+
className="absolute top-2 left-5"
|
|
209
214
|
>
|
|
210
215
|
<MenuIcon/>
|
|
211
216
|
</IconButton>
|
|
@@ -213,6 +218,8 @@ function DrawerWrapper(props: {
|
|
|
213
218
|
transparent={true}
|
|
214
219
|
open={props.open}
|
|
215
220
|
onOpenChange={props.setDrawerOpen}
|
|
221
|
+
title={"Navigaion drawer"}
|
|
222
|
+
overlayClassName={"bg-white bg-opacity-80"}
|
|
216
223
|
>
|
|
217
224
|
{innerDrawer}
|
|
218
225
|
</Sheet>
|
|
@@ -232,18 +239,6 @@ function DrawerWrapper(props: {
|
|
|
232
239
|
|
|
233
240
|
{innerDrawer}
|
|
234
241
|
|
|
235
|
-
{/*<div*/}
|
|
236
|
-
{/* className={`z-20 absolute right-0 top-4 ${*/}
|
|
237
|
-
{/* props.open ? "opacity-100" : "opacity-0 invisible"*/}
|
|
238
|
-
{/* } transition-opacity duration-1000 ease-in-out`}>*/}
|
|
239
|
-
{/* <IconButton*/}
|
|
240
|
-
{/* aria-label="Close drawer"*/}
|
|
241
|
-
{/* onClick={() => props.setDrawerOpen(false)}*/}
|
|
242
|
-
{/* >*/}
|
|
243
|
-
{/* <ChevronLeftIcon/>*/}
|
|
244
|
-
{/* </IconButton>*/}
|
|
245
|
-
{/*</div>*/}
|
|
246
|
-
|
|
247
242
|
</div>
|
|
248
243
|
);
|
|
249
244
|
}
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
AddIcon,
|
|
8
8
|
Button,
|
|
9
9
|
ContentCopyIcon,
|
|
10
|
-
fieldBackgroundHoverMixin,
|
|
10
|
+
fieldBackgroundHoverMixin,
|
|
11
|
+
HandleIcon,
|
|
11
12
|
IconButton,
|
|
12
13
|
Menu,
|
|
13
14
|
MenuItem,
|
|
@@ -26,7 +27,8 @@ interface ArrayContainerProps<T> {
|
|
|
26
27
|
onInternalIdAdded?: (id: number) => void;
|
|
27
28
|
includeAddButton?: boolean;
|
|
28
29
|
newDefaultEntry: T;
|
|
29
|
-
onValueChange: (value: T[]) => void
|
|
30
|
+
onValueChange: (value: T[]) => void,
|
|
31
|
+
className?: string;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
const buildIdsMap = (value: any[]) =>
|
|
@@ -52,7 +54,8 @@ export function ArrayContainer<T>({
|
|
|
52
54
|
onInternalIdAdded,
|
|
53
55
|
includeAddButton,
|
|
54
56
|
newDefaultEntry,
|
|
55
|
-
onValueChange
|
|
57
|
+
onValueChange,
|
|
58
|
+
className
|
|
56
59
|
}: ArrayContainerProps<T>) {
|
|
57
60
|
|
|
58
61
|
const hasValue = value && Array.isArray(value) && value.length > 0;
|
|
@@ -153,6 +156,7 @@ export function ArrayContainer<T>({
|
|
|
153
156
|
>
|
|
154
157
|
{(droppableProvided, droppableSnapshot) => (
|
|
155
158
|
<div
|
|
159
|
+
className={className}
|
|
156
160
|
{...droppableProvided.droppableProps}
|
|
157
161
|
ref={droppableProvided.innerRef}>
|
|
158
162
|
{hasValue && internalIds.map((internalId: number, index: number) => {
|
|
@@ -235,12 +239,13 @@ export function ArrayContainerItem({
|
|
|
235
239
|
{...provided.draggableProps}
|
|
236
240
|
style={provided.draggableProps.style}
|
|
237
241
|
className={`${
|
|
238
|
-
(isDragging || onHover) ?
|
|
242
|
+
(isDragging || onHover) ? "hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-20" : ""
|
|
239
243
|
} mb-1 rounded-md opacity-100`}
|
|
240
244
|
>
|
|
241
245
|
<div
|
|
242
246
|
className="flex items-start">
|
|
243
|
-
<div
|
|
247
|
+
<div
|
|
248
|
+
className="flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark">
|
|
244
249
|
{buildEntry(index, internalId)}
|
|
245
250
|
</div>
|
|
246
251
|
<ArrayItemOptions direction={size === "small" ? "row" : "column"}
|
|
@@ -253,7 +258,6 @@ export function ArrayContainerItem({
|
|
|
253
258
|
</div>;
|
|
254
259
|
}
|
|
255
260
|
|
|
256
|
-
|
|
257
261
|
export function ArrayItemOptions({
|
|
258
262
|
direction,
|
|
259
263
|
disabled,
|
|
@@ -283,11 +287,13 @@ export function ArrayItemOptions({
|
|
|
283
287
|
open={menuOpen ? false : undefined}
|
|
284
288
|
side={direction === "column" ? "left" : undefined}
|
|
285
289
|
title="Drag to move. Click for more options">
|
|
286
|
-
|
|
287
290
|
<IconButton
|
|
288
291
|
size="small"
|
|
289
292
|
disabled={disabled}
|
|
290
|
-
onClick={() =>
|
|
293
|
+
onClick={(e) => {
|
|
294
|
+
e.preventDefault();
|
|
295
|
+
setMenuOpen(true);
|
|
296
|
+
}}
|
|
291
297
|
onDragStart={(e: any) => {
|
|
292
298
|
setMenuOpen(false);
|
|
293
299
|
}}
|
|
@@ -298,7 +304,7 @@ export function ArrayItemOptions({
|
|
|
298
304
|
<Menu
|
|
299
305
|
portalContainer={iconRef.current}
|
|
300
306
|
open={menuOpen}
|
|
301
|
-
trigger={<div/>}>
|
|
307
|
+
trigger={<div tabIndex={-1}/>}>
|
|
302
308
|
|
|
303
309
|
<MenuItem dense onClick={(e) => {
|
|
304
310
|
setMenuOpen(false);
|
|
@@ -316,7 +322,6 @@ export function ArrayItemOptions({
|
|
|
316
322
|
</MenuItem>
|
|
317
323
|
|
|
318
324
|
</Menu>
|
|
319
|
-
|
|
320
325
|
</Tooltip>
|
|
321
326
|
|
|
322
327
|
</div>;
|
|
@@ -14,7 +14,6 @@ import { useFireCMSContext, useLargeLayout } from "../../hooks";
|
|
|
14
14
|
* @param size
|
|
15
15
|
* @param toggleEntitySelection
|
|
16
16
|
* @param hideId
|
|
17
|
-
* @constructor
|
|
18
17
|
*
|
|
19
18
|
* @group Collection components
|
|
20
19
|
*/
|
|
@@ -56,12 +55,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
56
55
|
const context = useFireCMSContext();
|
|
57
56
|
|
|
58
57
|
const onCheckedChange = useCallback((checked: boolean) => {
|
|
59
|
-
selectionController?.toggleEntitySelection(entity);
|
|
60
|
-
}, [entity, selectionController?.toggleEntitySelection]);
|
|
61
|
-
|
|
62
|
-
const onClick = useCallback((event: MouseEvent) => {
|
|
63
|
-
event.stopPropagation();
|
|
64
|
-
selectionController?.toggleEntitySelection(entity);
|
|
58
|
+
selectionController?.toggleEntitySelection(entity, checked);
|
|
65
59
|
}, [entity, selectionController?.toggleEntitySelection]);
|
|
66
60
|
|
|
67
61
|
const hasActions = actions.length > 0;
|
|
@@ -71,7 +65,6 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
71
65
|
const uncollapsedActions = actions.filter(a => a.collapsed === false);
|
|
72
66
|
return (
|
|
73
67
|
<div
|
|
74
|
-
onClick={onClick}
|
|
75
68
|
className={cls(
|
|
76
69
|
"h-full flex items-center justify-center flex-col bg-gray-50 dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90 z-10",
|
|
77
70
|
frozen ? "sticky left-0" : ""
|
|
@@ -87,7 +80,9 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
87
80
|
<div className="w-34 flex justify-center">
|
|
88
81
|
|
|
89
82
|
{uncollapsedActions.map((action, index) => (
|
|
90
|
-
<Tooltip key={index}
|
|
83
|
+
<Tooltip key={index}
|
|
84
|
+
title={action.name}
|
|
85
|
+
asChild={true}>
|
|
91
86
|
<IconButton
|
|
92
87
|
onClick={(event: MouseEvent) => {
|
|
93
88
|
event.stopPropagation();
|
|
@@ -246,7 +246,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
246
246
|
: collectionColumns) as VirtualTableColumn[]
|
|
247
247
|
];
|
|
248
248
|
|
|
249
|
-
const cellRenderer = (props: CellRendererParams<any>) => {
|
|
249
|
+
const cellRenderer = useCallback((props: CellRendererParams<any>) => {
|
|
250
250
|
const column = props.column;
|
|
251
251
|
const columns = props.columns;
|
|
252
252
|
const columnKey = column.key;
|
|
@@ -286,7 +286,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
286
286
|
<ErrorView error={e}/>
|
|
287
287
|
</EntityTableCell>;
|
|
288
288
|
}
|
|
289
|
-
}
|
|
289
|
+
}, [tableRowActionsBuilder, additionalCellRenderer, propertyCellRenderer, size]);
|
|
290
290
|
|
|
291
291
|
return (
|
|
292
292
|
|
|
@@ -49,6 +49,8 @@ export interface PropertyTableCellProps<T extends CMSType> {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function isStorageProperty(property: ResolvedProperty) {
|
|
52
|
+
if (property.dataType === "string" && property.markdown)
|
|
53
|
+
return false;
|
|
52
54
|
if (property.dataType === "string" && (property as ResolvedStringProperty).storage)
|
|
53
55
|
return true;
|
|
54
56
|
if (property.dataType === "array") {
|
|
@@ -147,7 +149,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
147
149
|
onValueUpdated,
|
|
148
150
|
data: entity,
|
|
149
151
|
});
|
|
150
|
-
} catch (e:any) {
|
|
152
|
+
} catch (e: any) {
|
|
151
153
|
console.error("onValueChange error", e);
|
|
152
154
|
setError(e);
|
|
153
155
|
}
|
|
@@ -306,7 +308,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
306
308
|
updateValue={updateValue}
|
|
307
309
|
/>;
|
|
308
310
|
fullHeight = true;
|
|
309
|
-
} else if (!stringProperty.storage) {
|
|
311
|
+
} else if (stringProperty.markdown || !stringProperty.storage) {
|
|
310
312
|
const multiline = Boolean(stringProperty.multiline) || Boolean(stringProperty.markdown);
|
|
311
313
|
innerComponent = <VirtualTableInput error={validationError ?? error}
|
|
312
314
|
disabled={disabled}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React, { useCallback
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
2
|
import equal from "react-fast-compare"
|
|
3
3
|
|
|
4
4
|
import { ReferencePreview } from "../../../preview";
|
|
5
5
|
import { CollectionSize, Entity, EntityCollection, EntityReference, FilterValues } from "../../../types";
|
|
6
6
|
|
|
7
7
|
import { getPreviewSizeFrom } from "../../../preview/util";
|
|
8
|
-
import { getReferenceFrom } from "../../../util";
|
|
8
|
+
import { getReferenceFrom, IconForView } from "../../../util";
|
|
9
9
|
import { useCustomizationController, useNavigationController, useReferenceDialog } from "../../../hooks";
|
|
10
10
|
import { ErrorView } from "../../ErrorView";
|
|
11
|
-
import {
|
|
11
|
+
import { cls } from "@firecms/ui";
|
|
12
12
|
import { EntityPreviewContainer } from "../../EntityPreview";
|
|
13
13
|
|
|
14
14
|
type TableReferenceFieldProps = {
|
|
@@ -39,11 +39,11 @@ export function TableReferenceField(props: TableReferenceFieldProps) {
|
|
|
39
39
|
throw Error(`Couldn't find the corresponding collection view for the path: ${path}`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
return <
|
|
42
|
+
return <TableReferenceFieldInternal {...props} collection={collection}/>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export const
|
|
46
|
-
function
|
|
45
|
+
export const TableReferenceFieldInternal = React.memo(
|
|
46
|
+
function TableReferenceFieldInternal(props: TableReferenceFieldProps & {
|
|
47
47
|
collection: EntityCollection;
|
|
48
48
|
}) {
|
|
49
49
|
const {
|
|
@@ -87,11 +87,11 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
87
87
|
}
|
|
88
88
|
);
|
|
89
89
|
|
|
90
|
-
const handleOpen =
|
|
90
|
+
const handleOpen = () => {
|
|
91
91
|
if (disabled)
|
|
92
92
|
return;
|
|
93
93
|
referenceDialogController.open();
|
|
94
|
-
}
|
|
94
|
+
};
|
|
95
95
|
|
|
96
96
|
const valueNotSet = !internalValue || (Array.isArray(internalValue) && internalValue.length === 0);
|
|
97
97
|
|
|
@@ -123,7 +123,7 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
123
123
|
key={`preview_array_ref_${name}_${index}`}>
|
|
124
124
|
<ReferencePreview
|
|
125
125
|
onClick={disabled ? undefined : handleOpen}
|
|
126
|
-
size={"
|
|
126
|
+
size={"smallest"}
|
|
127
127
|
reference={reference}
|
|
128
128
|
hover={!disabled}
|
|
129
129
|
disabled={!path}
|
|
@@ -150,13 +150,20 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
150
150
|
{internalValue && multiselect && buildMultipleReferenceField()}
|
|
151
151
|
|
|
152
152
|
{valueNotSet &&
|
|
153
|
-
<
|
|
153
|
+
<EntityPreviewContainer
|
|
154
|
+
className={cls("px-4 py-2 text-sm font-medium flex items-center uppercase",
|
|
155
|
+
multiselect ? "gap-4" : "gap-6",
|
|
156
|
+
disabled
|
|
157
|
+
? "text-slate-500"
|
|
158
|
+
: "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800")}
|
|
154
159
|
onClick={handleOpen}
|
|
155
|
-
size={"
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
size={"medium"}>
|
|
161
|
+
<IconForView
|
|
162
|
+
size={"small"}
|
|
163
|
+
collectionOrView={collection}
|
|
164
|
+
className={"text-gray-300 dark:text-gray-600"}/>
|
|
158
165
|
Edit {title}
|
|
159
|
-
</
|
|
166
|
+
</EntityPreviewContainer>}
|
|
160
167
|
|
|
161
168
|
</div>
|
|
162
169
|
);
|
|
@@ -179,10 +179,18 @@ function StorageUpload({
|
|
|
179
179
|
onDropRejected: (fileRejections, event) => {
|
|
180
180
|
for (const fileRejection of fileRejections) {
|
|
181
181
|
for (const error of fileRejection.errors) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
console.error("Error uploading file: ", error);
|
|
183
|
+
if (error.code === "file-too-large") {
|
|
184
|
+
snackbarContext.open({
|
|
185
|
+
type: "error",
|
|
186
|
+
message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
|
|
187
|
+
});
|
|
188
|
+
} else if (error.code === "file-invalid-type") {
|
|
189
|
+
snackbarContext.open({
|
|
190
|
+
type: "error",
|
|
191
|
+
message: "Error uploading file: File type is not supported"
|
|
192
|
+
});
|
|
193
|
+
}
|
|
186
194
|
}
|
|
187
195
|
}
|
|
188
196
|
}
|
|
@@ -45,22 +45,21 @@ const TableCellInner = ({
|
|
|
45
45
|
children
|
|
46
46
|
}: TableCellInnerProps) => {
|
|
47
47
|
return (
|
|
48
|
-
<div
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}}
|
|
48
|
+
<div className={cls("flex flex-col max-h-full w-full",
|
|
49
|
+
{
|
|
50
|
+
"items-start": faded || scrollable
|
|
51
|
+
})}
|
|
52
|
+
style={{
|
|
53
|
+
justifyContent,
|
|
54
|
+
height: fullHeight ? "100%" : undefined,
|
|
55
|
+
overflow: scrollable ? "auto" : undefined,
|
|
56
|
+
WebkitMaskImage: faded
|
|
57
|
+
? "linear-gradient(to bottom, black 60%, transparent 100%)"
|
|
58
|
+
: undefined,
|
|
59
|
+
maskImage: faded
|
|
60
|
+
? "linear-gradient(to bottom, black 60%, transparent 100%)"
|
|
61
|
+
: undefined
|
|
62
|
+
}}
|
|
64
63
|
>
|
|
65
64
|
{children}
|
|
66
65
|
</div>
|
|
@@ -156,8 +155,9 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
|
|
|
156
155
|
}, [ref, onSelect, selected, disabled]);
|
|
157
156
|
|
|
158
157
|
const onFocus = useCallback((event: React.SyntheticEvent<HTMLDivElement>) => {
|
|
159
|
-
onSelectCallback();
|
|
160
158
|
event.stopPropagation();
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
onSelectCallback();
|
|
161
161
|
}, [onSelectCallback]);
|
|
162
162
|
|
|
163
163
|
const isOverflowing = useMemo(() => {
|
|
@@ -203,11 +203,9 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
|
|
|
203
203
|
}}
|
|
204
204
|
tabIndex={selected || disabled ? undefined : 0}
|
|
205
205
|
onFocus={onFocus}
|
|
206
|
-
// onClick={onClick}
|
|
207
206
|
onMouseEnter={setOnHoverTrue}
|
|
208
207
|
onMouseMove={setOnHoverTrue}
|
|
209
208
|
onMouseLeave={setOnHoverFalse}
|
|
210
|
-
// contain={scrollable ? "content" : "size"}
|
|
211
209
|
>
|
|
212
210
|
|
|
213
211
|
<ErrorBoundary>
|
|
@@ -11,7 +11,14 @@ export interface EntityTableCellActionsProps {
|
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export function EntityTableCellActions({
|
|
14
|
+
export function EntityTableCellActions({
|
|
15
|
+
showError,
|
|
16
|
+
disabled,
|
|
17
|
+
showExpandIcon,
|
|
18
|
+
selected,
|
|
19
|
+
openPopup,
|
|
20
|
+
children
|
|
21
|
+
}: EntityTableCellActionsProps) {
|
|
15
22
|
|
|
16
23
|
const ref = useRef<HTMLDivElement>(null);
|
|
17
24
|
const doOpenPopup = useCallback(() => {
|
|
@@ -54,13 +61,18 @@ export function EntityTableCellActions({ showError, disabled, showExpandIcon, se
|
|
|
54
61
|
|
|
55
62
|
{showError && <ErrorTooltip
|
|
56
63
|
side={"left"}
|
|
57
|
-
className={"flex items-center justify-center"}
|
|
58
|
-
style={{ width: 32, height: 32 }}
|
|
59
64
|
title={showError.message}>
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
<div
|
|
66
|
+
className={"flex items-center justify-center"}
|
|
67
|
+
style={{
|
|
68
|
+
width: 32,
|
|
69
|
+
height: 32
|
|
70
|
+
}}>
|
|
71
|
+
<ErrorOutlineIcon
|
|
72
|
+
size={"small"}
|
|
73
|
+
color={"error"}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
64
76
|
</ErrorTooltip>
|
|
65
77
|
}
|
|
66
78
|
|
|
@@ -27,7 +27,7 @@ import { useCustomizationController, useFireCMSContext } from "../../../../hooks
|
|
|
27
27
|
import { OnCellValueChangeParams } from "../../../common";
|
|
28
28
|
|
|
29
29
|
interface PopupFormFieldProps<M extends Record<string, any>> {
|
|
30
|
-
entity
|
|
30
|
+
entity: Entity<M>;
|
|
31
31
|
customFieldValidator?: CustomFieldValidator;
|
|
32
32
|
path: string;
|
|
33
33
|
tableKey: string;
|
|
@@ -74,7 +74,7 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
|
|
|
74
74
|
y: number
|
|
75
75
|
}>();
|
|
76
76
|
|
|
77
|
-
const entityId = entityProp
|
|
77
|
+
const entityId = entityProp.id;
|
|
78
78
|
const [entity, setEntity] = useState<Entity<M> | undefined>(entityProp);
|
|
79
79
|
// useEffect(() => {
|
|
80
80
|
// if (entityId && inputCollection) {
|
|
@@ -217,7 +217,6 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
|
|
|
217
217
|
if (!entity)
|
|
218
218
|
return <></>;
|
|
219
219
|
|
|
220
|
-
// enableReinitialize={true}
|
|
221
220
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
222
221
|
const formex = useCreateFormex<M>({
|
|
223
222
|
initialValues: (entity?.values ?? {}) as EntityValues<M>,
|
|
@@ -277,9 +276,8 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
|
|
|
277
276
|
includeDescription: false,
|
|
278
277
|
underlyingValueHasChanged: false,
|
|
279
278
|
context: formContext,
|
|
280
|
-
tableMode: true,
|
|
281
279
|
partOfArray: false,
|
|
282
|
-
|
|
280
|
+
minimalistView: false,
|
|
283
281
|
autoFocus: open
|
|
284
282
|
}
|
|
285
283
|
: undefined;
|