@contentful/field-editor-reference 5.0.0 → 5.1.2
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/CHANGELOG.md +18 -0
- package/dist/assets/MultipleMediaEditor.d.ts +1 -1
- package/dist/assets/SingleMediaEditor.d.ts +1 -1
- package/dist/field-editor-reference.cjs.development.js +451 -6
- package/dist/field-editor-reference.cjs.development.js.map +1 -1
- package/dist/field-editor-reference.cjs.production.min.js +1 -1
- package/dist/field-editor-reference.cjs.production.min.js.map +1 -1
- package/dist/field-editor-reference.esm.js +450 -7
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/resources/Cards/ContentfulEntryCard.d.ts +21 -0
- package/dist/resources/Cards/ResourceCard.d.ts +12 -0
- package/dist/resources/Cards/UnsupportedEntityCard.d.ts +4 -0
- package/dist/resources/MultipleResourceReferenceEditor.d.ts +7 -0
- package/dist/resources/SingleResourceReferenceEditor.d.ts +7 -0
- package/dist/resources/index.d.ts +2 -0
- package/dist/resources/testHelpers/resourceEditorHelpers.d.ts +50 -0
- package/dist/resources/useResourceLinkActions.d.ts +7 -0
- package/dist/types.d.ts +10 -0
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export type { CustomActionProps } from './common/ReferenceEditor';
|
|
|
5
5
|
export type { CustomEntityCardProps, DefaultCardRenderer, MissingEntityCardProps, RenderCustomMissingEntityCard, } from './common/customCardTypes';
|
|
6
6
|
export { SortableLinkList } from './common/SortableLinkList';
|
|
7
7
|
export { EntityProvider, useEntityLoader, useEntity, useResource } from './common/EntityStore';
|
|
8
|
+
export { SingleResourceReferenceEditor, MultipleResourceReferenceEditor } from './resources';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Entry } from '@contentful/field-editor-shared';
|
|
3
|
+
import { RenderDragFn, ResourceInfo } from '../../types';
|
|
4
|
+
export declare type CardActionsHandlers = {
|
|
5
|
+
onRemove?: VoidFunction;
|
|
6
|
+
onMoveTop?: VoidFunction;
|
|
7
|
+
onMoveBottom?: VoidFunction;
|
|
8
|
+
};
|
|
9
|
+
export declare type EntryRoute = {
|
|
10
|
+
spaceId: string;
|
|
11
|
+
environmentId: string;
|
|
12
|
+
entryId: string;
|
|
13
|
+
};
|
|
14
|
+
declare type ContentfulEntryCardProps = {
|
|
15
|
+
info: ResourceInfo<Entry>;
|
|
16
|
+
isDisabled: boolean;
|
|
17
|
+
renderDragHandle?: RenderDragFn;
|
|
18
|
+
getEntryRouteHref: (entryRoute: EntryRoute) => string;
|
|
19
|
+
} & CardActionsHandlers;
|
|
20
|
+
export declare function ContentfulEntryCard({ info, isDisabled, renderDragHandle, onRemove, onMoveTop, onMoveBottom, getEntryRouteHref, }: ContentfulEntryCardProps): JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CardActionsHandlers, EntryRoute } from './ContentfulEntryCard';
|
|
3
|
+
import { RenderDragFn, ResourceLink } from '../../types';
|
|
4
|
+
declare type ResourceCardProps = {
|
|
5
|
+
index?: number;
|
|
6
|
+
resourceLink?: ResourceLink;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
renderDragHandle?: RenderDragFn;
|
|
9
|
+
getEntryRouteHref: (entryRoute: EntryRoute) => string;
|
|
10
|
+
} & CardActionsHandlers;
|
|
11
|
+
export declare function ResourceCard(props: ResourceCardProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ReferenceEditorProps } from '../common/ReferenceEditor';
|
|
3
|
+
import { EntryRoute } from './Cards/ContentfulEntryCard';
|
|
4
|
+
export declare function MultipleResourceReferenceEditor(props: ReferenceEditorProps & {
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
getEntryRouteHref: (entryRoute: EntryRoute) => string;
|
|
7
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ReferenceEditorProps } from '../common/ReferenceEditor';
|
|
3
|
+
import { EntryRoute } from './Cards/ContentfulEntryCard';
|
|
4
|
+
export declare function SingleResourceReferenceEditor(props: ReferenceEditorProps & {
|
|
5
|
+
getEntryRouteHref: (entryRoute: EntryRoute) => string;
|
|
6
|
+
apiUrl: string;
|
|
7
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
export declare function mockSdkForField(fieldDefinition: any, fieldValue?: any): FieldExtensionSDK;
|
|
3
|
+
declare type FakeEntryResource = {
|
|
4
|
+
title: string;
|
|
5
|
+
id: string;
|
|
6
|
+
space: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const createFakeEntryResource: ({ title, id, space }: FakeEntryResource) => {
|
|
12
|
+
resource: {
|
|
13
|
+
sys: {
|
|
14
|
+
id: string;
|
|
15
|
+
type: string;
|
|
16
|
+
space: {
|
|
17
|
+
sys: {
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
environment: {
|
|
22
|
+
sys: {
|
|
23
|
+
id: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
fields: {
|
|
28
|
+
title: {
|
|
29
|
+
en: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
contentType: {
|
|
34
|
+
sys: {
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
37
|
+
displayField: string;
|
|
38
|
+
fields: {
|
|
39
|
+
type: string;
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
localeCode: string;
|
|
45
|
+
defaultLocaleCode: string;
|
|
46
|
+
space: {
|
|
47
|
+
name: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import { EntryProps, KeyValueMap } from 'contentful-management';
|
|
3
|
+
import { LinkActionsProps } from '../components';
|
|
4
|
+
export declare function useResourceLinkActions({ apiUrl, dialogs, field, onAfterLink, }: Pick<FieldExtensionSDK, 'field' | 'dialogs'> & {
|
|
5
|
+
apiUrl: string;
|
|
6
|
+
onAfterLink?: (e: EntryProps<KeyValueMap>) => void;
|
|
7
|
+
}): LinkActionsProps;
|
package/dist/types.d.ts
CHANGED
|
@@ -23,6 +23,16 @@ export declare type AssetLink = {
|
|
|
23
23
|
export declare type EntityLink = EntryLink | AssetLink;
|
|
24
24
|
export declare type ResourceType = 'Contentful:Entry';
|
|
25
25
|
export declare type Resource = Entry | Asset;
|
|
26
|
+
export declare type EntityType = 'Entry' | 'Asset' | ResourceType;
|
|
27
|
+
export declare type SysResourceLink<T extends string> = {
|
|
28
|
+
sys: {
|
|
29
|
+
type: 'ResourceLink';
|
|
30
|
+
linkType: T;
|
|
31
|
+
urn: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare type ContentfulEntryLink = SysResourceLink<'Contentful:Entry'>;
|
|
35
|
+
export declare type ResourceLink = ContentfulEntryLink;
|
|
26
36
|
/**
|
|
27
37
|
* @deprecated use `EntityLink` type
|
|
28
38
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/field-editor-reference.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
"lodash": "^4.17.15",
|
|
37
37
|
"lodash-es": "^4.17.15",
|
|
38
38
|
"moment": "^2.20.0",
|
|
39
|
-
"
|
|
39
|
+
"p-queue": "^4.0.0",
|
|
40
|
+
"react-intersection-observer": "9.4.0",
|
|
41
|
+
"react-sortable-hoc": "^2.0.0",
|
|
42
|
+
"type-fest": "2.17.0"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@contentful/app-sdk": "^4.2.0",
|
|
@@ -57,5 +60,5 @@
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
},
|
|
60
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "5633030b96dd783286b9ebd22259f08af237466b"
|
|
61
64
|
}
|