@firecms/core 3.0.0-beta.2 → 3.0.0-beta.4

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.
Files changed (180) hide show
  1. package/README.md +1 -1
  2. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +3 -7
  3. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
  4. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +2 -2
  5. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +1 -2
  6. package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
  7. package/dist/components/EntityPreview.d.ts +25 -7
  8. package/dist/components/EntityView.d.ts +11 -0
  9. package/dist/components/FieldCaption.d.ts +5 -0
  10. package/dist/components/HomePage/NavigationCard.d.ts +8 -0
  11. package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +2 -2
  12. package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
  13. package/dist/components/HomePage/index.d.ts +3 -1
  14. package/dist/components/ReferenceWidget.d.ts +3 -3
  15. package/dist/components/VirtualTable/VirtualTableProps.d.ts +1 -1
  16. package/dist/components/index.d.ts +4 -3
  17. package/dist/contexts/AuthControllerContext.d.ts +1 -1
  18. package/dist/{internal/EntityView.d.ts → core/EntityEditView.d.ts} +2 -2
  19. package/dist/core/SideEntityView.d.ts +7 -0
  20. package/dist/core/index.d.ts +0 -2
  21. package/dist/form/EntityForm.d.ts +1 -1
  22. package/dist/form/components/StorageItemPreview.d.ts +3 -2
  23. package/dist/form/components/StorageUploadProgress.d.ts +1 -1
  24. package/dist/form/components/index.d.ts +1 -0
  25. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  26. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  27. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +4 -3
  28. package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
  29. package/dist/form/index.d.ts +1 -0
  30. package/dist/form/validation.d.ts +1 -1
  31. package/dist/hooks/data/delete.d.ts +2 -2
  32. package/dist/hooks/data/save.d.ts +1 -1
  33. package/dist/hooks/data/useDataSource.d.ts +2 -2
  34. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  35. package/dist/hooks/index.d.ts +3 -1
  36. package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
  37. package/dist/hooks/useBuildNavigationController.d.ts +5 -2
  38. package/dist/hooks/useProjectLog.d.ts +6 -2
  39. package/dist/hooks/useStorageSource.d.ts +2 -2
  40. package/dist/hooks/useValidateAuthenticator.d.ts +25 -0
  41. package/dist/index.es.js +8575 -8207
  42. package/dist/index.es.js.map +1 -1
  43. package/dist/index.umd.js +5 -5
  44. package/dist/index.umd.js.map +1 -1
  45. package/dist/internal/useBuildDataSource.d.ts +4 -0
  46. package/dist/preview/PropertyPreview.d.ts +1 -1
  47. package/dist/preview/PropertyPreviewProps.d.ts +1 -4
  48. package/dist/preview/components/BooleanPreview.d.ts +5 -1
  49. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  50. package/dist/preview/components/ReferencePreview.d.ts +1 -7
  51. package/dist/types/analytics.d.ts +1 -1
  52. package/dist/types/auth.d.ts +37 -1
  53. package/dist/types/collections.d.ts +17 -4
  54. package/dist/types/datasource.d.ts +1 -1
  55. package/dist/types/entities.d.ts +1 -0
  56. package/dist/types/entity_callbacks.d.ts +2 -2
  57. package/dist/types/entity_overrides.d.ts +6 -0
  58. package/dist/types/index.d.ts +2 -0
  59. package/dist/types/navigation.d.ts +14 -13
  60. package/dist/types/permissions.d.ts +5 -1
  61. package/dist/types/plugins.d.ts +17 -19
  62. package/dist/types/properties.d.ts +2 -2
  63. package/dist/types/property_config.d.ts +2 -2
  64. package/dist/types/roles.d.ts +31 -0
  65. package/dist/types/storage.d.ts +11 -3
  66. package/dist/types/user.d.ts +5 -0
  67. package/dist/util/collections.d.ts +9 -1
  68. package/dist/util/icons.d.ts +8 -2
  69. package/dist/util/index.d.ts +1 -0
  70. package/dist/util/permissions.d.ts +4 -4
  71. package/dist/util/references.d.ts +4 -2
  72. package/dist/util/resolutions.d.ts +1 -1
  73. package/dist/util/useTraceUpdate.d.ts +1 -0
  74. package/package.json +31 -23
  75. package/src/components/DeleteEntityDialog.tsx +4 -4
  76. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +35 -39
  77. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -282
  78. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +1 -1
  79. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +13 -13
  80. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +10 -17
  81. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +3 -3
  82. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
  83. package/src/components/EntityCollectionTable/internal/default_entity_actions.tsx +9 -5
  84. package/src/components/EntityCollectionView/EntityCollectionView.tsx +37 -58
  85. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
  86. package/src/components/EntityCollectionView/useSelectionController.tsx +30 -0
  87. package/src/components/EntityPreview.tsx +207 -70
  88. package/src/components/EntityView.tsx +84 -0
  89. package/src/components/FieldCaption.tsx +14 -0
  90. package/src/components/FireCMSAppBar.tsx +8 -0
  91. package/src/components/HomePage/DefaultHomePage.tsx +14 -10
  92. package/src/components/HomePage/NavigationCard.tsx +69 -0
  93. package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
  94. package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
  95. package/src/components/HomePage/index.tsx +3 -1
  96. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +3 -4
  97. package/src/components/ReferenceWidget.tsx +8 -8
  98. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +11 -19
  99. package/src/components/VirtualTable/VirtualTableProps.tsx +1 -1
  100. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +1 -1
  101. package/src/components/index.tsx +4 -3
  102. package/src/contexts/AuthControllerContext.tsx +1 -1
  103. package/src/core/Drawer.tsx +66 -39
  104. package/src/{internal/EntityView.tsx → core/EntityEditView.tsx} +22 -39
  105. package/src/core/EntitySidePanel.tsx +2 -2
  106. package/src/core/FireCMS.tsx +18 -2
  107. package/src/core/NavigationRoutes.tsx +8 -0
  108. package/src/core/SideEntityView.tsx +38 -0
  109. package/src/core/index.tsx +0 -2
  110. package/src/form/EntityForm.tsx +20 -12
  111. package/src/form/components/StorageItemPreview.tsx +5 -3
  112. package/src/form/components/StorageUploadProgress.tsx +6 -5
  113. package/src/form/components/index.tsx +1 -0
  114. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -3
  115. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +12 -15
  116. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -3
  117. package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
  118. package/src/form/field_bindings/KeyValueFieldBinding.tsx +18 -18
  119. package/src/form/field_bindings/MapFieldBinding.tsx +17 -17
  120. package/src/form/field_bindings/MarkdownFieldBinding.tsx +1 -2
  121. package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
  122. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +3 -3
  123. package/src/form/field_bindings/ReferenceFieldBinding.tsx +6 -4
  124. package/src/form/field_bindings/RepeatFieldBinding.tsx +3 -3
  125. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -3
  126. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +15 -6
  127. package/src/form/field_bindings/SwitchFieldBinding.tsx +2 -3
  128. package/src/form/field_bindings/TextFieldBinding.tsx +10 -9
  129. package/src/form/index.tsx +1 -0
  130. package/src/form/validation.ts +3 -4
  131. package/src/hooks/data/delete.ts +3 -3
  132. package/src/hooks/data/save.ts +1 -1
  133. package/src/hooks/data/useCollectionFetch.tsx +1 -1
  134. package/src/hooks/data/useDataSource.tsx +8 -3
  135. package/src/hooks/data/useEntityFetch.tsx +4 -4
  136. package/src/hooks/index.tsx +5 -1
  137. package/src/{core → hooks}/useBuildModeController.tsx +1 -1
  138. package/src/hooks/useBuildNavigationController.tsx +153 -76
  139. package/src/hooks/useProjectLog.tsx +16 -6
  140. package/src/hooks/useReferenceDialog.tsx +2 -2
  141. package/src/hooks/useStorageSource.tsx +7 -2
  142. package/src/hooks/useValidateAuthenticator.tsx +135 -0
  143. package/src/internal/useBuildDataSource.ts +7 -2
  144. package/src/internal/useBuildSideEntityController.tsx +3 -0
  145. package/src/preview/PropertyPreview.tsx +2 -2
  146. package/src/preview/PropertyPreviewProps.tsx +1 -11
  147. package/src/preview/components/BooleanPreview.tsx +19 -4
  148. package/src/preview/components/EnumValuesChip.tsx +1 -1
  149. package/src/preview/components/ReferencePreview.tsx +56 -148
  150. package/src/preview/property_previews/StringPropertyPreview.tsx +8 -7
  151. package/src/types/analytics.ts +1 -0
  152. package/src/types/auth.tsx +50 -1
  153. package/src/types/collections.ts +19 -4
  154. package/src/types/datasource.ts +1 -1
  155. package/src/types/entities.ts +4 -0
  156. package/src/types/entity_actions.tsx +4 -0
  157. package/src/types/entity_callbacks.ts +2 -2
  158. package/src/types/entity_overrides.tsx +7 -0
  159. package/src/types/firecms.tsx +0 -1
  160. package/src/types/index.ts +2 -0
  161. package/src/types/navigation.ts +17 -16
  162. package/src/types/permissions.ts +6 -1
  163. package/src/types/plugins.tsx +24 -27
  164. package/src/types/properties.ts +3 -2
  165. package/src/types/property_config.tsx +2 -2
  166. package/src/types/roles.ts +41 -0
  167. package/src/types/side_entity_controller.tsx +1 -0
  168. package/src/types/storage.ts +12 -3
  169. package/src/types/user.ts +7 -0
  170. package/src/util/collections.ts +22 -0
  171. package/src/util/icons.tsx +11 -3
  172. package/src/util/index.ts +1 -0
  173. package/src/util/permissions.ts +11 -8
  174. package/src/util/references.ts +36 -5
  175. package/src/util/useTraceUpdate.tsx +2 -1
  176. package/src/components/HomePage/NavigationCollectionCard.tsx +0 -146
  177. /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
  178. /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
  179. /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
  180. /package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +0 -0
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.2",
4
+ "version": "3.0.0-beta.4",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -37,16 +37,24 @@
37
37
  "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
