@contentful/field-editor-reference 4.2.3 → 4.3.0

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,12 @@
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
+ # [4.3.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.2.3...@contentful/field-editor-reference@4.3.0) (2022-04-28)
7
+
8
+ ### Features
9
+
10
+ - reference hide actions prop [DANTE-488] ([#1120](https://github.com/contentful/field-editors/issues/1120)) ([1f53844](https://github.com/contentful/field-editors/commit/1f538449ad07b36bed908d6e1b0e3744eafa079d))
11
+
6
12
  ## [4.2.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.2.2...@contentful/field-editor-reference@4.2.3) (2022-04-19)
7
13
 
8
14
  ### Bug Fixes
@@ -9,6 +9,8 @@ export interface ReferenceEditorProps {
9
9
  */
10
10
  isInitiallyDisabled: boolean;
11
11
  hasCardEditActions: boolean;
12
+ hasCardMoveActions?: boolean;
13
+ hasCardRemoveActions?: boolean;
12
14
  sdk: FieldExtensionSDK;
13
15
  viewType: ViewType;
14
16
  renderCustomCard?: CustomCardRenderer;
@@ -9,6 +9,7 @@ declare type ChildProps = {
9
9
  allContentTypes: ContentType[];
10
10
  renderCustomCard?: ReferenceEditorProps['renderCustomCard'];
11
11
  hasCardEditActions: boolean;
12
+ hasCardRemoveActions?: boolean;
12
13
  };
13
14
  export declare function SingleReferenceEditor(props: ReferenceEditorProps & {
14
15
  entityType: ContentEntityType;
@@ -17,6 +18,7 @@ export declare function SingleReferenceEditor(props: ReferenceEditorProps & {
17
18
  export declare namespace SingleReferenceEditor {
18
19
  var defaultProps: {
19
20
  hasCardEditActions: boolean;
21
+ hasCardRemoveActions: boolean;
20
22
  };
21
23
  }
22
24
  export {};
@@ -17,16 +17,18 @@ export interface WrappedEntryCardProps {
17
17
  entry: Entry;
18
18
  renderDragHandle?: RenderDragFn;
19
19
  isClickable?: boolean;
20
- hasCardEditActions: boolean;
21
20
  onMoveTop?: () => void;
22
21
  onMoveBottom?: () => void;
23
- hasMoveOptions?: boolean;
22
+ hasCardEditActions: boolean;
23
+ hasCardMoveActions?: boolean;
24
+ hasCardRemoveActions?: boolean;
24
25
  }
25
26
  export declare function WrappedEntryCard(props: WrappedEntryCardProps): JSX.Element;
26
27
  export declare namespace WrappedEntryCard {
27
28
  var defaultProps: {
28
29
  isClickable: boolean;
29
30
  hasCardEditActions: boolean;
30
- hasMoveOptions: boolean;
31
+ hasCardMoveActions: boolean;
32
+ hasCardRemoveActions: boolean;
31
33
  };
32
34
  }
@@ -2428,7 +2428,8 @@ function SingleReferenceEditor(props) {
2428
2428
  });
2429
2429
  }
2430
2430
  SingleReferenceEditor.defaultProps = {
2431
- hasCardEditActions: true
2431
+ hasCardEditActions: true,
2432
+ hasCardRemoveActions: true
2432
2433
  };
2433
2434
 
2434
2435
  var getEntryTitle = fieldEditorShared.entityHelpers.getEntryTitle,
@@ -2443,7 +2444,8 @@ var styles$1 = {
2443
2444
  var defaultProps = {
2444
2445
  isClickable: true,
2445
2446
  hasCardEditActions: true,
2446
- hasMoveOptions: true
2447
+ hasCardMoveActions: true,
2448
+ hasCardRemoveActions: true
2447
2449
  };
2448
2450
  function WrappedEntryCard(props) {
2449
2451
  var _props$entry;
@@ -2520,18 +2522,18 @@ function WrappedEntryCard(props) {
2520
2522
  onClick: function onClick() {
2521
2523
  props.onEdit && props.onEdit();
2522
2524
  }
2523
- }, "Edit") : null, props.onRemove ? React.createElement(f36Components.MenuItem, {
2525
+ }, "Edit") : null, props.hasCardRemoveActions && props.onRemove ? React.createElement(f36Components.MenuItem, {
2524
2526
  key: "delete",
2525
2527
  testId: "delete",
2526
2528
  onClick: function onClick() {
2527
2529
  props.onRemove && props.onRemove();
2528
2530
  }
2529
- }, "Remove") : null, props.hasMoveOptions && (props.onMoveTop || props.onMoveBottom) ? React.createElement(f36Components.MenuDivider, null) : null, props.hasMoveOptions && props.onMoveTop ? React.createElement(f36Components.MenuItem, {
2531
+ }, "Remove") : null, props.hasCardMoveActions && (props.onMoveTop || props.onMoveBottom) ? React.createElement(f36Components.MenuDivider, null) : null, props.hasCardMoveActions && props.onMoveTop ? React.createElement(f36Components.MenuItem, {
2530
2532
  onClick: function onClick() {
2531
2533
  return props.onMoveTop && props.onMoveTop();
2532
2534
  },
2533
2535
  testId: "move-top"
2534
- }, "Move to top") : null, props.hasMoveOptions && props.onMoveBottom ? React.createElement(f36Components.MenuItem, {
2536
+ }, "Move to top") : null, props.hasCardMoveActions && props.onMoveBottom ? React.createElement(f36Components.MenuItem, {
2535
2537
  onClick: function onClick() {
2536
2538
  return props.onMoveBottom && props.onMoveBottom();
2537
2539
  },
@@ -2717,11 +2719,15 @@ function FetchingWrappedEntryCard(props) {
2717
2719
  onMoveTop: props.onMoveTop,
2718
2720
  onMoveBottom: props.onMoveBottom
2719
2721
  };
2720
- var hasCardEditActions = props.hasCardEditActions;
2722
+ var hasCardEditActions = props.hasCardEditActions,
2723
+ hasCardMoveActions = props.hasCardMoveActions,
2724
+ hasCardRemoveActions = props.hasCardRemoveActions;
2721
2725
 
2722
2726
  function renderDefaultCard(props) {
2723
2727
  var builtinCardProps = _extends({}, sharedCardProps, props, {
2724
2728
  hasCardEditActions: hasCardEditActions,
2729
+ hasCardMoveActions: hasCardMoveActions,
2730
+ hasCardRemoveActions: hasCardRemoveActions,
2725
2731
  getAsset: getOrLoadAsset,
2726
2732
  getEntityScheduledActions: loadEntityScheduledActions,
2727
2733
  entry: (props == null ? void 0 : props.entity) || sharedCardProps.entity,
@@ -2753,6 +2759,7 @@ function SingleEntryReferenceEditor(props) {
2753
2759
  entityId = _ref.entityId,
2754
2760
  setValue = _ref.setValue,
2755
2761
  renderCustomCard = _ref.renderCustomCard,
2762
+ hasCardRemoveActions = _ref.hasCardRemoveActions,
2756
2763
  hasCardEditActions = _ref.hasCardEditActions;
2757
2764
  return React.createElement(FetchingWrappedEntryCard, Object.assign({}, props, {
2758
2765
  allContentTypes: allContentTypes,
@@ -2760,6 +2767,7 @@ function SingleEntryReferenceEditor(props) {
2760
2767
  entryId: entityId,
2761
2768
  renderCustomCard: renderCustomCard,
2762
2769
  hasCardEditActions: hasCardEditActions,
2770
+ hasCardRemoveActions: hasCardRemoveActions,
2763
2771
  onRemove: function onRemove() {
2764
2772
  setValue(null);
2765
2773
  }