@contentful/field-editor-reference 6.18.0 → 6.19.1-canary.18
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/__fixtures__/FakeSdk.js +13 -20
- package/dist/cjs/assets/WrappedAssetCard/AssetCardActions.js +11 -1
- package/dist/cjs/assets/WrappedAssetCard/FetchingWrappedAssetCard.js +10 -1
- package/dist/cjs/assets/WrappedAssetCard/WrappedAssetCard.js +4 -2
- package/dist/cjs/common/EntityStore.js +59 -33
- package/dist/cjs/common/MultipleReferenceEditor.js +6 -1
- package/dist/cjs/common/SingleReferenceEditor.js +8 -2
- package/dist/cjs/common/queryClient.js +4 -91
- package/dist/cjs/common/useContentTypePermissions.js +6 -9
- package/dist/cjs/common/useEditorPermissions.js +5 -1
- package/dist/cjs/components/LinkActions/LinkEntityActions.js +2 -0
- package/dist/cjs/entries/MultipleEntryReferenceEditor.js +2 -1
- package/dist/cjs/entries/SingleEntryReferenceEditor.js +1 -0
- package/dist/cjs/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +10 -1
- package/dist/cjs/entries/WrappedEntryCard/WrappedEntryCard.js +13 -2
- package/dist/cjs/resources/Cards/ResourceCard.js +2 -1
- package/dist/cjs/resources/Cards/ResourceCard.spec.js +28 -2
- package/dist/cjs/resources/MultipleResourceReferenceEditor.js +1 -0
- package/dist/cjs/resources/MultipleResourceReferenceEditor.spec.js +2 -1
- package/dist/cjs/resources/SingleResourceReferenceEditor.js +1 -0
- package/dist/cjs/resources/SingleResourceReferenceEditor.spec.js +2 -1
- package/dist/cjs/resources/useResourceLinkActions.js +10 -5
- package/dist/esm/__fixtures__/FakeSdk.js +13 -20
- package/dist/esm/assets/WrappedAssetCard/AssetCardActions.js +11 -1
- package/dist/esm/assets/WrappedAssetCard/FetchingWrappedAssetCard.js +10 -1
- package/dist/esm/assets/WrappedAssetCard/WrappedAssetCard.js +4 -2
- package/dist/esm/common/EntityStore.js +59 -33
- package/dist/esm/common/MultipleReferenceEditor.js +6 -1
- package/dist/esm/common/SingleReferenceEditor.js +8 -2
- package/dist/esm/common/queryClient.js +1 -47
- package/dist/esm/common/useContentTypePermissions.js +6 -9
- package/dist/esm/common/useEditorPermissions.js +5 -1
- package/dist/esm/components/LinkActions/LinkEntityActions.js +2 -0
- package/dist/esm/entries/MultipleEntryReferenceEditor.js +2 -1
- package/dist/esm/entries/SingleEntryReferenceEditor.js +1 -0
- package/dist/esm/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +10 -1
- package/dist/esm/entries/WrappedEntryCard/WrappedEntryCard.js +13 -2
- package/dist/esm/resources/Cards/ResourceCard.js +2 -1
- package/dist/esm/resources/Cards/ResourceCard.spec.js +28 -2
- package/dist/esm/resources/MultipleResourceReferenceEditor.js +1 -0
- package/dist/esm/resources/MultipleResourceReferenceEditor.spec.js +2 -1
- package/dist/esm/resources/SingleResourceReferenceEditor.js +1 -0
- package/dist/esm/resources/SingleResourceReferenceEditor.spec.js +2 -1
- package/dist/esm/resources/useResourceLinkActions.js +10 -5
- package/dist/types/assets/WrappedAssetCard/AssetCardActions.d.ts +1 -0
- package/dist/types/assets/WrappedAssetCard/FetchingWrappedAssetCard.d.ts +5 -1
- package/dist/types/assets/WrappedAssetCard/WrappedAssetCard.d.ts +2 -1
- package/dist/types/common/EntityStore.d.ts +6 -4
- package/dist/types/common/ReferenceEditor.d.ts +5 -1
- package/dist/types/common/customCardTypes.d.ts +1 -0
- package/dist/types/common/queryClient.d.ts +3 -7
- package/dist/types/entries/WrappedEntryCard/FetchingWrappedEntryCard.d.ts +5 -1
- package/dist/types/entries/WrappedEntryCard/WrappedEntryCard.d.ts +2 -1
- package/dist/types/resources/Cards/ResourceCard.d.ts +1 -0
- package/package.json +5 -5
|
@@ -17,6 +17,7 @@ export function SingleEntryReferenceEditor(props) {
|
|
|
17
17
|
hasCardEditActions: hasCardEditActions,
|
|
18
18
|
hasCardRemoveActions: hasCardRemoveActions,
|
|
19
19
|
activeLocales: activeLocales,
|
|
20
|
+
addReferenceToRelease: props.addReferenceToRelease,
|
|
20
21
|
onRemove: ()=>{
|
|
21
22
|
setValue(null);
|
|
22
23
|
}
|
|
@@ -63,6 +63,14 @@ export function FetchingWrappedEntryCard(props) {
|
|
|
63
63
|
contentTypeId: entry?.sys?.contentType?.sys?.id ?? ''
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
|
+
const onAddToRelease = ()=>{
|
|
67
|
+
if (entry && props.addReferenceToRelease) {
|
|
68
|
+
void props.addReferenceToRelease(entry, props.sdk.field.locale, {
|
|
69
|
+
openModalForVersionSelection: true,
|
|
70
|
+
skipNestedReferencesPrompt: true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
66
74
|
React.useEffect(()=>{
|
|
67
75
|
if (entry) {
|
|
68
76
|
props.onAction?.({
|
|
@@ -117,7 +125,8 @@ export function FetchingWrappedEntryCard(props) {
|
|
|
117
125
|
activeLocales: props.activeLocales,
|
|
118
126
|
releaseStatusMap,
|
|
119
127
|
release: props.sdk.release,
|
|
120
|
-
releaseEntityStatus
|
|
128
|
+
releaseEntityStatus,
|
|
129
|
+
onAddToRelease
|
|
121
130
|
};
|
|
122
131
|
const { hasCardEditActions, hasCardMoveActions, hasCardRemoveActions } = props;
|
|
123
132
|
function renderDefaultCard(props) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EntryCard, MenuDivider, MenuItem } from '@contentful/f36-components';
|
|
3
|
+
import { PlusIcon } from '@contentful/f36-icons';
|
|
3
4
|
import { entityHelpers, isValidImage } from '@contentful/field-editor-shared';
|
|
4
5
|
import { AssetThumbnail, MissingEntityCard, EntityStatusBadge } from '../../components';
|
|
5
6
|
import { SpaceName } from '../../components/SpaceName/SpaceName';
|
|
@@ -10,7 +11,7 @@ const defaultProps = {
|
|
|
10
11
|
hasCardMoveActions: true,
|
|
11
12
|
hasCardRemoveActions: true
|
|
12
13
|
};
|
|
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, releaseEntityStatus, releaseStatusMap, release }) {
|
|
14
|
+
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, releaseEntityStatus, releaseStatusMap, release, onAddToRelease }) {
|
|
14
15
|
const [file, setFile] = React.useState(null);
|
|
15
16
|
React.useEffect(()=>{
|
|
16
17
|
let mounted = true;
|
|
@@ -61,6 +62,7 @@ export function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales,
|
|
|
61
62
|
localeCode,
|
|
62
63
|
defaultLocaleCode
|
|
63
64
|
});
|
|
65
|
+
const showAddToReleaseAction = releaseEntityStatus === 'notInRelease' && release !== undefined && onAddToRelease !== undefined && !isDisabled;
|
|
64
66
|
return /*#__PURE__*/ React.createElement(EntryCard, {
|
|
65
67
|
as: isClickable && entryUrl ? 'a' : 'article',
|
|
66
68
|
href: isClickable ? entryUrl : undefined,
|
|
@@ -91,7 +93,7 @@ export function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales,
|
|
|
91
93
|
dragHandleRender: renderDragHandle,
|
|
92
94
|
withDragHandle: !!renderDragHandle && !isDisabled,
|
|
93
95
|
draggable: !!renderDragHandle && !isDisabled,
|
|
94
|
-
actions: onEdit || onRemove ? [
|
|
96
|
+
actions: onEdit || onRemove || showAddToReleaseAction ? [
|
|
95
97
|
hasCardEditActions && onEdit ? /*#__PURE__*/ React.createElement(MenuItem, {
|
|
96
98
|
key: "edit",
|
|
97
99
|
testId: "edit",
|
|
@@ -106,6 +108,15 @@ export function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales,
|
|
|
106
108
|
onRemove && onRemove();
|
|
107
109
|
}
|
|
108
110
|
}, "Remove") : null,
|
|
111
|
+
showAddToReleaseAction ? /*#__PURE__*/ React.createElement(MenuItem, {
|
|
112
|
+
key: "add-to-release",
|
|
113
|
+
testId: "add-to-release",
|
|
114
|
+
onClick: ()=>{
|
|
115
|
+
onAddToRelease();
|
|
116
|
+
}
|
|
117
|
+
}, /*#__PURE__*/ React.createElement(PlusIcon, {
|
|
118
|
+
size: "tiny"
|
|
119
|
+
}), "Add to release") : null,
|
|
109
120
|
hasCardMoveActions && (onMoveTop || onMoveBottom) && !isDisabled ? /*#__PURE__*/ React.createElement(MenuDivider, {
|
|
110
121
|
key: "divider"
|
|
111
122
|
}) : null,
|
|
@@ -12,9 +12,10 @@ function ResourceCardSkeleton() {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
function ExistingResourceCard(props) {
|
|
15
|
-
const { resourceLink, inView, index = 0, locale } = props;
|
|
15
|
+
const { resourceLink, inView, index = 0, locale, referencingEntryId } = props;
|
|
16
16
|
const resourceOptions = {
|
|
17
17
|
locale,
|
|
18
|
+
referencingEntryId,
|
|
18
19
|
priority: index * -1,
|
|
19
20
|
enabled: inView,
|
|
20
21
|
allowExternal: true
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
|
+
import { SharedQueryClientProvider } from '@contentful/field-editor-shared';
|
|
4
|
+
import { createTestQueryClient } from '@contentful/field-editor-test-utils';
|
|
3
5
|
import { configure, fireEvent, render, waitFor } from '@testing-library/react';
|
|
4
6
|
import publishedCT from '../../__fixtures__/content-type/published_content_type.json';
|
|
5
7
|
import publishedEntryNonMasterEnvironment from '../../__fixtures__/entry/published_entry_non_master.json';
|
|
@@ -167,9 +169,33 @@ describe('ResourceCard', ()=>{
|
|
|
167
169
|
fireEvent.mouseEnter(getByText(space.name));
|
|
168
170
|
await waitFor(()=>expect(getByText(tooltipContent)).toBeDefined());
|
|
169
171
|
});
|
|
170
|
-
it('renders skeleton
|
|
171
|
-
const
|
|
172
|
+
it('renders skeleton while data is loading', async ()=>{
|
|
173
|
+
const queryClient = createTestQueryClient();
|
|
174
|
+
let resolveEntry;
|
|
175
|
+
const pendingPromise = new Promise((resolve)=>{
|
|
176
|
+
resolveEntry = resolve;
|
|
177
|
+
});
|
|
178
|
+
sdk.cma.entry.get.mockReturnValueOnce(pendingPromise);
|
|
179
|
+
const { getByTestId, queryByTestId } = render(/*#__PURE__*/ React.createElement(SharedQueryClientProvider, {
|
|
180
|
+
client: queryClient
|
|
181
|
+
}, /*#__PURE__*/ React.createElement(EntityProvider, {
|
|
182
|
+
sdk: sdk
|
|
183
|
+
}, /*#__PURE__*/ React.createElement(ResourceCard, {
|
|
184
|
+
isDisabled: false,
|
|
185
|
+
getEntryRouteHref: ()=>'',
|
|
186
|
+
resourceLink: {
|
|
187
|
+
sys: {
|
|
188
|
+
type: 'ResourceLink',
|
|
189
|
+
linkType: 'Contentful:Entry',
|
|
190
|
+
urn: resolvableEntryUrn
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}))));
|
|
172
194
|
expect(getByTestId('cf-ui-skeleton-form')).toBeDefined();
|
|
195
|
+
expect(queryByTestId('cf-ui-entry-card')).toBeNull();
|
|
196
|
+
resolveEntry(publishedEntry);
|
|
197
|
+
await waitFor(()=>expect(getByTestId('cf-ui-entry-card')).toBeDefined());
|
|
198
|
+
expect(queryByTestId('cf-ui-skeleton-form')).toBeNull();
|
|
173
199
|
});
|
|
174
200
|
it('renders unsupported entity card when resource type is unknown', async ()=>{
|
|
175
201
|
const { getByText } = renderResourceCard({
|
|
@@ -73,7 +73,8 @@ describe('Multiple resource editor', ()=>{
|
|
|
73
73
|
const options = dialogFn.mock.calls[0][0];
|
|
74
74
|
expect(options).toEqual({
|
|
75
75
|
allowedResources: fieldDefinition.allowedResources,
|
|
76
|
-
locale: 'en'
|
|
76
|
+
locale: 'en',
|
|
77
|
+
referencingEntryId: 'testEntry'
|
|
77
78
|
});
|
|
78
79
|
});
|
|
79
80
|
it('hides the action button when insufficient permissions', async ()=>{
|
|
@@ -20,6 +20,7 @@ export function SingleResourceReferenceEditor(props) {
|
|
|
20
20
|
onRemove: ()=>props.sdk.field.removeValue(),
|
|
21
21
|
resourceLink: value,
|
|
22
22
|
locale: props.sdk.field.locale,
|
|
23
|
+
referencingEntryId: props.sdk.ids.entry,
|
|
23
24
|
isDisabled: disabled,
|
|
24
25
|
getEntryRouteHref: props.getEntryRouteHref
|
|
25
26
|
}) : /*#__PURE__*/ React.createElement(CombinedLinkEntityActions, {
|
|
@@ -69,7 +69,8 @@ describe('Single resource editor', ()=>{
|
|
|
69
69
|
const options = dialogFn.mock.calls[0][0];
|
|
70
70
|
expect(options).toEqual({
|
|
71
71
|
allowedResources: fieldDefinition.allowedResources,
|
|
72
|
-
locale: 'en'
|
|
72
|
+
locale: 'en',
|
|
73
|
+
referencingEntryId: 'testEntry'
|
|
73
74
|
});
|
|
74
75
|
});
|
|
75
76
|
it('renders no the action button when permissions insufficient', async ()=>{
|
|
@@ -25,14 +25,18 @@ export function useResourceLinkActions({ parameters, sdk }) {
|
|
|
25
25
|
field
|
|
26
26
|
]);
|
|
27
27
|
const multiple = field.type === 'Array';
|
|
28
|
+
const referencingEntryId = sdk.ids.entry;
|
|
29
|
+
const allowedResources = field.allowedResources;
|
|
28
30
|
const onLinkExisting = useMemo(()=>{
|
|
29
31
|
const promptSelection = multiple ? async ()=>await dialogs.selectMultipleResourceEntities({
|
|
30
|
-
allowedResources
|
|
31
|
-
locale: field.locale
|
|
32
|
+
allowedResources,
|
|
33
|
+
locale: field.locale,
|
|
34
|
+
referencingEntryId
|
|
32
35
|
}) : async ()=>[
|
|
33
36
|
await dialogs.selectSingleResourceEntity({
|
|
34
|
-
allowedResources
|
|
35
|
-
locale: field.locale
|
|
37
|
+
allowedResources,
|
|
38
|
+
locale: field.locale,
|
|
39
|
+
referencingEntryId
|
|
36
40
|
})
|
|
37
41
|
];
|
|
38
42
|
return async ()=>{
|
|
@@ -40,8 +44,9 @@ export function useResourceLinkActions({ parameters, sdk }) {
|
|
|
40
44
|
};
|
|
41
45
|
}, [
|
|
42
46
|
dialogs,
|
|
43
|
-
|
|
47
|
+
allowedResources,
|
|
44
48
|
field.locale,
|
|
49
|
+
referencingEntryId,
|
|
45
50
|
multiple,
|
|
46
51
|
onLinkedExisting
|
|
47
52
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { CustomCardRenderer, RenderCustomMissingEntityCard } from '../../common/customCardTypes';
|
|
3
|
-
import { Action, FieldAppSDK, ViewType, RenderDragFn } from '../../types';
|
|
3
|
+
import { Action, Asset, FieldAppSDK, ViewType, RenderDragFn } from '../../types';
|
|
4
4
|
type FetchingWrappedAssetCardProps = {
|
|
5
5
|
assetId: string;
|
|
6
6
|
isDisabled: boolean;
|
|
@@ -12,6 +12,10 @@ type FetchingWrappedAssetCardProps = {
|
|
|
12
12
|
renderDragHandle?: RenderDragFn;
|
|
13
13
|
renderCustomCard?: CustomCardRenderer;
|
|
14
14
|
renderCustomMissingEntityCard?: RenderCustomMissingEntityCard;
|
|
15
|
+
addReferenceToRelease?: (reference: Asset, localeCode?: string, options?: {
|
|
16
|
+
openModalForVersionSelection?: boolean;
|
|
17
|
+
skipNestedReferencesPrompt?: boolean;
|
|
18
|
+
}) => Promise<void>;
|
|
15
19
|
};
|
|
16
20
|
export declare function FetchingWrappedAssetCard(props: FetchingWrappedAssetCardProps): React.JSX.Element;
|
|
17
21
|
export {};
|
|
@@ -23,9 +23,10 @@ export interface WrappedAssetCardProps {
|
|
|
23
23
|
releaseEntityStatus?: ReleaseEntityStatus;
|
|
24
24
|
releaseStatusMap?: ReleaseStatusMap;
|
|
25
25
|
release?: ReleaseV2Props;
|
|
26
|
+
onAddToRelease?: () => void;
|
|
26
27
|
}
|
|
27
28
|
export declare const WrappedAssetCard: {
|
|
28
|
-
({ asset, className, size, localeCode, defaultLocaleCode, activeLocales, localesStatusMap, isDisabled, isSelected, isClickable, useLocalizedEntityStatus, renderDragHandle, getEntityScheduledActions, onEdit, getAssetUrl, onRemove, releaseEntityStatus, releaseStatusMap, release, }: WrappedAssetCardProps): React.JSX.Element;
|
|
29
|
+
({ asset, className, size, localeCode, defaultLocaleCode, activeLocales, localesStatusMap, isDisabled, isSelected, isClickable, useLocalizedEntityStatus, renderDragHandle, getEntityScheduledActions, onEdit, getAssetUrl, onRemove, releaseEntityStatus, releaseStatusMap, release, onAddToRelease, }: WrappedAssetCardProps): React.JSX.Element;
|
|
29
30
|
defaultProps: {
|
|
30
31
|
isClickable: boolean;
|
|
31
32
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseAppSDK } from '@contentful/app-sdk';
|
|
3
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
4
|
import { ResourceProvider } from 'contentful-management';
|
|
4
5
|
import { Asset, ContentType, Entry, ExternalResource, Resource, ResourceType, ScheduledAction, Space } from '../types';
|
|
5
6
|
export type ContentfulResourceInfo = {
|
|
@@ -17,6 +18,7 @@ export declare function isContentfulResourceInfo(info: ResourceInfo): info is Co
|
|
|
17
18
|
type EntityStoreProps = {
|
|
18
19
|
sdk: BaseAppSDK;
|
|
19
20
|
queryConcurrency?: number;
|
|
21
|
+
queryClient?: QueryClient;
|
|
20
22
|
};
|
|
21
23
|
type GetOptions = {
|
|
22
24
|
priority?: number;
|
|
@@ -33,11 +35,11 @@ type QueryEntityResult<E> = Promise<E>;
|
|
|
33
35
|
type GetResourceOptions = GetOptions & {
|
|
34
36
|
allowExternal?: boolean;
|
|
35
37
|
locale?: string;
|
|
38
|
+
referencingEntryId?: string;
|
|
36
39
|
};
|
|
37
40
|
type QueryResourceResult<R extends Resource = Resource> = QueryEntityResult<ResourceInfo<R>>;
|
|
38
41
|
type UseResourceOptions = GetResourceOptions & {
|
|
39
42
|
enabled?: boolean;
|
|
40
|
-
locale?: string;
|
|
41
43
|
};
|
|
42
44
|
type UseEntityResult<E> = {
|
|
43
45
|
status: 'idle';
|
|
@@ -87,13 +89,13 @@ declare const useEntityLoader: () => {
|
|
|
87
89
|
getResourceProvider: (organizationId: string, appDefinitionId: string) => QueryEntityResult<ResourceProvider>;
|
|
88
90
|
};
|
|
89
91
|
export declare function useEntity<E extends FetchableEntity>(entityType: FetchableEntityType, entityId: string, options?: Omit<UseEntityOptions, 'releaseId'>): UseEntityResult<E>;
|
|
90
|
-
export declare function useResource<R extends Resource = Resource>(resourceType: string, urn: string, { locale, ...options }?: UseResourceOptions): {
|
|
91
|
-
status: "
|
|
92
|
+
export declare function useResource<R extends Resource = Resource>(resourceType: string, urn: string, { locale, referencingEntryId, ...options }?: UseResourceOptions): {
|
|
93
|
+
status: "loading" | "error" | "success";
|
|
92
94
|
data: ResourceInfo<R> | undefined;
|
|
93
95
|
error: unknown;
|
|
94
96
|
};
|
|
95
97
|
export declare function useResourceProvider(organizationId: string, appDefinitionId: string): {
|
|
96
|
-
status: "
|
|
98
|
+
status: "loading" | "error" | "success";
|
|
97
99
|
data: ResourceProvider | undefined;
|
|
98
100
|
error: unknown;
|
|
99
101
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FieldConnector } from '@contentful/field-editor-shared';
|
|
3
3
|
import type { LinkActionsProps } from '../components';
|
|
4
|
-
import { Action, ActionLabels, FieldAppSDK, ViewType } from '../types';
|
|
4
|
+
import { Action, ActionLabels, FieldAppSDK, ViewType, Entry, Asset } from '../types';
|
|
5
5
|
import { CustomCardRenderer, RenderCustomMissingEntityCard } from './customCardTypes';
|
|
6
6
|
export interface ReferenceEditorProps {
|
|
7
7
|
/**
|
|
@@ -33,6 +33,10 @@ export interface ReferenceEditorProps {
|
|
|
33
33
|
oldIndex: number;
|
|
34
34
|
newIndex: number;
|
|
35
35
|
}) => void;
|
|
36
|
+
addReferenceToRelease?: (reference: Entry | Asset, localeCode?: string, options?: {
|
|
37
|
+
openModalForVersionSelection?: boolean;
|
|
38
|
+
skipNestedReferencesPrompt?: boolean;
|
|
39
|
+
}) => Promise<void>;
|
|
36
40
|
}
|
|
37
41
|
export type CustomActionProps = LinkActionsProps;
|
|
38
42
|
export declare function ReferenceEditor<T>(props: ReferenceEditorProps & {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { QueryClient, useQuery as useRQ } from '@tanstack/react-query';
|
|
3
|
-
export declare function useQueryClient(): QueryClient;
|
|
4
|
-
export declare const useQuery: typeof useRQ;
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Re-export query client utilities from shared package.
|
|
3
|
+
* This maintains backwards compatibility while using the shared implementation.
|
|
8
4
|
*/
|
|
9
|
-
export
|
|
5
|
+
export { SharedQueryClientProvider, useQueryClient, useQuery, } from '@contentful/field-editor-shared';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RenderCustomMissingEntityCard } from '../../common/customCardTypes';
|
|
3
3
|
import { ReferenceEditorProps } from '../../common/ReferenceEditor';
|
|
4
|
-
import { ContentType, RenderDragFn } from '../../types';
|
|
4
|
+
import { ContentType, Entry, RenderDragFn } from '../../types';
|
|
5
5
|
export type EntryCardReferenceEditorProps = ReferenceEditorProps & {
|
|
6
6
|
entryId: string;
|
|
7
7
|
index?: number;
|
|
@@ -17,5 +17,9 @@ export type EntryCardReferenceEditorProps = ReferenceEditorProps & {
|
|
|
17
17
|
activeLocales?: {
|
|
18
18
|
code: string;
|
|
19
19
|
}[];
|
|
20
|
+
addReferenceToRelease?: (reference: Entry, localeCode?: string, options?: {
|
|
21
|
+
openModalForVersionSelection?: boolean;
|
|
22
|
+
skipNestedReferencesPrompt?: boolean;
|
|
23
|
+
}) => Promise<void>;
|
|
20
24
|
};
|
|
21
25
|
export declare function FetchingWrappedEntryCard(props: EntryCardReferenceEditorProps): React.JSX.Element;
|
|
@@ -31,8 +31,9 @@ export interface WrappedEntryCardProps {
|
|
|
31
31
|
releaseEntityStatus?: ReleaseEntityStatus;
|
|
32
32
|
releaseStatusMap?: ReleaseStatusMap;
|
|
33
33
|
release?: ReleaseV2Props;
|
|
34
|
+
onAddToRelease?: () => void;
|
|
34
35
|
}
|
|
35
|
-
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, releaseEntityStatus, releaseStatusMap, release, }: WrappedEntryCardProps): React.JSX.Element;
|
|
36
|
+
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, releaseEntityStatus, releaseStatusMap, release, onAddToRelease, }: WrappedEntryCardProps): React.JSX.Element;
|
|
36
37
|
export declare namespace WrappedEntryCard {
|
|
37
38
|
var defaultProps: {
|
|
38
39
|
isClickable: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.18
|
|
3
|
+
"version": "6.19.1-canary.18+487fa527",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"@contentful/f36-components": "^5.8.1",
|
|
40
40
|
"@contentful/f36-icons": "^5.8.1",
|
|
41
41
|
"@contentful/f36-tokens": "^5.1.0",
|
|
42
|
-
"@contentful/field-editor-shared": "^2.17.
|
|
42
|
+
"@contentful/field-editor-shared": "^2.17.1-canary.52+487fa527",
|
|
43
43
|
"@contentful/mimetype": "^2.2.29",
|
|
44
44
|
"@dnd-kit/core": "^6.0.8",
|
|
45
45
|
"@dnd-kit/sortable": "^8.0.0",
|
|
46
46
|
"@dnd-kit/utilities": "^3.2.2",
|
|
47
47
|
"@tanstack/react-query": "^4.3.9",
|
|
48
48
|
"constate": "^3.3.2",
|
|
49
|
-
"contentful-management": "^11.
|
|
49
|
+
"contentful-management": "^11.66.0",
|
|
50
50
|
"emotion": "^10.0.17",
|
|
51
51
|
"lodash": "^4.17.15",
|
|
52
52
|
"moment": "^2.20.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@contentful/app-sdk": "^4.42.0",
|
|
59
|
-
"@contentful/field-editor-test-utils": "^1.7.
|
|
59
|
+
"@contentful/field-editor-test-utils": "^1.7.1-canary.66+487fa527",
|
|
60
60
|
"@lingui/core": "5.3.0",
|
|
61
61
|
"@testing-library/react-hooks": "^8.0.1"
|
|
62
62
|
},
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"registry": "https://npm.pkg.github.com/"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "487fa527bb8a5afe1cc24547708876ea8e435ef0"
|
|
72
72
|
}
|