38
38
  "generateIcons": "ts-node --esm src/icons/generateIcons.ts"
39
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
+ },
40
48
  "dependencies": {
41
- "@firecms/formex": "^3.0.0-beta.2",
42
- "@firecms/ui": "^3.0.0-beta.2",
43
- "@fontsource/ibm-plex-mono": "^5.0.8",
44
- "@fontsource/roboto": "^5.0.8",
49
+ "@firecms/formex": "^3.0.0-beta.4",
50
+ "@firecms/ui": "^3.0.0-beta.4",
51
+ "@fontsource/ibm-plex-mono": "^5.0.12",
52
+ "@fontsource/roboto": "^5.0.12",
45
53
  "@hello-pangea/dnd": "^16.5.0",
46
- "date-fns": "^3.3.1",
54
+ "date-fns": "^3.6.0",
47
55
  "history": "^5.3.0",
48
56
  "js-search": "^2.0.1",
49
- "markdown-it": "^14.0.0",
57
+ "markdown-it": "^14.1.0",
50
58
  "notistack": "^3.0.1",
51
59
  "object-hash": "^3.0.0",
52
60
  "react-image-file-resizer": "^0.4.8",
@@ -61,8 +69,8 @@
61
69
  "firebase": "^10.5.2",
62
70
  "react": "^18.2.0",
63
71
  "react-dom": "^18.2.0",
64
- "react-router": "^6.2.0",
65
- "react-router-dom": "^6.2.0"
72
+ "react-router": "^6.22.0",
73
+ "react-router-dom": "^6.22.0"
66
74
  },
