@firecms/core 3.0.0-beta.6 → 3.0.0-beta.7
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/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +4 -2
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/EntityPreview.d.ts +3 -2
- package/dist/components/FireCMSAppBar.d.ts +4 -2
- package/dist/components/ReferenceWidget.d.ts +3 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +1 -6
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +3 -5
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/core/Drawer.d.ts +5 -12
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/NavigationRoutes.d.ts +1 -1
- package/dist/core/Scaffold.d.ts +8 -12
- package/dist/core/index.d.ts +3 -4
- package/dist/hooks/data/save.d.ts +1 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.es.js +9950 -9912
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +2 -1
- package/dist/types/collections.d.ts +8 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/properties.d.ts +8 -0
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/resolutions.d.ts +8 -8
- package/package.json +139 -122
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +2 -2
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +9 -7
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +22 -15
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +9 -1
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -6
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +2 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +19 -20
- package/src/components/EntityPreview.tsx +9 -7
- package/src/components/EntityView.tsx +4 -4
- package/src/components/FireCMSAppBar.tsx +32 -15
- package/src/components/HomePage/NavigationCard.tsx +2 -2
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/ReferenceWidget.tsx +21 -11
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +4 -2
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +4 -1
- package/src/components/VirtualTable/VirtualTable.tsx +10 -11
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +1 -6
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
- package/src/components/common/index.ts +1 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/common/types.tsx +3 -5
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/index.tsx +1 -0
- package/src/core/Drawer.tsx +16 -68
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +7 -8
- package/src/core/EntitySidePanel.tsx +1 -1
- package/src/core/FireCMS.tsx +36 -40
- package/src/core/NavigationRoutes.tsx +3 -4
- package/src/core/Scaffold.tsx +80 -66
- package/src/core/field_configs.tsx +1 -1
- package/src/core/index.tsx +3 -4
- package/src/form/EntityForm.tsx +29 -21
- package/src/form/PropertyFieldBinding.tsx +0 -2
- package/src/form/components/StorageItemPreview.tsx +2 -2
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -2
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +4 -4
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +4 -4
- package/src/hooks/data/save.ts +2 -1
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +2 -3
- package/src/hooks/useBuildNavigationController.tsx +1 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +15 -15
- package/src/internal/useBuildSideEntityController.tsx +72 -11
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/preview/components/BooleanPreview.tsx +2 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ReferencePreview.tsx +21 -22
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/types/collections.ts +14 -2
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/navigation.ts +1 -2
- package/src/types/properties.ts +10 -0
- package/src/types/storage.ts +1 -1
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/objects.ts +8 -21
- package/src/util/resolutions.ts +32 -31
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/src/core/SideEntityView.tsx +0 -38
- package/src/internal/useBuildCustomizationController.tsx +0 -5
package/package.json
CHANGED
|
@@ -1,125 +1,142 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
"author": "FireCMS",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"repository": "git@github.com:FireCMSco/firecms.git",
|
|
12
|
-
"main": "./dist/index.umd.js",
|
|
13
|
-
"module": "./dist/index.es.js",
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"source": "src/index.ts",
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=14"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"firebase",
|
|
21
|
-
"cms",
|
|
22
|
-
"admin",
|
|
23
|
-
"admin panel",
|
|
24
|
-
"firebase panel",
|
|
25
|
-
"firestore",
|
|
26
|
-
"headless",
|
|
27
|
-
"headless cms",
|
|
28
|
-
"content manager"
|
|
29
|
-
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"watch": "vite build --watch",
|
|
32
|
-
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
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"
|
|
2
|
+
"name": "@firecms/core",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "3.0.0-beta.7",
|
|
5
|
+
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
|
+
"funding": {
|
|
7
|
+
"url": "https://github.com/sponsors/firecmsco"
|
|
45
8
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
9
|
+
"author": "FireCMS",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": "git@github.com:FireCMSco/firecms.git",
|
|
12
|
+
"main": "./dist/index.umd.js",
|
|
13
|
+
"module": "./dist/index.es.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"source": "src/index.ts",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=14"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"firebase",
|
|
21
|
+
"cms",
|
|
22
|
+
"admin",
|
|
23
|
+
"admin panel",
|
|
24
|
+
"firebase panel",
|
|
25
|
+
"firestore",
|
|
26
|
+
"headless",
|
|
27
|
+
"headless cms",
|
|
28
|
+
"content manager"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"watch": "vite build --watch",
|
|
32
|
+
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
|
|
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/formex": "^3.0.0-beta.7",
|
|
50
|
+
"@firecms/ui": "^3.0.0-beta.7",
|
|
51
|
+
"@fontsource/jetbrains-mono": "^5.0.20",
|
|
52
|
+
"@hello-pangea/dnd": "^16.6.0",
|
|
53
|
+
"@radix-ui/react-portal": "^1.0.4",
|
|
54
|
+
"clsx": "^2.1.1",
|
|
55
|
+
"date-fns": "^3.6.0",
|
|
56
|
+
"history": "^5.3.0",
|
|
57
|
+
"js-search": "^2.0.1",
|
|
58
|
+
"markdown-it": "^14.1.0",
|
|
59
|
+
"notistack": "^3.0.1",
|
|
60
|
+
"object-hash": "^3.0.0",
|
|
61
|
+
"react-dropzone": "^14.2.3",
|
|
62
|
+
"react-fast-compare": "^3.2.2",
|
|
63
|
+
"react-image-file-resizer": "^0.4.8",
|
|
64
|
+
"react-markdown-editor-lite": "^1.3.4",
|
|
65
|
+
"react-transition-group": "^4.4.5",
|
|
66
|
+
"react-use-measure": "^2.1.1",
|
|
67
|
+
"react-window": "^1.8.10",
|
|
68
|
+
"typeface-rubik": "^1.1.13",
|
|
69
|
+
"yup": "^0.32.11"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"firebase": "^10.5.2",
|
|
73
|
+
"react": "^18.3.1",
|
|
74
|
+
"react-dom": "^18.3.1",
|
|
75
|
+
"react-router": "^6.22.0",
|
|
76
|
+
"react-router-dom": "^6.22.0"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@jest/globals": "^29.7.0",
|
|
80
|
+
"@testing-library/react": "^15.0.7",
|
|
81
|
+
"@testing-library/user-event": "^14.5.2",
|
|
82
|
+
"@types/jest": "^29.5.12",
|
|
83
|
+
"@types/node": "^20.12.13",
|
|
84
|
+
"@types/object-hash": "^3.0.6",
|
|
85
|
+
"@types/react": "^18.3.3",
|
|
86
|
+
"@types/react-dom": "^18.3.0",
|
|
87
|
+
"@types/react-measure": "^2.0.12",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^7.11.0",
|
|
89
|
+
"@typescript-eslint/parser": "^7.11.0",
|
|
90
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
91
|
+
"cross-env": "^7.0.3",
|
|
92
|
+
"eslint": "^8.57.0",
|
|
93
|
+
"eslint-config-standard": "^17.1.0",
|
|
94
|
+
"eslint-plugin-import": "^2.29.1",
|
|
95
|
+
"eslint-plugin-n": "^16.6.2",
|
|
96
|
+
"eslint-plugin-promise": "^6.2.0",
|
|
97
|
+
"eslint-plugin-react": "^7.34.2",
|
|
98
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
99
|
+
"firebase": "^10.12.2",
|
|
100
|
+
"jest": "^29.7.0",
|
|
101
|
+
"npm-run-all": "^4.1.5",
|
|
102
|
+
"react-router": "^6.23.1",
|
|
103
|
+
"react-router-dom": "^6.23.1",
|
|
104
|
+
"ts-jest": "^29.1.4",
|
|
105
|
+
"ts-node": "^10.9.2",
|
|
106
|
+
"tsd": "^0.31.0",
|
|
107
|
+
"typescript": "^5.4.5",
|
|
108
|
+
"vite": "^5.2.12"
|
|
109
|
+
},
|
|
110
|
+
"files": [
|
|
111
|
+
"dist",
|
|
112
|
+
"src"
|
|
113
|
+
],
|
|
114
|
+
"gitHead": "b1f5dbd89d66bd75e8d214a4a6c40e07e371a1d1",
|
|
115
|
+
"publishConfig": {
|
|
116
|
+
"access": "public"
|
|
117
|
+
},
|
|
118
|
+
"eslintConfig": {
|
|
119
|
+
"extends": [
|
|
120
|
+
"react-app",
|
|
121
|
+
"react-app/jest"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"jest": {
|
|
125
|
+
"transform": {
|
|
126
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
127
|
+
},
|
|
128
|
+
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
|
129
|
+
"moduleFileExtensions": [
|
|
130
|
+
"ts",
|
|
131
|
+
"tsx",
|
|
132
|
+
"js",
|
|
133
|
+
"jsx",
|
|
134
|
+
"json",
|
|
135
|
+
"node"
|
|
136
|
+
],
|
|
137
|
+
"testEnvironment": "node",
|
|
138
|
+
"moduleNameMapper": {
|
|
139
|
+
"\\.(css|less)$": "<rootDir>/test/__mocks__/styleMock.js"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
125
142
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { MouseEvent, useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
|
|
4
|
-
import { Checkbox,
|
|
4
|
+
import { Checkbox, cls, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
|
|
5
5
|
import { useFireCMSContext, useLargeLayout } from "../../hooks";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -72,7 +72,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
72
72
|
return (
|
|
73
73
|
<div
|
|
74
74
|
onClick={onClick}
|
|
75
|
-
className={
|
|
75
|
+
className={cls(
|
|
76
76
|
"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
77
|
frozen ? "sticky left-0" : ""
|
|
78
78
|
)}
|
|
@@ -5,7 +5,6 @@ import { ErrorBoundary } from "../ErrorBoundary";
|
|
|
5
5
|
import { useFireCMSContext, useLargeLayout } from "../../hooks";
|
|
6
6
|
import { CellRendererParams, VirtualTableColumn } from "../VirtualTable";
|
|
7
7
|
import { getValueInPath } from "../../util";
|
|
8
|
-
import { getRowHeight } from "../VirtualTable/common";
|
|
9
8
|
import { EntityCollectionRowActions } from "./EntityCollectionRowActions";
|
|
10
9
|
import { CollectionTableToolbar } from "./internal/CollectionTableToolbar";
|
|
11
10
|
import { EntityCollectionTableProps } from "./EntityCollectionTableProps";
|
|
@@ -15,6 +14,8 @@ import { renderSkeletonText } from "../../preview";
|
|
|
15
14
|
import { propertiesToColumns } from "./column_utils";
|
|
16
15
|
import { ErrorView } from "../ErrorView";
|
|
17
16
|
import { SelectableTable } from "../SelectableTable/SelectableTable";
|
|
17
|
+
import { cls } from "@firecms/ui";
|
|
18
|
+
import { getRowHeight } from "../common/table_height";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* This component is in charge of rendering a collection table with a high
|
|
@@ -42,6 +43,8 @@ import { SelectableTable } from "../SelectableTable/SelectableTable";
|
|
|
42
43
|
*/
|
|
43
44
|
export const EntityCollectionTable = function EntityCollectionTable<M extends Record<string, any>, UserType extends User>
|
|
44
45
|
({
|
|
46
|
+
className,
|
|
47
|
+
style,
|
|
45
48
|
forceFilter,
|
|
46
49
|
actionsStart,
|
|
47
50
|
actions,
|
|
@@ -72,13 +75,13 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
72
75
|
emptyComponent,
|
|
73
76
|
getIdColumnWidth,
|
|
74
77
|
onTextSearchClick,
|
|
75
|
-
textSearchLoading
|
|
78
|
+
textSearchLoading,
|
|
79
|
+
enablePopupIcon
|
|
76
80
|
}: EntityCollectionTableProps<M>) {
|
|
77
81
|
|
|
78
82
|
const ref = useRef<HTMLDivElement>(null);
|
|
79
83
|
|
|
80
84
|
const largeLayout = useLargeLayout();
|
|
81
|
-
const disabledFilterChange = Boolean(forceFilter);
|
|
82
85
|
const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
|
|
83
86
|
|
|
84
87
|
const context: FireCMSContext<UserType> = useFireCMSContext();
|
|
@@ -117,10 +120,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
117
120
|
const propertyKey = column.key;
|
|
118
121
|
|
|
119
122
|
let disabled = column.custom?.disabled;
|
|
120
|
-
const propertyValue = entity.values ? getValueInPath(entity.values, propertyKey) : undefined;
|
|
121
123
|
const property = getPropertyFor?.({
|
|
122
124
|
propertyKey,
|
|
123
|
-
propertyValue,
|
|
124
125
|
entity
|
|
125
126
|
}) ?? column.custom.resolvedProperty;
|
|
126
127
|
if (!property?.disabled) {
|
|
@@ -147,6 +148,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
147
148
|
height={getRowHeight(size)}
|
|
148
149
|
entity={entity}
|
|
149
150
|
disabled={disabled}
|
|
151
|
+
enablePopupIcon={enablePopupIcon}
|
|
150
152
|
path={entity.path}/>
|
|
151
153
|
: renderSkeletonText()
|
|
152
154
|
}
|
|
@@ -207,7 +209,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
207
209
|
properties,
|
|
208
210
|
sortable,
|
|
209
211
|
forceFilter,
|
|
210
|
-
disabledFilter: disabledFilterChange,
|
|
211
212
|
AdditionalHeaderWidget
|
|
212
213
|
});
|
|
213
214
|
|
|
@@ -290,7 +291,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
290
291
|
return (
|
|
291
292
|
|
|
292
293
|
<div ref={ref}
|
|
293
|
-
|
|
294
|
+
style={style}
|
|
295
|
+
className={cls("h-full w-full flex flex-col bg-white dark:bg-gray-950", className)}>
|
|
294
296
|
|
|
295
297
|
<CollectionTableToolbar
|
|
296
298
|
onTextSearch={textSearchEnabled ? onTextSearch : undefined}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
AdditionalFieldDelegate,
|
|
4
4
|
CollectionSize,
|
|
5
|
-
Entity,
|
|
5
|
+
Entity,
|
|
6
6
|
EntityTableController,
|
|
7
7
|
FilterValues,
|
|
8
8
|
ResolvedProperties,
|
|
@@ -12,13 +12,16 @@ import {
|
|
|
12
12
|
} from "../../types";
|
|
13
13
|
import { OnCellValueChange, OnColumnResizeParams, UniqueFieldValidator } from "../common/types";
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* @group Collection components
|
|
18
17
|
*/
|
|
19
18
|
export type EntityCollectionTableProps<M extends Record<string, any>,
|
|
20
19
|
UserType extends User = User> = {
|
|
21
20
|
|
|
21
|
+
className?: string;
|
|
22
|
+
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
|
|
22
25
|
/**
|
|
23
26
|
* Display these entities as selected
|
|
24
27
|
*/
|
|
@@ -131,15 +134,16 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
|
|
|
131
134
|
onTextSearchClick?: () => void;
|
|
132
135
|
|
|
133
136
|
textSearchLoading?: boolean;
|
|
134
|
-
|
|
137
|
+
|
|
138
|
+
enablePopupIcon: boolean;
|
|
139
|
+
};
|
|
135
140
|
|
|
136
141
|
export type GetPropertyForProps<M extends Record<string, any>> = {
|
|
137
142
|
propertyKey: string,
|
|
138
|
-
propertyValue: any,
|
|
139
143
|
entity: Entity<M>
|
|
140
144
|
};
|
|
141
145
|
|
|
142
146
|
export type PropertyColumnConfig = {
|
|
143
147
|
key: string,
|
|
144
|
-
disabled
|
|
148
|
+
disabled?: boolean,
|
|
145
149
|
};
|
|
@@ -24,14 +24,13 @@ import { getPreviewSizeFrom } from "../../preview/util";
|
|
|
24
24
|
import { isReadOnly } from "../../util";
|
|
25
25
|
|
|
26
26
|
import { CustomFieldValidator, mapPropertyToYup } from "../../form/validation";
|
|
27
|
-
import { useFireCMSContext } from "../../hooks";
|
|
28
27
|
|
|
29
28
|
import { EntityTableCell } from "./internal/EntityTableCell";
|
|
30
29
|
import { EntityTableCellActions } from "./internal/EntityTableCellActions";
|
|
31
30
|
|
|
32
|
-
import { getRowHeight } from "../VirtualTable/common";
|
|
33
31
|
import { useSelectableTableController } from "../SelectableTable/SelectableTableContext";
|
|
34
32
|
import { useClearRestoreValue } from "../../form/useClearRestoreValue";
|
|
33
|
+
import { getRowHeight } from "../common/table_height";
|
|
35
34
|
|
|
36
35
|
export interface PropertyTableCellProps<T extends CMSType> {
|
|
37
36
|
propertyKey: string;
|
|
@@ -46,6 +45,7 @@ export interface PropertyTableCellProps<T extends CMSType> {
|
|
|
46
45
|
entity: Entity<any>;
|
|
47
46
|
path: string;
|
|
48
47
|
disabled: boolean;
|
|
48
|
+
enablePopupIcon?: boolean;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function isStorageProperty(property: ResolvedProperty) {
|
|
@@ -74,11 +74,10 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
74
74
|
path,
|
|
75
75
|
entity,
|
|
76
76
|
readonly,
|
|
77
|
-
disabled: disabledProp
|
|
77
|
+
disabled: disabledProp,
|
|
78
|
+
enablePopupIcon = true
|
|
78
79
|
}: PropertyTableCellProps<T>) {
|
|
79
80
|
|
|
80
|
-
const context = useFireCMSContext();
|
|
81
|
-
|
|
82
81
|
const {
|
|
83
82
|
onValueChange,
|
|
84
83
|
size,
|
|
@@ -140,15 +139,19 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
140
139
|
setValidationError(undefined);
|
|
141
140
|
internalValueRef.current = value;
|
|
142
141
|
if (onValueChange) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
})
|
|
142
|
+
try {
|
|
143
|
+
onValueChange({
|
|
144
|
+
value,
|
|
145
|
+
propertyKey,
|
|
146
|
+
setError,
|
|
147
|
+
onValueUpdated,
|
|
148
|
+
data: entity,
|
|
149
|
+
});
|
|
150
|
+
} catch (e:any) {
|
|
151
|
+
console.error("onValueChange error", e);
|
|
152
|
+
setError(e);
|
|
153
|
+
}
|
|
154
|
+
|
|
152
155
|
}
|
|
153
156
|
})
|
|
154
157
|
.catch((e) => {
|
|
@@ -344,6 +347,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
344
347
|
path={property.path}
|
|
345
348
|
multiselect={false}
|
|
346
349
|
previewProperties={property.previewProperties}
|
|
350
|
+
includeId={property.includeId}
|
|
351
|
+
includeEntityLink={property.includeEntityLink}
|
|
347
352
|
title={property.name}
|
|
348
353
|
forceFilter={property.forceFilter}
|
|
349
354
|
/>;
|
|
@@ -388,6 +393,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
388
393
|
previewProperties={arrayProperty.of.previewProperties}
|
|
389
394
|
title={arrayProperty.name}
|
|
390
395
|
forceFilter={arrayProperty.of.forceFilter}
|
|
396
|
+
includeId={arrayProperty.of.includeId}
|
|
397
|
+
includeEntityLink={arrayProperty.of.includeEntityLink}
|
|
391
398
|
/>;
|
|
392
399
|
}
|
|
393
400
|
allowScroll = false;
|
|
@@ -399,7 +406,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
399
406
|
|
|
400
407
|
if (!innerComponent) {
|
|
401
408
|
allowScroll = false;
|
|
402
|
-
showExpandIcon = selected && !innerComponent && !disabled && !readOnlyProperty;
|
|
409
|
+
showExpandIcon = enablePopupIcon && selected && !innerComponent && !disabled && !readOnlyProperty;
|
|
403
410
|
innerComponent = (
|
|
404
411
|
<PropertyPreview width={width}
|
|
405
412
|
height={height}
|
|
@@ -21,7 +21,6 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
|
|
|
21
21
|
properties: ResolvedProperties<M>;
|
|
22
22
|
sortable?: boolean;
|
|
23
23
|
forceFilter?: FilterValues<keyof M extends string ? keyof M : never>;
|
|
24
|
-
disabledFilter?: boolean;
|
|
25
24
|
AdditionalHeaderWidget?: React.ComponentType<{
|
|
26
25
|
property: ResolvedProperty,
|
|
27
26
|
propertyKey: string,
|
|
@@ -29,7 +28,8 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
|
|
|
29
28
|
}>;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter,
|
|
31
|
+
export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter, AdditionalHeaderWidget }: PropertiesToColumnsParams<M>): VirtualTableColumn[] {
|
|
32
|
+
const disabledFilter = Boolean(forceFilter);
|
|
33
33
|
return Object.entries<ResolvedProperty>(properties)
|
|
34
34
|
.flatMap(([key, property]) => getColumnKeysForProperty(property, key))
|
|
35
35
|
.map(({
|
|
@@ -45,7 +45,7 @@ export function propertiesToColumns<M extends Record<string, any>>({ properties,
|
|
|
45
45
|
align: getTableCellAlignment(property),
|
|
46
46
|
icon: getIconForProperty(property, "small"),
|
|
47
47
|
title: property.name ?? key as string,
|
|
48
|
-
sortable: sortable
|
|
48
|
+
sortable: sortable,
|
|
49
49
|
filter: !disabledFilter && filterable,
|
|
50
50
|
width: getTablePropertyColumnWidth(property),
|
|
51
51
|
resizable: true,
|
|
@@ -22,6 +22,8 @@ type TableReferenceFieldProps = {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
path: string;
|
|
24
24
|
forceFilter?: FilterValues<string>;
|
|
25
|
+
includeId?: boolean;
|
|
26
|
+
includeEntityLink?: boolean;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
export function TableReferenceField(props: TableReferenceFieldProps) {
|
|
@@ -55,7 +57,9 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
55
57
|
title,
|
|
56
58
|
disabled,
|
|
57
59
|
forceFilter,
|
|
58
|
-
collection
|
|
60
|
+
collection,
|
|
61
|
+
includeId,
|
|
62
|
+
includeEntityLink
|
|
59
63
|
} = props;
|
|
60
64
|
|
|
61
65
|
const onSingleEntitySelected = useCallback((entity: Entity<any>) => {
|
|
@@ -100,6 +104,8 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
100
104
|
hover={!disabled}
|
|
101
105
|
disabled={!path}
|
|
102
106
|
previewProperties={previewProperties}
|
|
107
|
+
includeId={includeId}
|
|
108
|
+
includeEntityLink={includeEntityLink}
|
|
103
109
|
/>;
|
|
104
110
|
else
|
|
105
111
|
return <EntityPreviewContainer
|
|
@@ -122,6 +128,8 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
122
128
|
hover={!disabled}
|
|
123
129
|
disabled={!path}
|
|
124
130
|
previewProperties={previewProperties}
|
|
131
|
+
includeId={includeId}
|
|
132
|
+
includeEntityLink={includeEntityLink}
|
|
125
133
|
/>
|
|
126
134
|
</div>
|
|
127
135
|
)
|
|
@@ -9,7 +9,7 @@ import { useSnackbarController, useStorageSource } from "../../../hooks";
|
|
|
9
9
|
import { getThumbnailMeasure } from "../../../preview/util";
|
|
10
10
|
import { StorageFieldItem, useStorageUploadController } from "../../../util/useStorageUploadController";
|
|
11
11
|
import { StorageUploadProgress } from "../../../form/components/StorageUploadProgress";
|
|
12
|
-
import {
|
|
12
|
+
import { cls, EditIcon, IconButton, Typography } from "@firecms/ui";
|
|
13
13
|
import { EntityTableCellActions } from "../internal/EntityTableCellActions";
|
|
14
14
|
|
|
15
15
|
const dropZoneClasses = "max-w-full box-border relative pt-[2px] items-center border border-transparent outline-none rounded-md duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary-solid";
|
|
@@ -207,7 +207,7 @@ function StorageUpload({
|
|
|
207
207
|
onMouseEnter={() => setOnHover(true)}
|
|
208
208
|
onMouseMove={() => setOnHover(true)}
|
|
209
209
|
onMouseLeave={() => setOnHover(false)}
|
|
210
|
-
className={
|
|
210
|
+
className={cls(dropZoneClasses,
|
|
211
211
|
"relative w-full h-full flex",
|
|
212
212
|
`justify-${hasValue ? "start" : "center"}`,
|
|
213
213
|
isDragActive ? activeDropClasses : "",
|
|
@@ -3,7 +3,7 @@ import React, { useEffect } from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
CircularProgress,
|
|
6
|
-
|
|
6
|
+
cls,
|
|
7
7
|
defaultBorderMixin,
|
|
8
8
|
FilterListOffIcon,
|
|
9
9
|
SearchBar,
|
|
@@ -71,7 +71,7 @@ export function CollectionTableToolbar({
|
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
73
|
<div
|
|
74
|
-
className={
|
|
74
|
+
className={cls(defaultBorderMixin, "no-scrollbar min-h-[56px] overflow-x-auto px-2 md:px-4 bg-gray-50 dark:bg-gray-900 border-b flex flex-row justify-between items-center w-full")}>
|
|
75
75
|
|
|
76
76
|
<div className="flex items-center gap-2 md:mr-4 mr-2">
|
|
77
77
|
|
|
@@ -2,10 +2,9 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
|
|
2
2
|
|
|
3
3
|
import useMeasure from "react-use-measure";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { getRowHeight } from "../../VirtualTable/common";
|
|
7
|
-
import { cn, RemoveCircleIcon, Tooltip } from "@firecms/ui";
|
|
5
|
+
import { cls, RemoveCircleIcon, Tooltip } from "@firecms/ui";
|
|
8
6
|
import { ErrorBoundary } from "../../../components";
|
|
7
|
+
import { getRowHeight, TableSize } from "../../common/table_height";
|
|
9
8
|
|
|
10
9
|
interface EntityTableCellProps {
|
|
11
10
|
children: React.ReactNode;
|
|
@@ -19,7 +18,7 @@ interface EntityTableCellProps {
|
|
|
19
18
|
error?: Error;
|
|
20
19
|
allowScroll?: boolean;
|
|
21
20
|
align: "right" | "left" | "center";
|
|
22
|
-
size:
|
|
21
|
+
size: TableSize;
|
|
23
22
|
disabledTooltip?: string;
|
|
24
23
|
width: number;
|
|
25
24
|
showExpandIcon?: boolean;
|
|
@@ -47,7 +46,7 @@ const TableCellInner = ({
|
|
|
47
46
|
}: TableCellInnerProps) => {
|
|
48
47
|
return (
|
|
49
48
|
<div
|
|
50
|
-
className={
|
|
49
|
+
className={cls("flex flex-col max-h-full w-full",
|
|
51
50
|
{
|
|
52
51
|
"items-start": faded || scrollable
|
|
53
52
|
})}
|
|
@@ -186,7 +185,7 @@ export const EntityTableCell = React.memo<EntityTableCellProps>(
|
|
|
186
185
|
|
|
187
186
|
return (
|
|
188
187
|
<div
|
|
189
|
-
className={
|
|
188
|
+
className={cls(
|
|
190
189
|
"transition-colors duration-100 ease-in-out",
|
|
191
190
|
`flex relative h-full rounded-md p-${p} border border-4 border-opacity-75`,
|
|
192
191
|
onHover && !disabled ? "bg-gray-50 dark:bg-gray-900" : "",
|