@contentful/field-editor-reference 6.6.2 → 6.6.4

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.
@@ -153,9 +153,8 @@ function renderActions(props) {
153
153
  },
154
154
  testId: "card-action-download"
155
155
  }, "Download") : null,
156
- onRemove ? _react.createElement(_f36components.Menu.Item, {
156
+ onRemove && !isDisabled ? _react.createElement(_f36components.Menu.Item, {
157
157
  key: "remove",
158
- disabled: isDisabled,
159
158
  onClick: onRemove,
160
159
  testId: "card-action-remove"
161
160
  }, "Remove") : null
@@ -131,8 +131,8 @@ const WrappedAssetCard = ({ asset, className, size, localeCode, defaultLocaleCod
131
131
  }
132
132
  } : undefined,
133
133
  dragHandleRender: renderDragHandle,
134
- withDragHandle: !!renderDragHandle,
135
- draggable: !!renderDragHandle,
134
+ withDragHandle: !!renderDragHandle && !isDisabled,
135
+ draggable: !!renderDragHandle && !isDisabled,
136
136
  actions: [
137
137
  ...(0, _AssetCardActions.renderActions)({
138
138
  entityFile,
@@ -100,7 +100,7 @@ const WrappedAssetLink = (props)=>{
100
100
  }
101
101
  },
102
102
  dragHandleRender: props.renderDragHandle,
103
- withDragHandle: !!props.renderDragHandle,
103
+ withDragHandle: !!props.renderDragHandle && !isDisabled,
104
104
  actions: [
105
105
  (0, _AssetCardActions.renderActions)({
106
106
  entityFile,
@@ -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
  }
@@ -137,8 +137,8 @@ function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales, localeC
137
137
  file: file
138
138
  }) : undefined,
139
139
  dragHandleRender: renderDragHandle,
140
- withDragHandle: !!renderDragHandle,
141
- draggable: !!renderDragHandle,
140
+ withDragHandle: !!renderDragHandle && !isDisabled,
141
+ draggable: !!renderDragHandle && !isDisabled,
142
142
  actions: onEdit || onRemove ? [
143
143
  hasCardEditActions && onEdit ? _react.createElement(_f36components.MenuItem, {
144
144
  key: "edit",
@@ -147,22 +147,22 @@ function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales, localeC
147
147
  onEdit && onEdit();
148
148
  }
149
149
  }, "Edit") : null,
150
- hasCardRemoveActions && onRemove ? _react.createElement(_f36components.MenuItem, {
150
+ hasCardRemoveActions && onRemove && !isDisabled ? _react.createElement(_f36components.MenuItem, {
151
151
  key: "delete",
152
152
  testId: "delete",
153
153
  onClick: ()=>{
154
154
  onRemove && onRemove();
155
155
  }
156
156
  }, "Remove") : null,
157
- hasCardMoveActions && (onMoveTop || onMoveBottom) ? _react.createElement(_f36components.MenuDivider, {
157
+ hasCardMoveActions && (onMoveTop || onMoveBottom) && !isDisabled ? _react.createElement(_f36components.MenuDivider, {
158
158
  key: "divider"
159
159
  }) : null,
160
- hasCardMoveActions && onMoveTop ? _react.createElement(_f36components.MenuItem, {
160
+ hasCardMoveActions && onMoveTop && !isDisabled ? _react.createElement(_f36components.MenuItem, {
161
161
  key: "move-top",
162
162
  onClick: ()=>onMoveTop && onMoveTop(),
163
163
  testId: "move-top"
164
164
  }, "Move to top") : null,
165
- hasCardMoveActions && onMoveBottom ? _react.createElement(_f36components.MenuItem, {
165
+ hasCardMoveActions && onMoveBottom && !isDisabled ? _react.createElement(_f36components.MenuItem, {
166
166
  key: "move-bottom",
167
167
  onClick: ()=>onMoveBottom && onMoveBottom(),
168
168
  testId: "move-bottom"
@@ -98,7 +98,8 @@ function ResourceEditor(props) {
98
98
  onRemoteItemAtIndex
99
99
  }), _react.createElement(_LinkEntityActions.CombinedLinkEntityActions, {
100
100
  ...linkActionsProps,
101
- renderCustomActions: props.renderCustomActions
101
+ renderCustomActions: props.renderCustomActions,
102
+ isDisabled: props.isDisabled
102
103
  }));
103
104
  }
104
105
  function WithPerItemCallbacks({ listLength, index, onMove, onRemoteItemAtIndex, children }) {
@@ -75,7 +75,8 @@ function SingleResourceReferenceEditor(props) {
75
75
  getEntryRouteHref: props.getEntryRouteHref
76
76
  }) : _react.createElement(_LinkEntityActions.CombinedLinkEntityActions, {
77
77
  ...linkActionsProps,
78
- renderCustomActions: props.renderCustomActions
78
+ renderCustomActions: props.renderCustomActions,
79
+ isDisabled: disabled
79
80
  });
80
81
  }));
81
82
  }
@@ -89,9 +89,8 @@ export function renderActions(props) {
89
89
  },
90
90
  testId: "card-action-download"
91
91
  }, "Download") : null,
92
- onRemove ? React.createElement(Menu.Item, {
92
+ onRemove && !isDisabled ? React.createElement(Menu.Item, {
93
93
  key: "remove",
94
- disabled: isDisabled,
95
94
  onClick: onRemove,
96
95
  testId: "card-action-remove"
97
96
  }, "Remove") : null
@@ -75,8 +75,8 @@ export const WrappedAssetCard = ({ asset, className, size, localeCode, defaultLo
75
75
  }
76
76
  } : undefined,
77
77
  dragHandleRender: renderDragHandle,
78
- withDragHandle: !!renderDragHandle,
79
- draggable: !!renderDragHandle,
78
+ withDragHandle: !!renderDragHandle && !isDisabled,
79
+ draggable: !!renderDragHandle && !isDisabled,
80
80
  actions: [
81
81
  ...renderActions({
82
82
  entityFile,
@@ -49,7 +49,7 @@ export const WrappedAssetLink = (props)=>{
49
49
  }
50
50
  },
51
51
  dragHandleRender: props.renderDragHandle,
52
- withDragHandle: !!props.renderDragHandle,
52
+ withDragHandle: !!props.renderDragHandle && !isDisabled,
53
53
  actions: [
54
54
  renderActions({
55
55
  entityFile,
@@ -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();
@@ -86,8 +86,8 @@ export function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales,
86
86
  file: file
87
87
  }) : undefined,
88
88
  dragHandleRender: renderDragHandle,
89
- withDragHandle: !!renderDragHandle,
90
- draggable: !!renderDragHandle,
89
+ withDragHandle: !!renderDragHandle && !isDisabled,
90
+ draggable: !!renderDragHandle && !isDisabled,
91
91
  actions: onEdit || onRemove ? [
92
92
  hasCardEditActions && onEdit ? React.createElement(MenuItem, {
93
93
  key: "edit",
@@ -96,22 +96,22 @@ export function WrappedEntryCard({ entry, entryUrl, contentType, activeLocales,
96
96
  onEdit && onEdit();
97
97
  }
98
98
  }, "Edit") : null,
99
- hasCardRemoveActions && onRemove ? React.createElement(MenuItem, {
99
+ hasCardRemoveActions && onRemove && !isDisabled ? React.createElement(MenuItem, {
100
100
  key: "delete",
101
101
  testId: "delete",
102
102
  onClick: ()=>{
103
103
  onRemove && onRemove();
104
104
  }
105
105
  }, "Remove") : null,
106
- hasCardMoveActions && (onMoveTop || onMoveBottom) ? React.createElement(MenuDivider, {
106
+ hasCardMoveActions && (onMoveTop || onMoveBottom) && !isDisabled ? React.createElement(MenuDivider, {
107
107
  key: "divider"
108
108
  }) : null,
109
- hasCardMoveActions && onMoveTop ? React.createElement(MenuItem, {
109
+ hasCardMoveActions && onMoveTop && !isDisabled ? React.createElement(MenuItem, {
110
110
  key: "move-top",
111
111
  onClick: ()=>onMoveTop && onMoveTop(),
112
112
  testId: "move-top"
113
113
  }, "Move to top") : null,
114
- hasCardMoveActions && onMoveBottom ? React.createElement(MenuItem, {
114
+ hasCardMoveActions && onMoveBottom && !isDisabled ? React.createElement(MenuItem, {
115
115
  key: "move-bottom",
116
116
  onClick: ()=>onMoveBottom && onMoveBottom(),
117
117
  testId: "move-bottom"
@@ -43,7 +43,8 @@ function ResourceEditor(props) {
43
43
  onRemoteItemAtIndex
44
44
  }), React.createElement(CombinedLinkEntityActions, {
45
45
  ...linkActionsProps,
46
- renderCustomActions: props.renderCustomActions
46
+ renderCustomActions: props.renderCustomActions,
47
+ isDisabled: props.isDisabled
47
48
  }));
48
49
  }
49
50
  function WithPerItemCallbacks({ listLength, index, onMove, onRemoteItemAtIndex, children }) {
@@ -24,7 +24,8 @@ export function SingleResourceReferenceEditor(props) {
24
24
  getEntryRouteHref: props.getEntryRouteHref
25
25
  }) : React.createElement(CombinedLinkEntityActions, {
26
26
  ...linkActionsProps,
27
- renderCustomActions: props.renderCustomActions
27
+ renderCustomActions: props.renderCustomActions,
28
+ isDisabled: disabled
28
29
  });
29
30
  }));
30
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-reference",
3
- "version": "6.6.2",
3
+ "version": "6.6.4",
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": "1d0dc6dc10cf4ad43aa48b04fa67d29ab7edaee8"
67
+ "gitHead": "6bee4a59a3c19a95d2cadde3ef0c78112788626e"
68
68
  }