67
75
  "eslintConfig": {
68
76
  "extends": [
@@ -72,42 +80,42 @@
72
80
  },
73
81
  "devDependencies": {
74
82
  "@jest/globals": "^29.7.0",
75
- "@testing-library/jest-dom": "^5.17.0",
83
+ "@testing-library/jest-dom": "^6.4.2",
76
84
  "@testing-library/react": "^14.2.1",
77
85
  "@testing-library/user-event": "^14.5.2",
78
86
  "@types/jest": "^29.5.12",
79
- "@types/node": "^20.11.16",
87
+ "@types/node": "^20.11.30",
80
88
  "@types/object-hash": "^3.0.6",
81
- "@types/react": "^18.2.54",
82
- "@types/react-dom": "^18.2.18",
89
+ "@types/react": "^18.2.67",
90
+ "@types/react-dom": "^18.2.22",
83
91
  "@types/react-measure": "^2.0.12",
84
- "@typescript-eslint/eslint-plugin": "^5.62.0",
85
- "@typescript-eslint/parser": "^5.62.0",
92
+ "@typescript-eslint/eslint-plugin": "^7.3.1",
93
+ "@typescript-eslint/parser": "^7.3.1",
86
94
  "@vitejs/plugin-react": "^4.2.1",
87
95
  "cross-env": "^7.0.3",
88
- "eslint": "^8.56.0",
96
+ "eslint": "^8.57.0",
89
97
  "eslint-config-standard": "^17.1.0",
90
98
  "eslint-plugin-import": "^2.29.1",
91
- "eslint-plugin-n": "^15.7.0",
99
+ "eslint-plugin-n": "^16.6.2",
92
100
  "eslint-plugin-promise": "^6.1.1",
93
- "eslint-plugin-react": "^7.33.2",
101
+ "eslint-plugin-react": "^7.34.1",
94
102
  "eslint-plugin-react-hooks": "^4.6.0",
95
- "firebase": "^10.8.0",
103
+ "firebase": "^10.9.0",
96
104
  "jest": "^29.7.0",
97
105
  "npm-run-all": "^4.1.5",
98
106
  "react-router": "^6.22.0",
99
107
  "react-router-dom": "^6.22.0",
100
108
  "ts-jest": "^29.1.2",
101
109
  "ts-node": "^10.9.2",
102
- "tsd": "^0.30.4",
103
- "typescript": "^5.3.3",
104
- "vite": "^5.1.1"
110
+ "tsd": "^0.30.7",
111
+ "typescript": "^5.4.2",
112
+ "vite": "^5.2.3"
105
113
  },
106
114
  "files": [
107
115
  "dist",
108
116
  "src"
109
117
  ],
110
- "gitHead": "9c3561bc09311f2339bb6fa224c88a62d3b19617",
118
+ "gitHead": "fb4310807b061e7837804d969829dc485c2f349d",
111
119
  "publishConfig": {
112
120
  "access": "public"
113
121
  }
@@ -9,7 +9,7 @@ import {
9
9
  useSnackbarController
10
10
  } from "../hooks";
11
11
  import { resolveCollection } from "../util";
12
- import { EntityPreview } from "./EntityPreview";
12
+ import { EntityView } from "./EntityView";
13
13
 
14
14
  export interface DeleteEntityDialogProps<M extends Record<string, any>> {
15
15
  entityOrEntitiesToDelete?: Entity<M> | Entity<M>[],
@@ -35,7 +35,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
35
35
  path
36
36
  }: DeleteEntityDialogProps<M>) {
37
37
 
38
- const dataSource = useDataSource();
38
+ const dataSource = useDataSource(collection);
39
39
  const customizationController = useCustomizationController();
40
40
  const snackbarController = useSnackbarController();
41
41
  const [loading, setLoading] = useState(false);
@@ -163,7 +163,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
163
163
  } else {
164
164
  const entity = entityOrEntities as Entity<M> | undefined;
165
165
  content = entity
166
- ? <EntityPreview
166
+ ? <EntityView
167
167
  entity={entity}
168
168
  collection={collection}
169
169
  path={path}/>
@@ -176,7 +176,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
176
176
 
177
177
  return (
178
178
  <Dialog
179
- maxWidth={"2xl"}
179
+ maxWidth={multipleEntities ? "lg" : "2xl"}
180
180
  aria-labelledby="delete-dialog"
181
181
  open={open}
182
182
  onOpenChange={(open) => !open ? onClose() : undefined}
@@ -1,5 +1,4 @@
1
1
  import React, { MouseEvent, useCallback } from "react";
2
- import equal from "react-fast-compare"
3
2
 
4
3
  import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
5
4
  import { Checkbox, cn, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
@@ -14,46 +13,43 @@ import { useFireCMSContext, useLargeLayout } from "../../hooks";
14
13
  * @param selectionEnabled
15
14
  * @param size
16
15
  * @param toggleEntitySelection
17
- * @param onCopyClicked
18
- * @param onEditClicked
19
- * @param onDeleteClicked
20
16
  * @param hideId
21
17
  * @constructor
22
18
  *
23
19
  * @group Collection components
24
20
  */
25
- export const EntityCollectionRowActions = React.memo(function EntityCollectionRowActions({
26
- entity,
27
- collection,
28
- fullPath,
29
- width,
30
- frozen,
31
- isSelected,
32
- selectionEnabled,
33
- size,
34
- highlightEntity,
35
- onCollectionChange,
36
- unhighlightEntity,
37
- actions = [],
38
- hideId,
39
- selectionController,
40
- }:
41
- {
42
- entity: Entity<any>,
43
- collection?: EntityCollection<any>,
44
- fullPath?: string,
45
- width: number,
46
- frozen?: boolean,
47
- size: CollectionSize,
48
- isSelected?: boolean,
49
- selectionEnabled?: boolean,
50
- actions?: EntityAction[],
51
- hideId?: boolean,
52
- onCollectionChange?: () => void,
53
- selectionController?: SelectionController;
54
- highlightEntity?: (entity: Entity<any>) => void;
55
- unhighlightEntity?: (entity: Entity<any>) => void;
56
- }) {
21
+ export const EntityCollectionRowActions = function EntityCollectionRowActions({
22
+ entity,
23
+ collection,
24
+ fullPath,
25
+ width,
26
+ frozen,
27
+ isSelected,
28
+ selectionEnabled,
29
+ size,
30
+ highlightEntity,
31
+ onCollectionChange,
32
+ unhighlightEntity,
33
+ actions = [],
34
+ hideId,
35
+ selectionController,
36
+ }:
37
+ {
38
+ entity: Entity<any>,
39
+ collection?: EntityCollection<any>,
40
+ fullPath?: string,
41
+ width: number,
42
+ frozen?: boolean,
43
+ size: CollectionSize,
44
+ isSelected?: boolean,
45
+ selectionEnabled?: boolean,
46
+ actions?: EntityAction[],
47
+ hideId?: boolean,
48
+ onCollectionChange?: () => void,
49
+ selectionController?: SelectionController;
50
+ highlightEntity?: (entity: Entity<any>) => void;
51
+ unhighlightEntity?: (entity: Entity<any>) => void;
52
+ }) {
57
53
 
58
54
  const largeLayout = useLargeLayout();
59
55
 
@@ -103,7 +99,7 @@ export const EntityCollectionRowActions = React.memo(function EntityCollectionRo
103
99
  selectionController,
104
100
  highlightEntity,
105
101
  unhighlightEntity,
106
- onCollectionChange
102
+ onCollectionChange,
107
103
  });
108
104
  }}
109
105
  size={largeLayout ? "medium" : "small"}>
@@ -131,7 +127,7 @@ export const EntityCollectionRowActions = React.memo(function EntityCollectionRo
131
127
  selectionController,
132
128
  highlightEntity,
133
129
  unhighlightEntity,
134
- onCollectionChange
130
+ onCollectionChange,
135
131
  });
136
132
  }}>
137
133
  {action.icon}
@@ -171,4 +167,4 @@ export const EntityCollectionRowActions = React.memo(function EntityCollectionRo
171
167
  </div>
172
168
  );
173
169
 
174
- }, equal);
170
+ };