@firecms/core 3.0.0-canary.162 → 3.0.0-canary.163
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/index.es.js +11 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +11 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +2 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -1
- package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.163",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"./package.json": "./package.json"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@firecms/editor": "^3.0.0-canary.
|
|
54
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
55
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
53
|
+
"@firecms/editor": "^3.0.0-canary.163",
|
|
54
|
+
"@firecms/formex": "^3.0.0-canary.163",
|
|
55
|
+
"@firecms/ui": "^3.0.0-canary.163",
|
|
56
56
|
"@hello-pangea/dnd": "^17.0.0",
|
|
57
57
|
"@radix-ui/react-portal": "^1.1.2",
|
|
58
58
|
"clsx": "^2.1.1",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"dist",
|
|
107
107
|
"src"
|
|
108
108
|
],
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "3bd40474a708b98361bce4170062c0021693394d",
|
|
110
110
|
"publishConfig": {
|
|
111
111
|
"access": "public"
|
|
112
112
|
},
|
|
@@ -88,8 +88,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
88
88
|
|
|
89
89
|
const [size, setSize] = React.useState<CollectionSize>(defaultSize ?? "m");
|
|
90
90
|
|
|
91
|
-
const selectedEntityIds = selectedEntities?.map(e => e.id);
|
|
92
|
-
|
|
93
91
|
const updateSize = useCallback((size: CollectionSize) => {
|
|
94
92
|
if (onSizeChanged)
|
|
95
93
|
onSizeChanged(size);
|
|
@@ -204,7 +202,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
204
202
|
</EntityTableCell>
|
|
205
203
|
);
|
|
206
204
|
|
|
207
|
-
}, [size
|
|
205
|
+
}, [size]);
|
|
208
206
|
|
|
209
207
|
const collectionColumns: VirtualTableColumn[] = (() => {
|
|
210
208
|
const columnsResult: VirtualTableColumn[] = propertiesToColumns({
|
|
@@ -312,7 +310,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
312
310
|
inlineEditing={inlineEditing}
|
|
313
311
|
cellRenderer={cellRenderer}
|
|
314
312
|
onEntityClick={onEntityClick}
|
|
315
|
-
highlightedRow={
|
|
313
|
+
highlightedRow={(entity: Entity<M>) => Boolean(selectedEntities?.find(e => e.id === entity.id && e.path === entity.path))}
|
|
316
314
|
tableController={tableController}
|
|
317
315
|
onValueChange={onValueChange}
|
|
318
316
|
onColumnResize={onColumnResize}
|
|
@@ -482,7 +482,7 @@ export const EntityCollectionView = React.memo(
|
|
|
482
482
|
frozen?: boolean
|
|
483
483
|
}) => {
|
|
484
484
|
|
|
485
|
-
const isSelected = usedSelectionController.selectedEntities.
|
|
485
|
+
const isSelected = Boolean(usedSelectionController.selectedEntities.find(e => e.id == entity.id && e.path == entity.path));
|
|
486
486
|
|
|
487
487
|
const actions = getActionsForEntity({
|
|
488
488
|
entity,
|
|
@@ -10,9 +10,10 @@ export function useSelectionController<M extends Record<string, any> = any>(
|
|
|
10
10
|
const toggleEntitySelection = useCallback((entity: Entity<M>, newSelectedState?: boolean) => {
|
|
11
11
|
let newValue;
|
|
12
12
|
if (newSelectedState === undefined) {
|
|
13
|
-
|
|
13
|
+
const isSelected = Boolean(selectedEntities.find(e => e.id === entity.id && e.path === entity.path));
|
|
14
|
+
if (isSelected) {
|
|
14
15
|
onSelectionChange?.(entity, false);
|
|
15
|
-
newValue = selectedEntities.filter((item: Entity<M>) => item.id
|
|
16
|
+
newValue = selectedEntities.filter((item: Entity<M>) => !(item.id === entity.id && item.path === entity.path));
|
|
16
17
|
} else {
|
|
17
18
|
onSelectionChange?.(entity, true);
|
|
18
19
|
newValue = [...selectedEntities, entity];
|
|
@@ -23,14 +24,14 @@ export function useSelectionController<M extends Record<string, any> = any>(
|
|
|
23
24
|
newValue = [...selectedEntities, entity];
|
|
24
25
|
} else {
|
|
25
26
|
onSelectionChange?.(entity, false);
|
|
26
|
-
newValue = selectedEntities.filter((item: Entity<M>) => item.id
|
|
27
|
+
newValue = selectedEntities.filter((item: Entity<M>) => !(item.id === entity.id && item.path === entity.path));
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
setSelectedEntities(newValue);
|
|
30
31
|
}, [selectedEntities]);
|
|
31
32
|
|
|
32
33
|
const isEntitySelected = useCallback((entity: Entity<M>) => {
|
|
33
|
-
return selectedEntities.
|
|
34
|
+
return Boolean(selectedEntities.find(e => e.id === entity.id && e.path === entity.path));
|
|
34
35
|
}, [selectedEntities]);
|
|
35
36
|
|
|
36
37
|
return {
|