@firecms/core 3.0.0-canary.288 → 3.0.0-canary.289
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 +32 -26
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +31 -25
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +44 -47
- package/src/preview/property_previews/MapPropertyPreview.tsx +2 -2
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.289",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@dnd-kit/core": "^6.3.1",
|
|
54
54
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
55
55
|
"@dnd-kit/sortable": "^10.0.0",
|
|
56
|
-
"@firecms/editor": "^3.0.0-canary.
|
|
57
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
58
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
56
|
+
"@firecms/editor": "^3.0.0-canary.289",
|
|
57
|
+
"@firecms/formex": "^3.0.0-canary.289",
|
|
58
|
+
"@firecms/ui": "^3.0.0-canary.289",
|
|
59
59
|
"@radix-ui/react-portal": "^1.1.9",
|
|
60
60
|
"clsx": "^2.1.1",
|
|
61
61
|
"date-fns": "^3.6.0",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"dist",
|
|
109
109
|
"src"
|
|
110
110
|
],
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "ca236e0e8d9a91d1106bc7836b5f8945cdba35e9",
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import React, { MouseEvent, useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
|
|
4
|
-
import {
|
|
5
|
-
Checkbox,
|
|
6
|
-
Chip,
|
|
7
|
-
cls,
|
|
8
|
-
EditIcon,
|
|
9
|
-
IconButton,
|
|
10
|
-
Menu,
|
|
11
|
-
MenuItem,
|
|
12
|
-
MoreVertIcon,
|
|
13
|
-
Skeleton,
|
|
14
|
-
Tooltip
|
|
15
|
-
} from "@firecms/ui";
|
|
4
|
+
import { Badge, Checkbox, cls, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip } from "@firecms/ui";
|
|
16
5
|
import { useFireCMSContext, useLargeLayout } from "../../hooks";
|
|
17
|
-
import { getEntityFromCache
|
|
6
|
+
import { getEntityFromCache } from "../../util/entity_cache";
|
|
18
7
|
import { getLocalChangesBackup } from "../../util";
|
|
19
8
|
|
|
20
9
|
/**
|
|
@@ -82,7 +71,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
82
71
|
const uncollapsedActions = actions.filter(a => a.collapsed === false);
|
|
83
72
|
const enableLocalChangesBackup = collection ? getLocalChangesBackup(collection) : false;
|
|
84
73
|
const hasDraft = enableLocalChangesBackup ? getEntityFromCache(fullPath + "/" + entity.id) : false;
|
|
85
|
-
|
|
74
|
+
const iconSize = largeLayout && (size === "m" || size === "l" || size == "xl") ? "medium" : "small";
|
|
86
75
|
return (
|
|
87
76
|
<div
|
|
88
77
|
className={cls(
|
|
@@ -102,37 +91,50 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
102
91
|
{(hasActions || selectionEnabled) &&
|
|
103
92
|
<div className="w-34 flex justify-center">
|
|
104
93
|
|
|
105
|
-
{uncollapsedActions.map((action, index) =>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
94
|
+
{uncollapsedActions.map((action, index) => {
|
|
95
|
+
const isEditAction = action.key === "edit";
|
|
96
|
+
const tooltip = isEditAction && hasDraft ? "Local unsaved changes" : action.name;
|
|
97
|
+
|
|
98
|
+
let iconButton = <IconButton
|
|
99
|
+
onClick={(event: MouseEvent) => {
|
|
100
|
+
event.stopPropagation();
|
|
101
|
+
action.onClick({
|
|
102
|
+
view: "collection",
|
|
103
|
+
entity,
|
|
104
|
+
fullPath,
|
|
105
|
+
fullIdPath,
|
|
106
|
+
collection,
|
|
107
|
+
context,
|
|
108
|
+
selectionController,
|
|
109
|
+
highlightEntity,
|
|
110
|
+
unhighlightEntity,
|
|
111
|
+
onCollectionChange,
|
|
112
|
+
openEntityMode: openEntityMode ?? collection?.openEntityMode
|
|
113
|
+
});
|
|
114
|
+
}}
|
|
115
|
+
size={iconSize}>
|
|
116
|
+
{action.icon}
|
|
117
|
+
</IconButton>;
|
|
118
|
+
if (isEditAction && hasDraft) {
|
|
119
|
+
iconButton = (
|
|
120
|
+
<Badge color={"warning"}>
|
|
121
|
+
{iconButton}
|
|
122
|
+
</Badge>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return (
|
|
126
|
+
<Tooltip key={index}
|
|
127
|
+
title={tooltip}
|
|
128
|
+
asChild={true}>
|
|
129
|
+
{iconButton}
|
|
130
|
+
</Tooltip>
|
|
131
|
+
);
|
|
132
|
+
})}
|
|
131
133
|
|
|
132
134
|
{hasCollapsedActions &&
|
|
133
135
|
<Menu
|
|
134
136
|
trigger={<IconButton
|
|
135
|
-
size={
|
|
137
|
+
size={iconSize}>
|
|
136
138
|
<MoreVertIcon/>
|
|
137
139
|
</IconButton>}>
|
|
138
140
|
{collapsedActions.map((action, index) => (
|
|
@@ -164,7 +166,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
164
166
|
{selectionEnabled &&
|
|
165
167
|
<Tooltip title={`Select ${entity.id}`}>
|
|
166
168
|
<Checkbox
|
|
167
|
-
size={
|
|
169
|
+
size={iconSize}
|
|
168
170
|
checked={Boolean(isSelected)}
|
|
169
171
|
onCheckedChange={onCheckedChange}
|
|
170
172
|
/>
|
|
@@ -178,11 +180,6 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
178
180
|
onClick={(event) => {
|
|
179
181
|
event.stopPropagation();
|
|
180
182
|
}}>
|
|
181
|
-
{hasDraft && <Tooltip title={"Local unsaved changes"} className={"inline"}>
|
|
182
|
-
<Chip colorScheme={"orangeDarker"} className={"p-0.5"}>
|
|
183
|
-
<EditIcon size={12}/>
|
|
184
|
-
</Chip>
|
|
185
|
-
</Tooltip>}
|
|
186
183
|
<span className="min-w-0 truncate text-center">
|
|
187
184
|
{entity
|
|
188
185
|
? entity.id
|
|
@@ -68,7 +68,7 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
|
|
|
68
68
|
<div
|
|
69
69
|
className="min-w-[140px] w-[25%] py-1">
|
|
70
70
|
<Typography variant={"caption"}
|
|
71
|
-
className={"
|
|
71
|
+
className={"break-words font-semibold"}
|
|
72
72
|
color={"secondary"}>
|
|
73
73
|
{childProperty.name}
|
|
74
74
|
</Typography>
|
|
@@ -121,7 +121,7 @@ export function KeyValuePreview({ value }: { value: any }) {
|
|
|
121
121
|
key={`table-cell-title-${key}-${key}`}
|
|
122
122
|
className="min-w-[140px] w-[25%] py-1">
|
|
123
123
|
<Typography variant={"caption"}
|
|
124
|
-
className={"font-
|
|
124
|
+
className={"font-semibold break-words"}
|
|
125
125
|
color={"secondary"}>
|
|
126
126
|
{key}
|
|
127
127
|
</Typography>
|