@contentful/field-editor-reference 6.1.0 → 6.2.0
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 +2 -1
- package/dist/cjs/assets/WrappedAssetCard/WrappedAssetCard.js +2 -1
- package/dist/cjs/assets/WrappedAssetCard/WrappedAssetLink.js +2 -1
- package/dist/cjs/components/EntityStatusBadge/EntityStatusBadge.js +46 -6
- package/dist/cjs/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +2 -1
- package/dist/cjs/entries/WrappedEntryCard/WrappedEntryCard.js +2 -1
- package/dist/esm/assets/WrappedAssetCard/FetchingWrappedAssetCard.js +2 -1
- package/dist/esm/assets/WrappedAssetCard/WrappedAssetCard.js +2 -1
- package/dist/esm/assets/WrappedAssetCard/WrappedAssetLink.js +2 -1
- package/dist/esm/components/EntityStatusBadge/EntityStatusBadge.js +8 -4
- package/dist/esm/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +2 -1
- package/dist/esm/entries/WrappedEntryCard/WrappedEntryCard.js +2 -1
- package/dist/types/assets/WrappedAssetCard/WrappedAssetCard.d.ts +1 -0
- package/dist/types/assets/WrappedAssetCard/WrappedAssetLink.d.ts +1 -0
- package/dist/types/common/customCardTypes.d.ts +1 -0
- package/dist/types/components/EntityStatusBadge/EntityStatusBadge.d.ts +2 -1
- package/dist/types/entries/WrappedEntryCard/WrappedEntryCard.d.ts +1 -0
- package/package.json +3 -3
|
@@ -128,7 +128,8 @@ function FetchingWrappedAssetCard(props) {
|
|
|
128
128
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
129
129
|
localesStatusMap,
|
|
130
130
|
activeLocales: props.sdk.parameters.instance.activeLocales,
|
|
131
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
131
|
+
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized),
|
|
132
|
+
shouldRetainLocaleHistory: props.sdk.parameters.instance.shouldRetainLocaleHistory
|
|
132
133
|
};
|
|
133
134
|
if (props.viewType === 'link') {
|
|
134
135
|
if (status === 'loading') {
|
|
@@ -118,7 +118,8 @@ const WrappedAssetCard = (props)=>{
|
|
|
118
118
|
useLocalizedEntityStatus: props.useLocalizedEntityStatus,
|
|
119
119
|
entity: props.asset,
|
|
120
120
|
localesStatusMap: props.localesStatusMap,
|
|
121
|
-
activeLocales: props.activeLocales
|
|
121
|
+
activeLocales: props.activeLocales,
|
|
122
|
+
shouldRetainLocaleHistory: props.shouldRetainLocaleHistory
|
|
122
123
|
}),
|
|
123
124
|
src: entityFile && entityFile.url ? size === 'small' ? `${entityFile.url}?w=150&h=150&fit=thumb` : `${entityFile.url}?h=300` : '',
|
|
124
125
|
onClick: isClickable ? (e)=>{
|
|
@@ -84,7 +84,8 @@ const WrappedAssetLink = (props)=>{
|
|
|
84
84
|
useLocalizedEntityStatus: props.useLocalizedEntityStatus,
|
|
85
85
|
entity: props.asset,
|
|
86
86
|
localesStatusMap: props.localesStatusMap,
|
|
87
|
-
activeLocales: props.activeLocales
|
|
87
|
+
activeLocales: props.activeLocales,
|
|
88
|
+
shouldRetainLocaleHistory: props.shouldRetainLocaleHistory
|
|
88
89
|
}),
|
|
89
90
|
thumbnailElement: entityFile && (0, _fieldeditorshared.isValidImage)(entityFile) ? _react.createElement(_components.AssetThumbnail, {
|
|
90
91
|
file: entityFile
|
|
@@ -8,23 +8,63 @@ Object.defineProperty(exports, "EntityStatusBadge", {
|
|
|
8
8
|
return EntityStatusBadge;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
14
14
|
const _ScheduledIconWithTooltip = require("../ScheduledIconWithTooltip/ScheduledIconWithTooltip");
|
|
15
15
|
const _ScheduleTooltip = require("../ScheduledIconWithTooltip/ScheduleTooltip");
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
+
if (typeof WeakMap !== "function") return null;
|
|
18
|
+
var cacheBabelInterop = new WeakMap();
|
|
19
|
+
var cacheNodeInterop = new WeakMap();
|
|
20
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
+
})(nodeInterop);
|
|
23
|
+
}
|
|
24
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
+
return {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
+
if (cache && cache.has(obj)) {
|
|
35
|
+
return cache.get(obj);
|
|
36
|
+
}
|
|
37
|
+
var newObj = {
|
|
38
|
+
__proto__: null
|
|
19
39
|
};
|
|
40
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
+
for(var key in obj){
|
|
42
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
+
if (desc && (desc.get || desc.set)) {
|
|
45
|
+
Object.defineProperty(newObj, key, desc);
|
|
46
|
+
} else {
|
|
47
|
+
newObj[key] = obj[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
newObj.default = obj;
|
|
52
|
+
if (cache) {
|
|
53
|
+
cache.set(obj, newObj);
|
|
54
|
+
}
|
|
55
|
+
return newObj;
|
|
20
56
|
}
|
|
21
|
-
function EntityStatusBadge({ entityType, getEntityScheduledActions, status, useLocalizedEntityStatus, localesStatusMap, activeLocales, entity, ...props }) {
|
|
57
|
+
function EntityStatusBadge({ entityType, getEntityScheduledActions, status, useLocalizedEntityStatus, localesStatusMap, activeLocales, entity, shouldRetainLocaleHistory, ...props }) {
|
|
22
58
|
const { isError, isLoading, jobs } = (0, _ScheduledIconWithTooltip.useScheduledActions)({
|
|
23
59
|
entityId: entity.sys.id,
|
|
24
60
|
entityType,
|
|
25
61
|
getEntityScheduledActions
|
|
26
62
|
});
|
|
27
|
-
|
|
63
|
+
const hasMultipleStatuses = (0, _react.useMemo)(()=>shouldRetainLocaleHistory && _fieldeditorshared.entityHelpers.hasDifferentLocaleStatuses(localesStatusMap), [
|
|
64
|
+
localesStatusMap,
|
|
65
|
+
shouldRetainLocaleHistory
|
|
66
|
+
]);
|
|
67
|
+
if (useLocalizedEntityStatus || hasMultipleStatuses) {
|
|
28
68
|
return _react.default.createElement(_fieldeditorshared.LocalePublishingPopover, {
|
|
29
69
|
entity: entity,
|
|
30
70
|
jobs: jobs,
|
|
@@ -165,7 +165,8 @@ function FetchingWrappedEntryCard(props) {
|
|
|
165
165
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
166
166
|
localesStatusMap,
|
|
167
167
|
activeLocales: props.sdk.parameters.instance.activeLocales,
|
|
168
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
168
|
+
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized),
|
|
169
|
+
shouldRetainLocaleHistory: props.sdk.parameters.instance.shouldRetainLocaleHistory
|
|
169
170
|
};
|
|
170
171
|
const { hasCardEditActions, hasCardMoveActions, hasCardRemoveActions } = props;
|
|
171
172
|
function renderDefaultCard(props) {
|
|
@@ -128,7 +128,8 @@ function WrappedEntryCard(props) {
|
|
|
128
128
|
useLocalizedEntityStatus: props.useLocalizedEntityStatus,
|
|
129
129
|
entity: props.entry,
|
|
130
130
|
localesStatusMap: props.localesStatusMap,
|
|
131
|
-
activeLocales: props.activeLocales
|
|
131
|
+
activeLocales: props.activeLocales,
|
|
132
|
+
shouldRetainLocaleHistory: props.shouldRetainLocaleHistory
|
|
132
133
|
}),
|
|
133
134
|
icon: props.spaceName ? _react.createElement(_SpaceName.SpaceName, {
|
|
134
135
|
spaceName: props.spaceName,
|
|
@@ -77,7 +77,8 @@ export function FetchingWrappedAssetCard(props) {
|
|
|
77
77
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
78
78
|
localesStatusMap,
|
|
79
79
|
activeLocales: props.sdk.parameters.instance.activeLocales,
|
|
80
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
80
|
+
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized),
|
|
81
|
+
shouldRetainLocaleHistory: props.sdk.parameters.instance.shouldRetainLocaleHistory
|
|
81
82
|
};
|
|
82
83
|
if (props.viewType === 'link') {
|
|
83
84
|
if (status === 'loading') {
|
|
@@ -62,7 +62,8 @@ export const WrappedAssetCard = (props)=>{
|
|
|
62
62
|
useLocalizedEntityStatus: props.useLocalizedEntityStatus,
|
|
63
63
|
entity: props.asset,
|
|
64
64
|
localesStatusMap: props.localesStatusMap,
|
|
65
|
-
activeLocales: props.activeLocales
|
|
65
|
+
activeLocales: props.activeLocales,
|
|
66
|
+
shouldRetainLocaleHistory: props.shouldRetainLocaleHistory
|
|
66
67
|
}),
|
|
67
68
|
src: entityFile && entityFile.url ? size === 'small' ? `${entityFile.url}?w=150&h=150&fit=thumb` : `${entityFile.url}?h=300` : '',
|
|
68
69
|
onClick: isClickable ? (e)=>{
|
|
@@ -33,7 +33,8 @@ export const WrappedAssetLink = (props)=>{
|
|
|
33
33
|
useLocalizedEntityStatus: props.useLocalizedEntityStatus,
|
|
34
34
|
entity: props.asset,
|
|
35
35
|
localesStatusMap: props.localesStatusMap,
|
|
36
|
-
activeLocales: props.activeLocales
|
|
36
|
+
activeLocales: props.activeLocales,
|
|
37
|
+
shouldRetainLocaleHistory: props.shouldRetainLocaleHistory
|
|
37
38
|
}),
|
|
38
39
|
thumbnailElement: entityFile && isValidImage(entityFile) ? React.createElement(AssetThumbnail, {
|
|
39
40
|
file: entityFile
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { EntityStatusBadge as StatusBadge } from '@contentful/f36-components';
|
|
3
|
-
import { LocalePublishingPopover } from '@contentful/field-editor-shared';
|
|
3
|
+
import { LocalePublishingPopover, entityHelpers } from '@contentful/field-editor-shared';
|
|
4
4
|
import { useScheduledActions } from '../ScheduledIconWithTooltip/ScheduledIconWithTooltip';
|
|
5
5
|
import { ScheduleTooltip } from '../ScheduledIconWithTooltip/ScheduleTooltip';
|
|
6
|
-
export function EntityStatusBadge({ entityType, getEntityScheduledActions, status, useLocalizedEntityStatus, localesStatusMap, activeLocales, entity, ...props }) {
|
|
6
|
+
export function EntityStatusBadge({ entityType, getEntityScheduledActions, status, useLocalizedEntityStatus, localesStatusMap, activeLocales, entity, shouldRetainLocaleHistory, ...props }) {
|
|
7
7
|
const { isError, isLoading, jobs } = useScheduledActions({
|
|
8
8
|
entityId: entity.sys.id,
|
|
9
9
|
entityType,
|
|
10
10
|
getEntityScheduledActions
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
const hasMultipleStatuses = useMemo(()=>shouldRetainLocaleHistory && entityHelpers.hasDifferentLocaleStatuses(localesStatusMap), [
|
|
13
|
+
localesStatusMap,
|
|
14
|
+
shouldRetainLocaleHistory
|
|
15
|
+
]);
|
|
16
|
+
if (useLocalizedEntityStatus || hasMultipleStatuses) {
|
|
13
17
|
return React.createElement(LocalePublishingPopover, {
|
|
14
18
|
entity: entity,
|
|
15
19
|
jobs: jobs,
|
|
@@ -109,7 +109,8 @@ export function FetchingWrappedEntryCard(props) {
|
|
|
109
109
|
useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
|
|
110
110
|
localesStatusMap,
|
|
111
111
|
activeLocales: props.sdk.parameters.instance.activeLocales,
|
|
112
|
-
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized)
|
|
112
|
+
isLocalized: !!('localized' in props.sdk.field && props.sdk.field.localized),
|
|
113
|
+
shouldRetainLocaleHistory: props.sdk.parameters.instance.shouldRetainLocaleHistory
|
|
113
114
|
};
|
|
114
115
|
const { hasCardEditActions, hasCardMoveActions, hasCardRemoveActions } = props;
|
|
115
116
|
function renderDefaultCard(props) {
|
|
@@ -77,7 +77,8 @@ export function WrappedEntryCard(props) {
|
|
|
77
77
|
useLocalizedEntityStatus: props.useLocalizedEntityStatus,
|
|
78
78
|
entity: props.entry,
|
|
79
79
|
localesStatusMap: props.localesStatusMap,
|
|
80
|
-
activeLocales: props.activeLocales
|
|
80
|
+
activeLocales: props.activeLocales,
|
|
81
|
+
shouldRetainLocaleHistory: props.shouldRetainLocaleHistory
|
|
81
82
|
}),
|
|
82
83
|
icon: props.spaceName ? React.createElement(SpaceName, {
|
|
83
84
|
spaceName: props.spaceName,
|
|
@@ -21,6 +21,7 @@ export interface WrappedAssetCardProps {
|
|
|
21
21
|
isLocalized?: boolean;
|
|
22
22
|
localesStatusMap?: LocalePublishStatusMap;
|
|
23
23
|
activeLocales?: Pick<LocaleProps, 'code'>[];
|
|
24
|
+
shouldRetainLocaleHistory?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export declare const WrappedAssetCard: {
|
|
26
27
|
(props: WrappedAssetCardProps): React.JSX.Element;
|
|
@@ -16,5 +16,6 @@ export interface WrappedAssetLinkProps {
|
|
|
16
16
|
useLocalizedEntityStatus?: boolean;
|
|
17
17
|
localesStatusMap?: LocalePublishStatusMap;
|
|
18
18
|
activeLocales?: Pick<LocaleProps, 'code'>[];
|
|
19
|
+
shouldRetainLocaleHistory?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export declare const WrappedAssetLink: (props: WrappedAssetLinkProps) => React.JSX.Element;
|
|
@@ -9,6 +9,7 @@ type EntityStatusBadgeProps = Omit<UseScheduledActionsProps, 'entityId'> & {
|
|
|
9
9
|
useLocalizedEntityStatus?: boolean;
|
|
10
10
|
localesStatusMap?: LocalePublishStatusMap;
|
|
11
11
|
activeLocales?: Pick<LocaleProps, 'code'>[];
|
|
12
|
+
shouldRetainLocaleHistory?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare function EntityStatusBadge({ entityType, getEntityScheduledActions, status, useLocalizedEntityStatus, localesStatusMap, activeLocales, entity, ...props }: EntityStatusBadgeProps): React.JSX.Element;
|
|
14
|
+
export declare function EntityStatusBadge({ entityType, getEntityScheduledActions, status, useLocalizedEntityStatus, localesStatusMap, activeLocales, entity, shouldRetainLocaleHistory, ...props }: EntityStatusBadgeProps): React.JSX.Element;
|
|
14
15
|
export {};
|
|
@@ -29,6 +29,7 @@ export interface WrappedEntryCardProps {
|
|
|
29
29
|
useLocalizedEntityStatus?: boolean;
|
|
30
30
|
localesStatusMap?: LocalePublishStatusMap;
|
|
31
31
|
activeLocales?: Pick<LocaleProps, 'code'>[];
|
|
32
|
+
shouldRetainLocaleHistory?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export declare function WrappedEntryCard(props: WrappedEntryCardProps): React.JSX.Element;
|
|
34
35
|
export declare namespace WrappedEntryCard {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@contentful/f36-components": "^4.70.0",
|
|
39
39
|
"@contentful/f36-icons": "^4.29.0",
|
|
40
40
|
"@contentful/f36-tokens": "^4.0.5",
|
|
41
|
-
"@contentful/field-editor-shared": "^2.
|
|
41
|
+
"@contentful/field-editor-shared": "^2.2.0",
|
|
42
42
|
"@contentful/mimetype": "^2.2.29",
|
|
43
43
|
"@dnd-kit/core": "^6.0.8",
|
|
44
44
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"registry": "https://npm.pkg.github.com/"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "69ca4f654ac6d3a4435dd5ce33e771f8537e9d3d"
|
|
68
68
|
}
|