@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.288",
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.288",
57
- "@firecms/formex": "^3.0.0-canary.288",
58
- "@firecms/ui": "^3.0.0-canary.288",
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": "e609cafa0c505803a4628324a77404ebdfbb62c4",
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, hasEntityInCache } from "../../util/entity_cache";
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
- <Tooltip key={index}
107
- title={action.name}
108
- asChild={true}>
109
- <IconButton
110
- onClick={(event: MouseEvent) => {
111
- event.stopPropagation();
112
- action.onClick({
113
- view: "collection",
114
- entity,
115
- fullPath,
116
- fullIdPath,
117
- collection,
118
- context,
119
- selectionController,
120
- highlightEntity,
121
- unhighlightEntity,
122
- onCollectionChange,
123
- openEntityMode: openEntityMode ?? collection?.openEntityMode
124
- });
125
- }}
126
- size={largeLayout ? "medium" : "small"}>
127
- {action.icon}
128
- </IconButton>
129
- </Tooltip>
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={largeLayout ? "medium" : "small"}>
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={largeLayout ? "medium" : "small"}
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={"font-mono break-words"}
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-mono break-words"}
124
+ className={"font-semibold break-words"}
125
125
  color={"secondary"}>
126
126
  {key}
127
127
  </Typography>