@contentful/field-editor-reference 6.6.3 → 6.6.5

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.
@@ -9,8 +9,13 @@ Object.defineProperty(exports, "useContentTypePermissions", {
9
9
  }
10
10
  });
11
11
  const _react = require("react");
12
- const _lodash = require("lodash");
12
+ const _isEqual = /*#__PURE__*/ _interop_require_default(require("lodash/isEqual"));
13
13
  const _useAccessApi = require("./useAccessApi");
14
+ function _interop_require_default(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
14
19
  async function filter(arr, predicate) {
15
20
  const fail = Symbol();
16
21
  const results = await Promise.all(arr.map(async (item)=>await predicate(item) ? item : fail));
@@ -38,7 +43,7 @@ function useContentTypePermissions({ entityType, validations, sdk, allContentTyp
38
43
  }
39
44
  async function checkContentTypeAccess() {
40
45
  const creatable = await getContentTypes('create');
41
- if (!(0, _lodash.isEqual)(creatable, creatableContentTypes)) {
46
+ if (!(0, _isEqual.default)(creatable, creatableContentTypes)) {
42
47
  setCreatableContentTypes(creatable);
43
48
  }
44
49
  }
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "MultipleEntryReferenceEditor", {
9
9
  }
10
10
  });
11
11
  const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
+ const _fieldeditorshared = require("@contentful/field-editor-shared");
12
13
  const _sortable = require("@dnd-kit/sortable");
13
14
  const _MultipleReferenceEditor = require("../common/MultipleReferenceEditor");
14
15
  const _SortableLinkList = require("../common/SortableLinkList");
@@ -56,6 +57,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
56
57
  }
57
58
  function MultipleEntryReferenceEditor(props) {
58
59
  const [indexToUpdate, setIndexToUpdate] = _react.useState(undefined);
60
+ const activeLocales = (0, _fieldeditorshared.useActiveLocales)(props.sdk);
59
61
  const updateBeforeSortStart = ({ index })=>{
60
62
  setIndexToUpdate(index);
61
63
  };
@@ -76,6 +78,7 @@ function MultipleEntryReferenceEditor(props) {
76
78
  allContentTypes: childrenProps.allContentTypes,
77
79
  isDisabled: isDisabled,
78
80
  entryId: item.sys.id,
81
+ activeLocales: activeLocales,
79
82
  onRemove: ()=>{
80
83
  childrenProps.setValue(items.filter((_value, i)=>i !== index));
81
84
  },
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "SingleEntryReferenceEditor", {
9
9
  }
10
10
  });
11
11
  const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
12
+ const _fieldeditorshared = require("@contentful/field-editor-shared");
12
13
  const _SingleReferenceEditor = require("../common/SingleReferenceEditor");
13
14
  const _FetchingWrappedEntryCard = require("./WrappedEntryCard/FetchingWrappedEntryCard");
14
15
  function _getRequireWildcardCache(nodeInterop) {
@@ -53,6 +54,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
53
54
  return newObj;
54
55
  }
55
56
  function SingleEntryReferenceEditor(props) {
57
+ const activeLocales = (0, _fieldeditorshared.useActiveLocales)(props.sdk);
56
58
  return _react.createElement(_SingleReferenceEditor.SingleReferenceEditor, {
57
59
  ...props,
58
60
  entityType: "Entry"
@@ -65,6 +67,7 @@ function SingleEntryReferenceEditor(props) {
65
67
  renderCustomCard: renderCustomCard,
66
68
  hasCardEditActions: hasCardEditActions,
67
69
  hasCardRemoveActions: hasCardRemoveActions,
70
+ activeLocales: activeLocales,
68
71
  onRemove: ()=>{
69
72
  setValue(null);
70
73
  }
@@ -88,7 +88,6 @@ function FetchingWrappedEntryCard(props) {
88
88
  props.entryId
89
89
  ]);
90
90
  const localesStatusMap = (0, _fieldeditorshared.useLocalePublishStatus)(entry, props.sdk.locales);
91
- const activeLocales = (0, _fieldeditorshared.useActiveLocales)(props.sdk);
92
91
  const size = props.viewType === 'link' ? 'small' : 'default';
93
92
  const { getEntity } = (0, _EntityStore.useEntityLoader)();
94
93
  const getAsset = (assetId)=>getEntity('Asset', assetId);
@@ -165,7 +164,7 @@ function FetchingWrappedEntryCard(props) {
165
164
  isBeingDragged: props.isBeingDragged,
166
165
  useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
167
166
  localesStatusMap,
168
- activeLocales
167
+ activeLocales: props.activeLocales
169
168
  };
170
169
  const { hasCardEditActions, hasCardMoveActions, hasCardRemoveActions } = props;
171
170
  function renderDefaultCard(props) {
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useMemo, useState } from 'react';
2
- import { isEqual } from 'lodash';
2
+ import isEqual from 'lodash/isEqual';
3
3
  import { useAccessApi } from './useAccessApi';
4
4
  async function filter(arr, predicate) {
5
5
  const fail = Symbol();
@@ -1,10 +1,12 @@
1
1
  import * as React from 'react';
2
+ import { useActiveLocales } from '@contentful/field-editor-shared';
2
3
  import { verticalListSortingStrategy } from '@dnd-kit/sortable';
3
4
  import { MultipleReferenceEditor } from '../common/MultipleReferenceEditor';
4
5
  import { SortableLinkList } from '../common/SortableLinkList';
5
6
  import { FetchingWrappedEntryCard } from './WrappedEntryCard/FetchingWrappedEntryCard';
6
7
  export function MultipleEntryReferenceEditor(props) {
7
8
  const [indexToUpdate, setIndexToUpdate] = React.useState(undefined);
9
+ const activeLocales = useActiveLocales(props.sdk);
8
10
  const updateBeforeSortStart = ({ index })=>{
9
11
  setIndexToUpdate(index);
10
12
  };
@@ -25,6 +27,7 @@ export function MultipleEntryReferenceEditor(props) {
25
27
  allContentTypes: childrenProps.allContentTypes,
26
28
  isDisabled: isDisabled,
27
29
  entryId: item.sys.id,
30
+ activeLocales: activeLocales,
28
31
  onRemove: ()=>{
29
32
  childrenProps.setValue(items.filter((_value, i)=>i !== index));
30
33
  },
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { useActiveLocales } from '@contentful/field-editor-shared';
2
3
  import { SingleReferenceEditor } from '../common/SingleReferenceEditor';
3
4
  import { FetchingWrappedEntryCard } from './WrappedEntryCard/FetchingWrappedEntryCard';
4
5
  export function SingleEntryReferenceEditor(props) {
6
+ const activeLocales = useActiveLocales(props.sdk);
5
7
  return React.createElement(SingleReferenceEditor, {
6
8
  ...props,
7
9
  entityType: "Entry"
@@ -14,6 +16,7 @@ export function SingleEntryReferenceEditor(props) {
14
16
  renderCustomCard: renderCustomCard,
15
17
  hasCardEditActions: hasCardEditActions,
16
18
  hasCardRemoveActions: hasCardRemoveActions,
19
+ activeLocales: activeLocales,
17
20
  onRemove: ()=>{
18
21
  setValue(null);
19
22
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { EntryCard } from '@contentful/f36-components';
3
- import { useLocalePublishStatus, useActiveLocales } from '@contentful/field-editor-shared';
3
+ import { useLocalePublishStatus } from '@contentful/field-editor-shared';
4
4
  import get from 'lodash/get';
5
5
  import { useEntity, useEntityLoader } from '../../common/EntityStore';
6
6
  import { MissingEntityCard } from '../../components';
@@ -32,7 +32,6 @@ export function FetchingWrappedEntryCard(props) {
32
32
  props.entryId
33
33
  ]);
34
34
  const localesStatusMap = useLocalePublishStatus(entry, props.sdk.locales);
35
- const activeLocales = useActiveLocales(props.sdk);
36
35
  const size = props.viewType === 'link' ? 'small' : 'default';
37
36
  const { getEntity } = useEntityLoader();
38
37
  const getAsset = (assetId)=>getEntity('Asset', assetId);
@@ -109,7 +108,7 @@ export function FetchingWrappedEntryCard(props) {
109
108
  isBeingDragged: props.isBeingDragged,
110
109
  useLocalizedEntityStatus: props.sdk.parameters.instance.useLocalizedEntityStatus,
111
110
  localesStatusMap,
112
- activeLocales
111
+ activeLocales: props.activeLocales
113
112
  };
114
113
  const { hasCardEditActions, hasCardMoveActions, hasCardRemoveActions } = props;
115
114
  function renderDefaultCard(props) {
@@ -14,5 +14,8 @@ export type EntryCardReferenceEditorProps = ReferenceEditorProps & {
14
14
  onMoveBottom?: () => void;
15
15
  renderCustomMissingEntityCard?: RenderCustomMissingEntityCard;
16
16
  isBeingDragged?: boolean;
17
+ activeLocales?: {
18
+ code: string;
19
+ }[];
17
20
  };
18
21
  export declare function FetchingWrappedEntryCard(props: EntryCardReferenceEditorProps): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-reference",
3
- "version": "6.6.3",
3
+ "version": "6.6.5",
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.4.1",
41
+ "@contentful/field-editor-shared": "^2.4.2",
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": "74c01134b9af5b36ed64b464712eab83d37639c9"
67
+ "gitHead": "eeb191f47b0820764640609ab4af6276689e0bfa"
68
68
  }