@contentful/field-editor-reference 6.3.1 → 6.3.3
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/cjs/assets/WrappedAssetCard/FetchingWrappedAssetCard.js +1 -2
- package/dist/cjs/assets/WrappedAssetCard/WrappedAssetCard.js +16 -17
- package/dist/cjs/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +1 -2
- package/dist/cjs/entries/WrappedEntryCard/WrappedEntryCard.js +46 -47
- package/dist/esm/assets/WrappedAssetCard/FetchingWrappedAssetCard.js +1 -2
- package/dist/esm/assets/WrappedAssetCard/WrappedAssetCard.js +16 -17
- package/dist/esm/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +1 -2
- package/dist/esm/entries/WrappedEntryCard/WrappedEntryCard.js +46 -47
- package/dist/types/assets/WrappedAssetCard/WrappedAssetCard.d.ts +1 -2
- package/dist/types/common/customCardTypes.d.ts +0 -1
- package/dist/types/entries/WrappedEntryCard/WrappedEntryCard.d.ts +1 -2
- package/package.json +2 -2
|
@@ -127,8 +127,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
127
127
|
onRemove,
|
|
128
128
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
129
129
|
localesStatusMap,
|
|
130
|
-
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
131
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
130
|
+
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
132
131
|
};
|
|
133
132
|
if (props.viewType === 'link') {
|
|
134
133
|
if (status === 'loading') {
|
|
@@ -86,24 +86,23 @@ function getFileType(file) {
|
|
|
86
86
|
});
|
|
87
87
|
return groupToIconMap[groupName] || 'archive';
|
|
88
88
|
}
|
|
89
|
-
const WrappedAssetCard = (
|
|
90
|
-
const
|
|
91
|
-
const status = _fieldeditorshared.entityHelpers.getEntityStatus(props.asset.sys, props.useLocalizedEntityStatus ? props.localeCode : undefined);
|
|
89
|
+
const WrappedAssetCard = ({ asset, className, size, localeCode, defaultLocaleCode, activeLocales, localesStatusMap, isDisabled, isSelected, isClickable, useLocalizedEntityStatus, renderDragHandle, getEntityScheduledActions, onEdit, getAssetUrl, onRemove })=>{
|
|
90
|
+
const status = _fieldeditorshared.entityHelpers.getEntityStatus(asset.sys, useLocalizedEntityStatus ? localeCode : undefined);
|
|
92
91
|
if (status === 'deleted') {
|
|
93
92
|
return _react.createElement(_components.MissingAssetCard, {
|
|
94
93
|
asSquare: true,
|
|
95
|
-
isDisabled:
|
|
96
|
-
onRemove:
|
|
94
|
+
isDisabled: isDisabled,
|
|
95
|
+
onRemove: onRemove
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
const entityTitle = _fieldeditorshared.entityHelpers.getAssetTitle({
|
|
100
|
-
asset:
|
|
101
|
-
localeCode:
|
|
102
|
-
defaultLocaleCode:
|
|
99
|
+
asset: asset,
|
|
100
|
+
localeCode: localeCode,
|
|
101
|
+
defaultLocaleCode: defaultLocaleCode,
|
|
103
102
|
defaultTitle: 'Untitled'
|
|
104
103
|
});
|
|
105
|
-
const entityFile =
|
|
106
|
-
const href = getAssetUrl ? getAssetUrl(
|
|
104
|
+
const entityFile = asset.fields.file ? asset.fields.file[localeCode] || asset.fields.file[defaultLocaleCode] : undefined;
|
|
105
|
+
const href = getAssetUrl ? getAssetUrl(asset.sys.id) : undefined;
|
|
107
106
|
return _react.createElement(_f36components.AssetCard, {
|
|
108
107
|
as: href ? 'a' : 'article',
|
|
109
108
|
type: getFileType(entityFile),
|
|
@@ -112,13 +111,13 @@ const WrappedAssetCard = (props)=>{
|
|
|
112
111
|
isSelected: isSelected,
|
|
113
112
|
href: href,
|
|
114
113
|
badge: _react.createElement(_components.EntityStatusBadge, {
|
|
115
|
-
getEntityScheduledActions:
|
|
114
|
+
getEntityScheduledActions: getEntityScheduledActions,
|
|
116
115
|
entityType: "Asset",
|
|
117
116
|
status: status,
|
|
118
|
-
useLocalizedEntityStatus:
|
|
119
|
-
entity:
|
|
120
|
-
localesStatusMap:
|
|
121
|
-
activeLocales:
|
|
117
|
+
useLocalizedEntityStatus: useLocalizedEntityStatus,
|
|
118
|
+
entity: asset,
|
|
119
|
+
localesStatusMap: localesStatusMap,
|
|
120
|
+
activeLocales: activeLocales
|
|
122
121
|
}),
|
|
123
122
|
src: entityFile && entityFile.url ? size === 'small' ? `${entityFile.url}?w=150&h=150&fit=thumb` : `${entityFile.url}?h=300` : '',
|
|
124
123
|
onClick: isClickable ? (e)=>{
|
|
@@ -131,8 +130,8 @@ const WrappedAssetCard = (props)=>{
|
|
|
131
130
|
onEdit();
|
|
132
131
|
}
|
|
133
132
|
} : undefined,
|
|
134
|
-
dragHandleRender:
|
|
135
|
-
withDragHandle: !!
|
|
133
|
+
dragHandleRender: renderDragHandle,
|
|
134
|
+
withDragHandle: !!renderDragHandle,
|
|
136
135
|
actions: [
|
|
137
136
|
...(0, _AssetCardActions.renderActions)({
|
|
138
137
|
entityFile,
|
|
@@ -164,8 +164,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
164
164
|
isBeingDragged: props.isBeingDragged,
|
|
165
165
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
166
166
|
localesStatusMap,
|
|
167
|
-
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
168
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
167
|
+
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
169
168
|
};
|
|
170
169
|
const { hasCardEditActions, hasCardMoveActions, hasCardRemoveActions } = props;
|
|
171
170
|
function renderDefaultCard(props) {
|
|
@@ -61,18 +61,17 @@ const defaultProps = {
|
|
|
61
61
|
hasCardMoveActions: true,
|
|
62
62
|
hasCardRemoveActions: true
|
|
63
63
|
};
|
|
64
|
-
function WrappedEntryCard(
|
|
64
|
+
function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales, localeCode, defaultLocaleCode, localesStatusMap, useLocalizedEntityStatus, size, spaceName, isClickable, isDisabled, isSelected, hasCardMoveActions, hasCardEditActions, hasCardRemoveActions, renderDragHandle, getAsset, getEntityScheduledActions, onClick, onEdit, onRemove, onMoveTop, onMoveBottom }) {
|
|
65
65
|
const [file, setFile] = _react.useState(null);
|
|
66
|
-
const { contentType } = props;
|
|
67
66
|
_react.useEffect(()=>{
|
|
68
67
|
let mounted = true;
|
|
69
|
-
if (
|
|
68
|
+
if (entry) {
|
|
70
69
|
getEntryImage({
|
|
71
|
-
entry
|
|
70
|
+
entry,
|
|
72
71
|
contentType,
|
|
73
|
-
localeCode
|
|
74
|
-
defaultLocaleCode
|
|
75
|
-
},
|
|
72
|
+
localeCode,
|
|
73
|
+
defaultLocaleCode
|
|
74
|
+
}, getAsset).then((file)=>{
|
|
76
75
|
if (mounted) {
|
|
77
76
|
setFile(file);
|
|
78
77
|
}
|
|
@@ -86,92 +85,92 @@ function WrappedEntryCard(props) {
|
|
|
86
85
|
mounted = false;
|
|
87
86
|
};
|
|
88
87
|
}, [
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
entry,
|
|
89
|
+
getAsset,
|
|
91
90
|
contentType,
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
localeCode,
|
|
92
|
+
defaultLocaleCode
|
|
94
93
|
]);
|
|
95
|
-
const status = getEntityStatus(
|
|
94
|
+
const status = getEntityStatus(entry?.sys, useLocalizedEntityStatus ? localeCode : undefined);
|
|
96
95
|
if (status === 'deleted') {
|
|
97
96
|
return _react.createElement(_components.MissingEntityCard, {
|
|
98
|
-
isDisabled:
|
|
99
|
-
onRemove:
|
|
97
|
+
isDisabled: isDisabled,
|
|
98
|
+
onRemove: onRemove,
|
|
100
99
|
providerName: "Contentful"
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
const title = getEntryTitle({
|
|
104
|
-
entry
|
|
103
|
+
entry,
|
|
105
104
|
contentType,
|
|
106
|
-
localeCode
|
|
107
|
-
defaultLocaleCode
|
|
105
|
+
localeCode,
|
|
106
|
+
defaultLocaleCode,
|
|
108
107
|
defaultTitle: 'Untitled'
|
|
109
108
|
});
|
|
110
109
|
const description = getEntityDescription({
|
|
111
|
-
entity:
|
|
110
|
+
entity: entry,
|
|
112
111
|
contentType,
|
|
113
|
-
localeCode
|
|
114
|
-
defaultLocaleCode
|
|
112
|
+
localeCode,
|
|
113
|
+
defaultLocaleCode
|
|
115
114
|
});
|
|
116
115
|
return _react.createElement(_f36components.EntryCard, {
|
|
117
|
-
as:
|
|
118
|
-
href:
|
|
116
|
+
as: entryUrl ? 'a' : 'article',
|
|
117
|
+
href: entryUrl,
|
|
119
118
|
title: title,
|
|
120
119
|
description: description,
|
|
121
120
|
contentType: contentType?.name,
|
|
122
|
-
size:
|
|
123
|
-
isSelected:
|
|
121
|
+
size: size,
|
|
122
|
+
isSelected: isSelected,
|
|
124
123
|
badge: _react.createElement(_components.EntityStatusBadge, {
|
|
125
124
|
status: status,
|
|
126
125
|
entityType: "Entry",
|
|
127
|
-
getEntityScheduledActions:
|
|
128
|
-
useLocalizedEntityStatus:
|
|
129
|
-
entity:
|
|
130
|
-
localesStatusMap:
|
|
131
|
-
activeLocales:
|
|
126
|
+
getEntityScheduledActions: getEntityScheduledActions,
|
|
127
|
+
useLocalizedEntityStatus: useLocalizedEntityStatus,
|
|
128
|
+
entity: entry,
|
|
129
|
+
localesStatusMap: localesStatusMap,
|
|
130
|
+
activeLocales: activeLocales
|
|
132
131
|
}),
|
|
133
|
-
icon:
|
|
134
|
-
spaceName:
|
|
135
|
-
environmentName:
|
|
132
|
+
icon: spaceName ? _react.createElement(_SpaceName.SpaceName, {
|
|
133
|
+
spaceName: spaceName,
|
|
134
|
+
environmentName: entry.sys.environment.sys.id
|
|
136
135
|
}) : null,
|
|
137
136
|
thumbnailElement: file && (0, _fieldeditorshared.isValidImage)(file) ? _react.createElement(_components.AssetThumbnail, {
|
|
138
137
|
file: file
|
|
139
138
|
}) : undefined,
|
|
140
|
-
dragHandleRender:
|
|
141
|
-
withDragHandle: !!
|
|
142
|
-
actions:
|
|
143
|
-
|
|
139
|
+
dragHandleRender: renderDragHandle,
|
|
140
|
+
withDragHandle: !!renderDragHandle,
|
|
141
|
+
actions: onEdit || onRemove ? [
|
|
142
|
+
hasCardEditActions && onEdit ? _react.createElement(_f36components.MenuItem, {
|
|
144
143
|
key: "edit",
|
|
145
144
|
testId: "edit",
|
|
146
145
|
onClick: ()=>{
|
|
147
|
-
|
|
146
|
+
onEdit && onEdit();
|
|
148
147
|
}
|
|
149
148
|
}, "Edit") : null,
|
|
150
|
-
|
|
149
|
+
hasCardRemoveActions && onRemove ? _react.createElement(_f36components.MenuItem, {
|
|
151
150
|
key: "delete",
|
|
152
151
|
testId: "delete",
|
|
153
152
|
onClick: ()=>{
|
|
154
|
-
|
|
153
|
+
onRemove && onRemove();
|
|
155
154
|
}
|
|
156
155
|
}, "Remove") : null,
|
|
157
|
-
|
|
156
|
+
hasCardMoveActions && (onMoveTop || onMoveBottom) ? _react.createElement(_f36components.MenuDivider, {
|
|
158
157
|
key: "divider"
|
|
159
158
|
}) : null,
|
|
160
|
-
|
|
159
|
+
hasCardMoveActions && onMoveTop ? _react.createElement(_f36components.MenuItem, {
|
|
161
160
|
key: "move-top",
|
|
162
|
-
onClick: ()=>
|
|
161
|
+
onClick: ()=>onMoveTop && onMoveTop(),
|
|
163
162
|
testId: "move-top"
|
|
164
163
|
}, "Move to top") : null,
|
|
165
|
-
|
|
164
|
+
hasCardMoveActions && onMoveBottom ? _react.createElement(_f36components.MenuItem, {
|
|
166
165
|
key: "move-bottom",
|
|
167
|
-
onClick: ()=>
|
|
166
|
+
onClick: ()=>onMoveBottom && onMoveBottom(),
|
|
168
167
|
testId: "move-bottom"
|
|
169
168
|
}, "Move to bottom") : null
|
|
170
169
|
].filter((item)=>item) : [],
|
|
171
|
-
onClick:
|
|
170
|
+
onClick: isClickable ? (e)=>{
|
|
172
171
|
e.preventDefault();
|
|
173
|
-
if (
|
|
174
|
-
|
|
172
|
+
if (onClick) return onClick(e);
|
|
173
|
+
onEdit && onEdit();
|
|
175
174
|
} : undefined
|
|
176
175
|
});
|
|
177
176
|
}
|
|
@@ -76,8 +76,7 @@ export function FetchingWrappedAssetCard(props) {
|
|
|
76
76
|
onRemove,
|
|
77
77
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
78
78
|
localesStatusMap,
|
|
79
|
-
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
80
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
79
|
+
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
81
80
|
};
|
|
82
81
|
if (props.viewType === 'link') {
|
|
83
82
|
if (status === 'loading') {
|
|
@@ -30,24 +30,23 @@ function getFileType(file) {
|
|
|
30
30
|
});
|
|
31
31
|
return groupToIconMap[groupName] || 'archive';
|
|
32
32
|
}
|
|
33
|
-
export const WrappedAssetCard = (
|
|
34
|
-
const
|
|
35
|
-
const status = entityHelpers.getEntityStatus(props.asset.sys, props.useLocalizedEntityStatus ? props.localeCode : undefined);
|
|
33
|
+
export const WrappedAssetCard = ({ asset, className, size, localeCode, defaultLocaleCode, activeLocales, localesStatusMap, isDisabled, isSelected, isClickable, useLocalizedEntityStatus, renderDragHandle, getEntityScheduledActions, onEdit, getAssetUrl, onRemove })=>{
|
|
34
|
+
const status = entityHelpers.getEntityStatus(asset.sys, useLocalizedEntityStatus ? localeCode : undefined);
|
|
36
35
|
if (status === 'deleted') {
|
|
37
36
|
return React.createElement(MissingAssetCard, {
|
|
38
37
|
asSquare: true,
|
|
39
|
-
isDisabled:
|
|
40
|
-
onRemove:
|
|
38
|
+
isDisabled: isDisabled,
|
|
39
|
+
onRemove: onRemove
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
const entityTitle = entityHelpers.getAssetTitle({
|
|
44
|
-
asset:
|
|
45
|
-
localeCode:
|
|
46
|
-
defaultLocaleCode:
|
|
43
|
+
asset: asset,
|
|
44
|
+
localeCode: localeCode,
|
|
45
|
+
defaultLocaleCode: defaultLocaleCode,
|
|
47
46
|
defaultTitle: 'Untitled'
|
|
48
47
|
});
|
|
49
|
-
const entityFile =
|
|
50
|
-
const href = getAssetUrl ? getAssetUrl(
|
|
48
|
+
const entityFile = asset.fields.file ? asset.fields.file[localeCode] || asset.fields.file[defaultLocaleCode] : undefined;
|
|
49
|
+
const href = getAssetUrl ? getAssetUrl(asset.sys.id) : undefined;
|
|
51
50
|
return React.createElement(AssetCard, {
|
|
52
51
|
as: href ? 'a' : 'article',
|
|
53
52
|
type: getFileType(entityFile),
|
|
@@ -56,13 +55,13 @@ export const WrappedAssetCard = (props)=>{
|
|
|
56
55
|
isSelected: isSelected,
|
|
57
56
|
href: href,
|
|
58
57
|
badge: React.createElement(EntityStatusBadge, {
|
|
59
|
-
getEntityScheduledActions:
|
|
58
|
+
getEntityScheduledActions: getEntityScheduledActions,
|
|
60
59
|
entityType: "Asset",
|
|
61
60
|
status: status,
|
|
62
|
-
useLocalizedEntityStatus:
|
|
63
|
-
entity:
|
|
64
|
-
localesStatusMap:
|
|
65
|
-
activeLocales:
|
|
61
|
+
useLocalizedEntityStatus: useLocalizedEntityStatus,
|
|
62
|
+
entity: asset,
|
|
63
|
+
localesStatusMap: localesStatusMap,
|
|
64
|
+
activeLocales: activeLocales
|
|
66
65
|
}),
|
|
67
66
|
src: entityFile && entityFile.url ? size === 'small' ? `${entityFile.url}?w=150&h=150&fit=thumb` : `${entityFile.url}?h=300` : '',
|
|
68
67
|
onClick: isClickable ? (e)=>{
|
|
@@ -75,8 +74,8 @@ export const WrappedAssetCard = (props)=>{
|
|
|
75
74
|
onEdit();
|
|
76
75
|
}
|
|
77
76
|
} : undefined,
|
|
78
|
-
dragHandleRender:
|
|
79
|
-
withDragHandle: !!
|
|
77
|
+
dragHandleRender: renderDragHandle,
|
|
78
|
+
withDragHandle: !!renderDragHandle,
|
|
80
79
|
actions: [
|
|
81
80
|
...renderActions({
|
|
82
81
|
entityFile,
|
|
@@ -108,8 +108,7 @@ export function FetchingWrappedEntryCard(props) {
|
|
|
108
108
|
isBeingDragged: props.isBeingDragged,
|
|
109
109
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
110
110
|
localesStatusMap,
|
|
111
|
-
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
112
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
111
|
+
activeLocales: props.sdk.parameters.instance.activeLocales
|
|
113
112
|
};
|
|
114
113
|
const { hasCardEditActions, hasCardMoveActions, hasCardRemoveActions } = props;
|
|
115
114
|
function renderDefaultCard(props) {
|
|
@@ -10,18 +10,17 @@ const defaultProps = {
|
|
|
10
10
|
hasCardMoveActions: true,
|
|
11
11
|
hasCardRemoveActions: true
|
|
12
12
|
};
|
|
13
|
-
export function WrappedEntryCard(
|
|
13
|
+
export function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales, localeCode, defaultLocaleCode, localesStatusMap, useLocalizedEntityStatus, size, spaceName, isClickable, isDisabled, isSelected, hasCardMoveActions, hasCardEditActions, hasCardRemoveActions, renderDragHandle, getAsset, getEntityScheduledActions, onClick, onEdit, onRemove, onMoveTop, onMoveBottom }) {
|
|
14
14
|
const [file, setFile] = React.useState(null);
|
|
15
|
-
const { contentType } = props;
|
|
16
15
|
React.useEffect(()=>{
|
|
17
16
|
let mounted = true;
|
|
18
|
-
if (
|
|
17
|
+
if (entry) {
|
|
19
18
|
getEntryImage({
|
|
20
|
-
entry
|
|
19
|
+
entry,
|
|
21
20
|
contentType,
|
|
22
|
-
localeCode
|
|
23
|
-
defaultLocaleCode
|
|
24
|
-
},
|
|
21
|
+
localeCode,
|
|
22
|
+
defaultLocaleCode
|
|
23
|
+
}, getAsset).then((file)=>{
|
|
25
24
|
if (mounted) {
|
|
26
25
|
setFile(file);
|
|
27
26
|
}
|
|
@@ -35,92 +34,92 @@ export function WrappedEntryCard(props) {
|
|
|
35
34
|
mounted = false;
|
|
36
35
|
};
|
|
37
36
|
}, [
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
entry,
|
|
38
|
+
getAsset,
|
|
40
39
|
contentType,
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
localeCode,
|
|
41
|
+
defaultLocaleCode
|
|
43
42
|
]);
|
|
44
|
-
const status = getEntityStatus(
|
|
43
|
+
const status = getEntityStatus(entry?.sys, useLocalizedEntityStatus ? localeCode : undefined);
|
|
45
44
|
if (status === 'deleted') {
|
|
46
45
|
return React.createElement(MissingEntityCard, {
|
|
47
|
-
isDisabled:
|
|
48
|
-
onRemove:
|
|
46
|
+
isDisabled: isDisabled,
|
|
47
|
+
onRemove: onRemove,
|
|
49
48
|
providerName: "Contentful"
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
51
|
const title = getEntryTitle({
|
|
53
|
-
entry
|
|
52
|
+
entry,
|
|
54
53
|
contentType,
|
|
55
|
-
localeCode
|
|
56
|
-
defaultLocaleCode
|
|
54
|
+
localeCode,
|
|
55
|
+
defaultLocaleCode,
|
|
57
56
|
defaultTitle: 'Untitled'
|
|
58
57
|
});
|
|
59
58
|
const description = getEntityDescription({
|
|
60
|
-
entity:
|
|
59
|
+
entity: entry,
|
|
61
60
|
contentType,
|
|
62
|
-
localeCode
|
|
63
|
-
defaultLocaleCode
|
|
61
|
+
localeCode,
|
|
62
|
+
defaultLocaleCode
|
|
64
63
|
});
|
|
65
64
|
return React.createElement(EntryCard, {
|
|
66
|
-
as:
|
|
67
|
-
href:
|
|
65
|
+
as: entryUrl ? 'a' : 'article',
|
|
66
|
+
href: entryUrl,
|
|
68
67
|
title: title,
|
|
69
68
|
description: description,
|
|
70
69
|
contentType: contentType?.name,
|
|
71
|
-
size:
|
|
72
|
-
isSelected:
|
|
70
|
+
size: size,
|
|
71
|
+
isSelected: isSelected,
|
|
73
72
|
badge: React.createElement(EntityStatusBadge, {
|
|
74
73
|
status: status,
|
|
75
74
|
entityType: "Entry",
|
|
76
|
-
getEntityScheduledActions:
|
|
77
|
-
useLocalizedEntityStatus:
|
|
78
|
-
entity:
|
|
79
|
-
localesStatusMap:
|
|
80
|
-
activeLocales:
|
|
75
|
+
getEntityScheduledActions: getEntityScheduledActions,
|
|
76
|
+
useLocalizedEntityStatus: useLocalizedEntityStatus,
|
|
77
|
+
entity: entry,
|
|
78
|
+
localesStatusMap: localesStatusMap,
|
|
79
|
+
activeLocales: activeLocales
|
|
81
80
|
}),
|
|
82
|
-
icon:
|
|
83
|
-
spaceName:
|
|
84
|
-
environmentName:
|
|
81
|
+
icon: spaceName ? React.createElement(SpaceName, {
|
|
82
|
+
spaceName: spaceName,
|
|
83
|
+
environmentName: entry.sys.environment.sys.id
|
|
85
84
|
}) : null,
|
|
86
85
|
thumbnailElement: file && isValidImage(file) ? React.createElement(AssetThumbnail, {
|
|
87
86
|
file: file
|
|
88
87
|
}) : undefined,
|
|
89
|
-
dragHandleRender:
|
|
90
|
-
withDragHandle: !!
|
|
91
|
-
actions:
|
|
92
|
-
|
|
88
|
+
dragHandleRender: renderDragHandle,
|
|
89
|
+
withDragHandle: !!renderDragHandle,
|
|
90
|
+
actions: onEdit || onRemove ? [
|
|
91
|
+
hasCardEditActions && onEdit ? React.createElement(MenuItem, {
|
|
93
92
|
key: "edit",
|
|
94
93
|
testId: "edit",
|
|
95
94
|
onClick: ()=>{
|
|
96
|
-
|
|
95
|
+
onEdit && onEdit();
|
|
97
96
|
}
|
|
98
97
|
}, "Edit") : null,
|
|
99
|
-
|
|
98
|
+
hasCardRemoveActions && onRemove ? React.createElement(MenuItem, {
|
|
100
99
|
key: "delete",
|
|
101
100
|
testId: "delete",
|
|
102
101
|
onClick: ()=>{
|
|
103
|
-
|
|
102
|
+
onRemove && onRemove();
|
|
104
103
|
}
|
|
105
104
|
}, "Remove") : null,
|
|
106
|
-
|
|
105
|
+
hasCardMoveActions && (onMoveTop || onMoveBottom) ? React.createElement(MenuDivider, {
|
|
107
106
|
key: "divider"
|
|
108
107
|
}) : null,
|
|
109
|
-
|
|
108
|
+
hasCardMoveActions && onMoveTop ? React.createElement(MenuItem, {
|
|
110
109
|
key: "move-top",
|
|
111
|
-
onClick: ()=>
|
|
110
|
+
onClick: ()=>onMoveTop && onMoveTop(),
|
|
112
111
|
testId: "move-top"
|
|
113
112
|
}, "Move to top") : null,
|
|
114
|
-
|
|
113
|
+
hasCardMoveActions && onMoveBottom ? React.createElement(MenuItem, {
|
|
115
114
|
key: "move-bottom",
|
|
116
|
-
onClick: ()=>
|
|
115
|
+
onClick: ()=>onMoveBottom && onMoveBottom(),
|
|
117
116
|
testId: "move-bottom"
|
|
118
117
|
}, "Move to bottom") : null
|
|
119
118
|
].filter((item)=>item) : [],
|
|
120
|
-
onClick:
|
|
119
|
+
onClick: isClickable ? (e)=>{
|
|
121
120
|
e.preventDefault();
|
|
122
|
-
if (
|
|
123
|
-
|
|
121
|
+
if (onClick) return onClick(e);
|
|
122
|
+
onEdit && onEdit();
|
|
124
123
|
} : undefined
|
|
125
124
|
});
|
|
126
125
|
}
|
|
@@ -18,12 +18,11 @@ export interface WrappedAssetCardProps {
|
|
|
18
18
|
renderDragHandle?: RenderDragFn;
|
|
19
19
|
isClickable: boolean;
|
|
20
20
|
useLocalizedEntityStatus?: boolean;
|
|
21
|
-
isLocalized?: boolean;
|
|
22
21
|
localesStatusMap?: LocalePublishStatusMap;
|
|
23
22
|
activeLocales?: Pick<LocaleProps, 'code'>[];
|
|
24
23
|
}
|
|
25
24
|
export declare const WrappedAssetCard: {
|
|
26
|
-
(
|
|
25
|
+
({ asset, className, size, localeCode, defaultLocaleCode, activeLocales, localesStatusMap, isDisabled, isSelected, isClickable, useLocalizedEntityStatus, renderDragHandle, getEntityScheduledActions, onEdit, getAssetUrl, onRemove, }: WrappedAssetCardProps): React.JSX.Element;
|
|
27
26
|
defaultProps: {
|
|
28
27
|
isClickable: boolean;
|
|
29
28
|
};
|
|
@@ -28,7 +28,6 @@ export type CustomEntityCardProps = {
|
|
|
28
28
|
onMoveTop?: () => void;
|
|
29
29
|
onMoveBottom?: () => void;
|
|
30
30
|
isBeingDragged?: boolean;
|
|
31
|
-
isLocalized?: boolean;
|
|
32
31
|
useLocalizedEntityStatus?: boolean;
|
|
33
32
|
localesStatusMap?: LocalePublishStatusMap;
|
|
34
33
|
activeLocales?: Pick<LocaleProps, 'code'>[];
|
|
@@ -25,12 +25,11 @@ export interface WrappedEntryCardProps {
|
|
|
25
25
|
hasCardEditActions: boolean;
|
|
26
26
|
hasCardMoveActions?: boolean;
|
|
27
27
|
hasCardRemoveActions?: boolean;
|
|
28
|
-
isLocalized?: boolean;
|
|
29
28
|
useLocalizedEntityStatus?: boolean;
|
|
30
29
|
localesStatusMap?: LocalePublishStatusMap;
|
|
31
30
|
activeLocales?: Pick<LocaleProps, 'code'>[];
|
|
32
31
|
}
|
|
33
|
-
export declare function WrappedEntryCard(
|
|
32
|
+
export declare function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales, localeCode, defaultLocaleCode, localesStatusMap, useLocalizedEntityStatus, size, spaceName, isClickable, isDisabled, isSelected, hasCardMoveActions, hasCardEditActions, hasCardRemoveActions, renderDragHandle, getAsset, getEntityScheduledActions, onClick, onEdit, onRemove, onMoveTop, onMoveBottom, }: WrappedEntryCardProps): React.JSX.Element;
|
|
34
33
|
export declare namespace WrappedEntryCard {
|
|
35
34
|
var defaultProps: {
|
|
36
35
|
isClickable: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.3",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"registry": "https://npm.pkg.github.com/"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "bf46c70f90d83e11e01091e8f0f50dfa27258bdf"
|
|
68
68
|
}
|