@contentful/field-editor-reference 5.6.0 → 5.8.1

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 CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.8.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.8.0...@contentful/field-editor-reference@5.8.1) (2023-01-13)
7
+
8
+ ### Bug Fixes
9
+
10
+ - enter key open asset modal [TOL-889] ([#1320](https://github.com/contentful/field-editors/issues/1320)) ([5e142ca](https://github.com/contentful/field-editors/commit/5e142ca14c1eac5816e8c962e4e32be6fe10aad6))
11
+
12
+ # [5.8.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.6.0...@contentful/field-editor-reference@5.8.0) (2023-01-11)
13
+
14
+ ### Features
15
+
16
+ - custom actions in resource reference editors [DANTE-793] ([#1317](https://github.com/contentful/field-editors/issues/1317)) ([9702049](https://github.com/contentful/field-editors/commit/97020490219033edce2f71635f098b76f8a1f4b4))
17
+
18
+ # [5.7.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.6.0...@contentful/field-editor-reference@5.7.0) (2023-01-11)
19
+
20
+ ### Features
21
+
22
+ - custom actions in resource reference editors [DANTE-793] ([#1317](https://github.com/contentful/field-editors/issues/1317)) ([9702049](https://github.com/contentful/field-editors/commit/97020490219033edce2f71635f098b76f8a1f4b4))
23
+
6
24
  # [5.6.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@5.5.4...@contentful/field-editor-reference@5.6.0) (2023-01-02)
7
25
 
8
26
  ### Bug Fixes
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { Asset, RenderDragFn } from '../../types';
3
2
  import { SpaceAPI } from '@contentful/field-editor-shared';
3
+ import { Asset, RenderDragFn } from '../../types';
4
4
  export interface WrappedAssetLinkProps {
5
5
  getEntityScheduledActions: SpaceAPI['getEntityScheduledActions'];
6
6
  asset: Asset;
@@ -18,4 +18,7 @@ export declare function useLinkActionsProps(props: LinkEntityActionsProps): Link
18
18
  export declare function LinkEntityActions({ renderCustomActions, ...props }: LinkActionsProps & {
19
19
  renderCustomActions?: (props: LinkActionsProps) => React.ReactElement;
20
20
  }): JSX.Element;
21
+ export declare function CombinedLinkEntityActions({ renderCustomActions, ...props }: LinkActionsProps & {
22
+ renderCustomActions?: (props: LinkActionsProps) => React.ReactElement;
23
+ }): JSX.Element;
21
24
  export {};
@@ -1604,7 +1604,8 @@ function _selectMultipleEntities() {
1604
1604
  return _selectMultipleEntities.apply(this, arguments);
1605
1605
  }
1606
1606
 
1607
- var _excluded = ["renderCustomActions"];
1607
+ var _excluded = ["renderCustomActions"],
1608
+ _excluded2 = ["renderCustomActions"];
1608
1609
  function useLinkActionsProps(props) {
1609
1610
  var _editorPermissions$va;
1610
1611
 
@@ -1803,10 +1804,13 @@ function LinkEntityActions(_ref4) {
1803
1804
  var renderCustomActions = _ref4.renderCustomActions,
1804
1805
  props = _objectWithoutPropertiesLoose(_ref4, _excluded);
1805
1806
 
1806
- var renderLinkActions = renderCustomActions ? renderCustomActions : function (props) {
1807
- return React.createElement(LinkActions, _extends({}, props));
1808
- };
1809
- return renderLinkActions(props);
1807
+ return renderCustomActions ? renderCustomActions(props) : React.createElement(LinkActions, _extends({}, props));
1808
+ }
1809
+ function CombinedLinkEntityActions(_ref5) {
1810
+ var renderCustomActions = _ref5.renderCustomActions,
1811
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded2);
1812
+
1813
+ return renderCustomActions ? renderCustomActions(props) : React.createElement(CombinedLinkActions, _extends({}, props));
1810
1814
  }
1811
1815
 
1812
1816
  // eslint-disable-next-line -- TODO: describe this disable no-restricted-imports
@@ -1925,7 +1929,7 @@ function AssetThumbnail(props) {
1925
1929
  }
1926
1930
 
1927
1931
  var _excluded$1 = ["priority"],
1928
- _excluded2 = ["children"];
1932
+ _excluded2$1 = ["children"];
1929
1933
 
1930
1934
  var globalQueue = /*#__PURE__*/new PQueue({
1931
1935
  concurrency: 50
@@ -2375,7 +2379,7 @@ function useResource(resourceType, urn, options) {
2375
2379
 
2376
2380
  function EntityProvider(_ref9) {
2377
2381
  var children = _ref9.children,
2378
- props = _objectWithoutPropertiesLoose(_ref9, _excluded2);
2382
+ props = _objectWithoutPropertiesLoose(_ref9, _excluded2$1);
2379
2383
 
2380
2384
  var reactQueryClient = React.useMemo(function () {
2381
2385
  var queryCache = new reactQuery.QueryCache();
@@ -3606,6 +3610,15 @@ var WrappedAssetCard = function WrappedAssetCard(props) {
3606
3610
  e.preventDefault();
3607
3611
  onEdit && onEdit();
3608
3612
  } : undefined,
3613
+
3614
+ /* todo - remove this when onKeyDown is allowed as a prop for BaseCard in forma 36
3615
+ // @ts-expect-error */
3616
+ onKeyDown: isClickable ? function (e) {
3617
+ if (e.key === 'Enter' && onEdit) {
3618
+ e.preventDefault();
3619
+ onEdit();
3620
+ }
3621
+ } : undefined,
3609
3622
  dragHandleRender: props.renderDragHandle,
3610
3623
  withDragHandle: !!props.renderDragHandle,
3611
3624
  actions: [].concat(renderActions({
@@ -3676,6 +3689,12 @@ var WrappedAssetLink = function WrappedAssetLink(props) {
3676
3689
  e.preventDefault();
3677
3690
  onEdit();
3678
3691
  },
3692
+ onKeyDown: function onKeyDown(e) {
3693
+ if (e.key === 'Enter' && onEdit) {
3694
+ e.preventDefault();
3695
+ onEdit();
3696
+ }
3697
+ },
3679
3698
  dragHandleRender: props.renderDragHandle,
3680
3699
  withDragHandle: !!props.renderDragHandle,
3681
3700
  actions: [renderActions({
@@ -4238,7 +4257,9 @@ function ResourceEditor(props) {
4238
4257
  onSortEnd: onSortEnd,
4239
4258
  onMove: onMove,
4240
4259
  onRemoteItemAtIndex: onRemoteItemAtIndex
4241
- })), React.createElement(CombinedLinkActions, _extends({}, linkActionsProps)));
4260
+ })), React.createElement(CombinedLinkEntityActions, _extends({}, linkActionsProps, {
4261
+ renderCustomActions: props.renderCustomActions
4262
+ })));
4242
4263
  } // provides memoized callbacks bound to a given item
4243
4264
 
4244
4265
 
@@ -4286,6 +4307,7 @@ function MultipleResourceReferenceEditor(props) {
4286
4307
  items: value || EMPTY_ARRAY,
4287
4308
  isDisabled: disabled,
4288
4309
  setValue: setValue,
4310
+ renderCustomActions: props.renderCustomActions,
4289
4311
  key: externalReset + "-list"
4290
4312
  }), function (editorProps) {
4291
4313
  return React.createElement(SortableLinkList, _extends({}, editorProps), function (_ref4) {
@@ -4344,8 +4366,9 @@ function SingleResourceReferenceEditor(props) {
4344
4366
  resourceLink: value,
4345
4367
  isDisabled: disabled,
4346
4368
  getEntryRouteHref: props.getEntryRouteHref
4347
- }) : // TODO: support custom actions once publicly available
4348
- React.createElement(CombinedLinkActions, _extends({}, linkActionsProps));
4369
+ }) : React.createElement(CombinedLinkEntityActions, _extends({}, linkActionsProps, {
4370
+ renderCustomActions: props.renderCustomActions
4371
+ }));
4349
4372
  }));
4350
4373
  }
4351
4374