@contentful/field-editor-reference 5.21.2 → 5.21.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.
- package/dist/cjs/__fixtures__/asset/index.js +5 -5
- package/dist/cjs/__fixtures__/content-type/index.js +1 -1
- package/dist/cjs/__fixtures__/entry/index.js +4 -4
- package/dist/cjs/__fixtures__/fixtures.js +5 -5
- package/dist/cjs/__fixtures__/locale/index.js +2 -2
- package/dist/cjs/__fixtures__/space/index.js +1 -1
- package/dist/cjs/assets/MultipleMediaEditor.js +4 -4
- package/dist/cjs/assets/SingleMediaEditor.js +3 -3
- package/dist/cjs/assets/WrappedAssetCard/AssetCardActions.js +13 -13
- package/dist/cjs/assets/WrappedAssetCard/FetchingWrappedAssetCard.js +7 -12
- package/dist/cjs/assets/WrappedAssetCard/WrappedAssetCard.js +9 -16
- package/dist/cjs/assets/WrappedAssetCard/WrappedAssetLink.js +7 -8
- package/dist/cjs/common/EntityStore.js +6 -23
- package/dist/cjs/common/MultipleReferenceEditor.js +7 -14
- package/dist/cjs/common/ReferenceEditor.js +4 -4
- package/dist/cjs/common/SingleReferenceEditor.js +5 -7
- package/dist/cjs/common/SortableLinkList.js +9 -9
- package/dist/cjs/common/customCardTypes.js +1 -1
- package/dist/cjs/common/queryClient.js +3 -6
- package/dist/cjs/common/useContentTypePermissions.js +0 -2
- package/dist/cjs/common/useEditorPermissions.js +0 -12
- package/dist/cjs/common/useEditorPermissions.spec.js +0 -1
- package/dist/cjs/components/AssetThumbnail/AssetThumbnail.js +2 -2
- package/dist/cjs/components/CreateEntryLinkButton/CreateEntryLinkButton.js +7 -9
- package/dist/cjs/components/CreateEntryLinkButton/CreateEntryLinkButton.spec.js +14 -14
- package/dist/cjs/components/CreateEntryLinkButton/CreateEntryMenuTrigger.js +16 -24
- package/dist/cjs/components/CreateEntryLinkButton/CreateEntryMenuTrigger.spec.js +11 -11
- package/dist/cjs/components/LinkActions/CombinedLinkActions.js +20 -25
- package/dist/cjs/components/LinkActions/LinkActions.js +11 -11
- package/dist/cjs/components/LinkActions/LinkEntityActions.js +8 -15
- package/dist/cjs/components/LinkActions/NoLinkPermissionsInfo.js +2 -2
- package/dist/cjs/components/LinkActions/helpers.js +0 -9
- package/dist/cjs/components/LinkActions/redesignStyles.js +1 -1
- package/dist/cjs/components/LinkActions/styles.js +1 -1
- package/dist/cjs/components/MissingEntityCard/MissingEntityCard.js +8 -8
- package/dist/cjs/components/ResourceEntityErrorCard/ResourceEntityErrorCard.js +3 -3
- package/dist/cjs/components/ResourceEntityErrorCard/UnsupportedEntityCard.js +3 -3
- package/dist/cjs/components/ScheduledIconWithTooltip/ScheduleTooltip.js +2 -2
- package/dist/cjs/components/ScheduledIconWithTooltip/ScheduledIconWithTooltip.js +2 -5
- package/dist/cjs/components/ScheduledIconWithTooltip/formatDateAndTime.js +1 -2
- package/dist/cjs/components/SpaceName/SpaceName.js +6 -6
- package/dist/cjs/entries/MultipleEntryReferenceEditor.js +4 -4
- package/dist/cjs/entries/SingleEntryReferenceEditor.js +3 -3
- package/dist/cjs/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +7 -14
- package/dist/cjs/entries/WrappedEntryCard/WrappedEntryCard.js +14 -18
- package/dist/cjs/resources/Cards/ContentfulEntryCard.js +2 -9
- package/dist/cjs/resources/Cards/ResourceCard.js +8 -10
- package/dist/cjs/resources/Cards/ResourceCard.spec.js +7 -8
- package/dist/cjs/resources/MultipleResourceReferenceEditor.js +11 -12
- package/dist/cjs/resources/MultipleResourceReferenceEditor.spec.js +8 -27
- package/dist/cjs/resources/SingleResourceReferenceEditor.js +6 -6
- package/dist/cjs/resources/SingleResourceReferenceEditor.spec.js +5 -10
- package/dist/cjs/resources/testHelpers/resourceEditorHelpers.js +0 -7
- package/dist/cjs/resources/useResourceLinkActions.js +1 -10
- package/dist/cjs/utils/fromFieldValidations.js +1 -2
- package/dist/cjs/utils/useSortIDs.js +1 -1
- package/dist/esm/assets/MultipleMediaEditor.js +3 -3
- package/dist/esm/assets/SingleMediaEditor.js +2 -2
- package/dist/esm/assets/WrappedAssetCard/AssetCardActions.js +10 -10
- package/dist/esm/assets/WrappedAssetCard/FetchingWrappedAssetCard.js +6 -11
- package/dist/esm/assets/WrappedAssetCard/WrappedAssetCard.js +6 -14
- package/dist/esm/assets/WrappedAssetCard/WrappedAssetLink.js +5 -6
- package/dist/esm/common/EntityStore.js +3 -20
- package/dist/esm/common/MultipleReferenceEditor.js +6 -13
- package/dist/esm/common/ReferenceEditor.js +2 -2
- package/dist/esm/common/SingleReferenceEditor.js +4 -6
- package/dist/esm/common/SortableLinkList.js +7 -7
- package/dist/esm/common/queryClient.js +3 -10
- package/dist/esm/common/useContentTypePermissions.js +0 -2
- package/dist/esm/common/useEditorPermissions.js +0 -12
- package/dist/esm/common/useEditorPermissions.spec.js +0 -1
- package/dist/esm/components/AssetThumbnail/AssetThumbnail.js +1 -1
- package/dist/esm/components/CreateEntryLinkButton/CreateEntryLinkButton.js +4 -6
- package/dist/esm/components/CreateEntryLinkButton/CreateEntryLinkButton.spec.js +12 -12
- package/dist/esm/components/CreateEntryLinkButton/CreateEntryMenuTrigger.js +13 -21
- package/dist/esm/components/CreateEntryLinkButton/CreateEntryMenuTrigger.spec.js +8 -9
- package/dist/esm/components/LinkActions/CombinedLinkActions.js +19 -30
- package/dist/esm/components/LinkActions/LinkActions.js +9 -9
- package/dist/esm/components/LinkActions/LinkEntityActions.js +7 -14
- package/dist/esm/components/LinkActions/NoLinkPermissionsInfo.js +1 -1
- package/dist/esm/components/LinkActions/helpers.js +0 -9
- package/dist/esm/components/MissingEntityCard/MissingEntityCard.js +6 -6
- package/dist/esm/components/ResourceEntityErrorCard/ResourceEntityErrorCard.js +2 -2
- package/dist/esm/components/ResourceEntityErrorCard/UnsupportedEntityCard.js +2 -2
- package/dist/esm/components/ScheduledIconWithTooltip/ScheduleTooltip.js +1 -1
- package/dist/esm/components/ScheduledIconWithTooltip/ScheduledIconWithTooltip.js +1 -4
- package/dist/esm/components/ScheduledIconWithTooltip/formatDateAndTime.js +2 -11
- package/dist/esm/components/SpaceName/SpaceName.js +4 -4
- package/dist/esm/entries/MultipleEntryReferenceEditor.js +3 -3
- package/dist/esm/entries/SingleEntryReferenceEditor.js +2 -2
- package/dist/esm/entries/WrappedEntryCard/FetchingWrappedEntryCard.js +5 -12
- package/dist/esm/entries/WrappedEntryCard/WrappedEntryCard.js +12 -16
- package/dist/esm/resources/Cards/ContentfulEntryCard.js +1 -8
- package/dist/esm/resources/Cards/ResourceCard.js +7 -9
- package/dist/esm/resources/Cards/ResourceCard.spec.js +2 -3
- package/dist/esm/resources/MultipleResourceReferenceEditor.js +8 -9
- package/dist/esm/resources/MultipleResourceReferenceEditor.spec.js +7 -26
- package/dist/esm/resources/SingleResourceReferenceEditor.js +4 -4
- package/dist/esm/resources/SingleResourceReferenceEditor.spec.js +4 -9
- package/dist/esm/resources/testHelpers/resourceEditorHelpers.js +0 -7
- package/dist/esm/resources/useResourceLinkActions.js +1 -10
- package/dist/esm/utils/fromFieldValidations.js +0 -1
- package/dist/types/assets/MultipleMediaEditor.d.ts +2 -2
- package/dist/types/assets/SingleMediaEditor.d.ts +2 -2
- package/dist/types/assets/WrappedAssetCard/AssetCardActions.d.ts +3 -3
- package/dist/types/assets/WrappedAssetCard/FetchingWrappedAssetCard.d.ts +2 -2
- package/dist/types/assets/WrappedAssetCard/WrappedAssetCard.d.ts +2 -2
- package/dist/types/assets/WrappedAssetCard/WrappedAssetLink.d.ts +2 -2
- package/dist/types/common/EntityStore.d.ts +1 -1
- package/dist/types/common/MultipleReferenceEditor.d.ts +1 -1
- package/dist/types/common/ReferenceEditor.d.ts +1 -1
- package/dist/types/common/SingleReferenceEditor.d.ts +1 -1
- package/dist/types/common/SortableLinkList.d.ts +1 -1
- package/dist/types/common/queryClient.d.ts +1 -1
- package/dist/types/components/AssetThumbnail/AssetThumbnail.d.ts +2 -2
- package/dist/types/components/CreateEntryLinkButton/CreateEntryLinkButton.d.ts +1 -1
- package/dist/types/components/CreateEntryLinkButton/CreateEntryMenuTrigger.d.ts +1 -1
- package/dist/types/components/LinkActions/CombinedLinkActions.d.ts +2 -2
- package/dist/types/components/LinkActions/LinkActions.d.ts +1 -1
- package/dist/types/components/LinkActions/LinkEntityActions.d.ts +2 -2
- package/dist/types/components/LinkActions/NoLinkPermissionsInfo.d.ts +2 -2
- package/dist/types/components/MissingEntityCard/MissingEntityCard.d.ts +2 -2
- package/dist/types/components/ResourceEntityErrorCard/ResourceEntityErrorCard.d.ts +2 -2
- package/dist/types/components/ResourceEntityErrorCard/UnsupportedEntityCard.d.ts +2 -2
- package/dist/types/components/ScheduledIconWithTooltip/ScheduleTooltip.d.ts +1 -1
- package/dist/types/components/ScheduledIconWithTooltip/ScheduledIconWithTooltip.d.ts +1 -1
- package/dist/types/components/SpaceName/SpaceName.d.ts +2 -2
- package/dist/types/entries/MultipleEntryReferenceEditor.d.ts +2 -2
- package/dist/types/entries/SingleEntryReferenceEditor.d.ts +2 -2
- package/dist/types/entries/WrappedEntryCard/FetchingWrappedEntryCard.d.ts +2 -2
- package/dist/types/entries/WrappedEntryCard/WrappedEntryCard.d.ts +1 -1
- package/dist/types/resources/Cards/ContentfulEntryCard.d.ts +2 -2
- package/dist/types/resources/Cards/ResourceCard.d.ts +2 -2
- package/dist/types/resources/MultipleResourceReferenceEditor.d.ts +2 -2
- package/dist/types/resources/SingleResourceReferenceEditor.d.ts +2 -2
- package/package.json +8 -5
|
@@ -8,13 +8,13 @@ Object.defineProperty(exports, "CombinedLinkActions", {
|
|
|
8
8
|
return CombinedLinkActions;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
14
|
const _CreateEntryLinkButton = require("../CreateEntryLinkButton/CreateEntryLinkButton");
|
|
15
15
|
const _LinkActions = require("./LinkActions");
|
|
16
16
|
const _NoLinkPermissionsInfo = require("./NoLinkPermissionsInfo");
|
|
17
|
-
const _redesignStyles =
|
|
17
|
+
const _redesignStyles = _interop_require_wildcard(require("./redesignStyles"));
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) {
|
|
19
19
|
if (typeof WeakMap !== "function") return null;
|
|
20
20
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -62,19 +62,16 @@ const testIds = {
|
|
|
62
62
|
};
|
|
63
63
|
function CombinedLinkActions(props) {
|
|
64
64
|
if (props.isFull) {
|
|
65
|
-
return null;
|
|
65
|
+
return null;
|
|
66
66
|
}
|
|
67
|
-
// We don't want to render a spacious container in case there are are already
|
|
68
|
-
// assets linked (in case of entries, always show it) as the border wouldn't be
|
|
69
|
-
// nicely aligned with asset cards.
|
|
70
67
|
const hideEmptyCard = props.entityType === 'Asset' && !props.isEmpty;
|
|
71
|
-
return
|
|
68
|
+
return _react.createElement("div", {
|
|
72
69
|
className: hideEmptyCard ? '' : _redesignStyles.container
|
|
73
|
-
}, !props.canCreateEntity && !props.canLinkEntity &&
|
|
70
|
+
}, !props.canCreateEntity && !props.canLinkEntity && _react.createElement(_NoLinkPermissionsInfo.NoLinkPermissionsInfo, null), props.entityType === 'Entry' && _react.createElement(CombinedEntryLinkActions, props), props.entityType === 'Asset' && _react.createElement(CombinedAssetLinkActions, props));
|
|
74
71
|
}
|
|
75
72
|
function CombinedEntryLinkActions(props) {
|
|
76
73
|
if (props.canCreateEntity) {
|
|
77
|
-
return
|
|
74
|
+
return _react.createElement(_CreateEntryLinkButton.CreateEntryLinkButton, {
|
|
78
75
|
testId: testIds.actionsWrapper,
|
|
79
76
|
disabled: props.isDisabled,
|
|
80
77
|
text: props.combinedActionsLabel || 'Add content',
|
|
@@ -87,7 +84,7 @@ function CombinedEntryLinkActions(props) {
|
|
|
87
84
|
onSelect: (contentTypeId)=>{
|
|
88
85
|
return contentTypeId ? props.onCreate(contentTypeId) : Promise.resolve();
|
|
89
86
|
},
|
|
90
|
-
customDropdownItems: props.canLinkEntity ?
|
|
87
|
+
customDropdownItems: props.canLinkEntity ? _react.createElement(_f36components.Menu.Item, {
|
|
91
88
|
testId: testIds.linkExisting,
|
|
92
89
|
onClick: ()=>{
|
|
93
90
|
props.onLinkExisting();
|
|
@@ -95,7 +92,7 @@ function CombinedEntryLinkActions(props) {
|
|
|
95
92
|
}, "Add existing content") : undefined
|
|
96
93
|
});
|
|
97
94
|
} else if (props.canLinkEntity) {
|
|
98
|
-
return
|
|
95
|
+
return _react.createElement(_f36components.Button, {
|
|
99
96
|
isDisabled: props.isDisabled,
|
|
100
97
|
testId: testIds.linkExisting,
|
|
101
98
|
className: _redesignStyles.action,
|
|
@@ -103,7 +100,7 @@ function CombinedEntryLinkActions(props) {
|
|
|
103
100
|
props.onLinkExisting();
|
|
104
101
|
},
|
|
105
102
|
variant: "secondary",
|
|
106
|
-
startIcon:
|
|
103
|
+
startIcon: _react.createElement(_f36icons.LinkIcon, null),
|
|
107
104
|
size: "small"
|
|
108
105
|
}, "Add existing content");
|
|
109
106
|
}
|
|
@@ -113,7 +110,7 @@ function CombinedAssetLinkActions(props) {
|
|
|
113
110
|
const [isOpen, setOpen] = _react.useState(false);
|
|
114
111
|
if (!props.canLinkEntity || !props.canCreateEntity) {
|
|
115
112
|
if (props.canLinkEntity) {
|
|
116
|
-
return
|
|
113
|
+
return _react.createElement(_f36components.Button, {
|
|
117
114
|
isDisabled: props.isDisabled,
|
|
118
115
|
testId: testIds.linkExisting,
|
|
119
116
|
className: _redesignStyles.action,
|
|
@@ -121,12 +118,12 @@ function CombinedAssetLinkActions(props) {
|
|
|
121
118
|
props.onLinkExisting();
|
|
122
119
|
},
|
|
123
120
|
variant: "secondary",
|
|
124
|
-
startIcon:
|
|
121
|
+
startIcon: _react.createElement(_f36icons.PlusIcon, null),
|
|
125
122
|
size: "small"
|
|
126
123
|
}, "Add existing media");
|
|
127
124
|
}
|
|
128
125
|
if (props.canCreateEntity) {
|
|
129
|
-
return
|
|
126
|
+
return _react.createElement(_f36components.Button, {
|
|
130
127
|
isDisabled: props.isDisabled,
|
|
131
128
|
testId: testIds.createAndLink,
|
|
132
129
|
className: _redesignStyles.action,
|
|
@@ -134,15 +131,13 @@ function CombinedAssetLinkActions(props) {
|
|
|
134
131
|
props.onCreate();
|
|
135
132
|
},
|
|
136
133
|
variant: "secondary",
|
|
137
|
-
startIcon:
|
|
134
|
+
startIcon: _react.createElement(_f36icons.PlusIcon, null),
|
|
138
135
|
size: "small"
|
|
139
136
|
}, "Add media");
|
|
140
137
|
}
|
|
141
138
|
return null;
|
|
142
139
|
}
|
|
143
|
-
|
|
144
|
-
// that works without content types to cover asset use-case.
|
|
145
|
-
return /*#__PURE__*/ _react.createElement(_f36components.Menu, {
|
|
140
|
+
return _react.createElement(_f36components.Menu, {
|
|
146
141
|
isOpen: isOpen,
|
|
147
142
|
onClose: ()=>{
|
|
148
143
|
setOpen(false);
|
|
@@ -150,22 +145,22 @@ function CombinedAssetLinkActions(props) {
|
|
|
150
145
|
onOpen: ()=>{
|
|
151
146
|
setOpen(true);
|
|
152
147
|
}
|
|
153
|
-
},
|
|
154
|
-
endIcon:
|
|
148
|
+
}, _react.createElement(_f36components.Menu.Trigger, null, _react.createElement(_f36components.Button, {
|
|
149
|
+
endIcon: _react.createElement(_f36icons.ChevronDownIcon, null),
|
|
155
150
|
isDisabled: props.isDisabled,
|
|
156
151
|
testId: testIds.actionsWrapper,
|
|
157
152
|
className: _redesignStyles.action,
|
|
158
153
|
variant: "secondary",
|
|
159
|
-
startIcon:
|
|
154
|
+
startIcon: _react.createElement(_f36icons.PlusIcon, null),
|
|
160
155
|
size: "small"
|
|
161
|
-
}, "Add media")), isOpen &&
|
|
156
|
+
}, "Add media")), isOpen && _react.createElement(_f36components.Menu.List, {
|
|
162
157
|
testId: testIds.dropdown
|
|
163
|
-
},
|
|
158
|
+
}, _react.createElement(_f36components.Menu.Item, {
|
|
164
159
|
testId: testIds.linkExisting,
|
|
165
160
|
onClick: ()=>{
|
|
166
161
|
props.onLinkExisting();
|
|
167
162
|
}
|
|
168
|
-
}, "Add existing media"),
|
|
163
|
+
}, "Add existing media"), _react.createElement(_f36components.Menu.Item, {
|
|
169
164
|
testId: testIds.createAndLink,
|
|
170
165
|
onClick: ()=>{
|
|
171
166
|
props.onCreate();
|
|
@@ -16,12 +16,12 @@ _export(exports, {
|
|
|
16
16
|
return testIds;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react =
|
|
19
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
20
20
|
const _f36components = require("@contentful/f36-components");
|
|
21
21
|
const _f36icons = require("@contentful/f36-icons");
|
|
22
22
|
const _CreateEntryLinkButton = require("../CreateEntryLinkButton/CreateEntryLinkButton");
|
|
23
23
|
const _NoLinkPermissionsInfo = require("./NoLinkPermissionsInfo");
|
|
24
|
-
const _styles =
|
|
24
|
+
const _styles = _interop_require_wildcard(require("./styles"));
|
|
25
25
|
function _getRequireWildcardCache(nodeInterop) {
|
|
26
26
|
if (typeof WeakMap !== "function") return null;
|
|
27
27
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -79,16 +79,16 @@ const testIds = {
|
|
|
79
79
|
};
|
|
80
80
|
function LinkActions(props) {
|
|
81
81
|
if (props.isFull) {
|
|
82
|
-
return null;
|
|
82
|
+
return null;
|
|
83
83
|
}
|
|
84
84
|
const defaultLabels = props.entityType === 'Entry' ? defaultEntryLabels : defaultAssetLabels;
|
|
85
85
|
const labels = {
|
|
86
86
|
...defaultLabels,
|
|
87
87
|
...props.actionLabels
|
|
88
88
|
};
|
|
89
|
-
return
|
|
89
|
+
return _react.createElement("div", {
|
|
90
90
|
className: _styles.container
|
|
91
|
-
}, props.canCreateEntity &&
|
|
91
|
+
}, props.canCreateEntity && _react.createElement(_react.Fragment, null, props.entityType === 'Entry' && _react.createElement(_CreateEntryLinkButton.CreateEntryLinkButton, {
|
|
92
92
|
testId: testIds.createAndLink,
|
|
93
93
|
disabled: props.isDisabled,
|
|
94
94
|
text: labels.createNew({
|
|
@@ -99,27 +99,27 @@ function LinkActions(props) {
|
|
|
99
99
|
onSelect: (contentTypeId)=>{
|
|
100
100
|
return contentTypeId ? props.onCreate(contentTypeId, props.itemsLength) : Promise.resolve();
|
|
101
101
|
}
|
|
102
|
-
}), props.entityType === 'Asset' &&
|
|
102
|
+
}), props.entityType === 'Asset' && _react.createElement(_f36components.Button, {
|
|
103
103
|
isDisabled: props.isDisabled,
|
|
104
104
|
testId: testIds.createAndLink,
|
|
105
105
|
onClick: ()=>{
|
|
106
106
|
props.onCreate(undefined, props.itemsLength);
|
|
107
107
|
},
|
|
108
108
|
variant: "secondary",
|
|
109
|
-
startIcon:
|
|
109
|
+
startIcon: _react.createElement(_f36icons.PlusIcon, null),
|
|
110
110
|
size: "small"
|
|
111
|
-
}, labels.createNew()),
|
|
111
|
+
}, labels.createNew()), _react.createElement("span", {
|
|
112
112
|
className: _styles.separator
|
|
113
|
-
})), props.canLinkEntity &&
|
|
113
|
+
})), props.canLinkEntity && _react.createElement(_f36components.Button, {
|
|
114
114
|
isDisabled: props.isDisabled,
|
|
115
115
|
testId: testIds.linkExisting,
|
|
116
116
|
onClick: ()=>{
|
|
117
117
|
props.onLinkExisting();
|
|
118
118
|
},
|
|
119
119
|
variant: "secondary",
|
|
120
|
-
startIcon:
|
|
120
|
+
startIcon: _react.createElement(_f36icons.LinkIcon, null),
|
|
121
121
|
size: "small"
|
|
122
122
|
}, labels.linkExisting({
|
|
123
123
|
canLinkMultiple: props.canLinkMultiple
|
|
124
|
-
})), !props.canCreateEntity && !props.canLinkEntity &&
|
|
124
|
+
})), !props.canCreateEntity && !props.canLinkEntity && _react.createElement(_NoLinkPermissionsInfo.NoLinkPermissionsInfo, null));
|
|
125
125
|
}
|
|
@@ -19,7 +19,7 @@ _export(exports, {
|
|
|
19
19
|
return useLinkActionsProps;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const _react =
|
|
22
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
23
23
|
const _CombinedLinkActions = require("./CombinedLinkActions");
|
|
24
24
|
const _helpers = require("./helpers");
|
|
25
25
|
const _LinkActions = require("./LinkActions");
|
|
@@ -80,8 +80,7 @@ function useLinkActionsProps(props) {
|
|
|
80
80
|
slide,
|
|
81
81
|
index
|
|
82
82
|
});
|
|
83
|
-
},
|
|
84
|
-
[
|
|
83
|
+
}, [
|
|
85
84
|
entityType,
|
|
86
85
|
props.onCreate,
|
|
87
86
|
props.onAction
|
|
@@ -96,8 +95,7 @@ function useLinkActionsProps(props) {
|
|
|
96
95
|
index: index === undefined ? undefined : index + i
|
|
97
96
|
});
|
|
98
97
|
});
|
|
99
|
-
},
|
|
100
|
-
[
|
|
98
|
+
}, [
|
|
101
99
|
entityType,
|
|
102
100
|
props.onLink,
|
|
103
101
|
props.onAction
|
|
@@ -129,8 +127,7 @@ function useLinkActionsProps(props) {
|
|
|
129
127
|
onLinkedExisting([
|
|
130
128
|
entity
|
|
131
129
|
], index);
|
|
132
|
-
},
|
|
133
|
-
[
|
|
130
|
+
}, [
|
|
134
131
|
sdk,
|
|
135
132
|
entityType,
|
|
136
133
|
onLinkedExisting
|
|
@@ -145,13 +142,11 @@ function useLinkActionsProps(props) {
|
|
|
145
142
|
return;
|
|
146
143
|
}
|
|
147
144
|
onLinkedExisting(entities, index);
|
|
148
|
-
},
|
|
149
|
-
[
|
|
145
|
+
}, [
|
|
150
146
|
sdk,
|
|
151
147
|
entityType,
|
|
152
148
|
onLinkedExisting
|
|
153
149
|
]);
|
|
154
|
-
// FIXME: The memoization might rerun every time due to the always changing callback identities above
|
|
155
150
|
return (0, _react.useMemo)(()=>({
|
|
156
151
|
entityType,
|
|
157
152
|
canLinkMultiple,
|
|
@@ -167,8 +162,7 @@ function useLinkActionsProps(props) {
|
|
|
167
162
|
onCreated,
|
|
168
163
|
onLinkedExisting,
|
|
169
164
|
itemsLength
|
|
170
|
-
}),
|
|
171
|
-
[
|
|
165
|
+
}), [
|
|
172
166
|
entityType,
|
|
173
167
|
canLinkMultiple,
|
|
174
168
|
isDisabled,
|
|
@@ -177,7 +171,6 @@ function useLinkActionsProps(props) {
|
|
|
177
171
|
editorPermissions.canCreateEntity,
|
|
178
172
|
editorPermissions.canLinkEntity,
|
|
179
173
|
actionLabels,
|
|
180
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
181
174
|
editorPermissions.creatableContentTypes.map((ct)=>ct.sys.id).join(':'),
|
|
182
175
|
onCreate,
|
|
183
176
|
onLinkExisting,
|
|
@@ -188,8 +181,8 @@ function useLinkActionsProps(props) {
|
|
|
188
181
|
]);
|
|
189
182
|
}
|
|
190
183
|
function LinkEntityActions({ renderCustomActions, ...props }) {
|
|
191
|
-
return renderCustomActions ? renderCustomActions(props) :
|
|
184
|
+
return renderCustomActions ? renderCustomActions(props) : _react.createElement(_LinkActions.LinkActions, props);
|
|
192
185
|
}
|
|
193
186
|
function CombinedLinkEntityActions({ renderCustomActions, ...props }) {
|
|
194
|
-
return renderCustomActions ? renderCustomActions(props) :
|
|
187
|
+
return renderCustomActions ? renderCustomActions(props) : _react.createElement(_CombinedLinkActions.CombinedLinkActions, props);
|
|
195
188
|
}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "NoLinkPermissionsInfo", {
|
|
|
8
8
|
return NoLinkPermissionsInfo;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -52,5 +52,5 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
function NoLinkPermissionsInfo() {
|
|
55
|
-
return
|
|
55
|
+
return _react.createElement(_f36components.Paragraph, null, "You don't have permission to view this content or this field is not correctly configured. Contact your administrator for help.");
|
|
56
56
|
}
|
|
@@ -46,8 +46,6 @@ async function selectSingleEntity(props) {
|
|
|
46
46
|
if (props.entityType === 'Entry') {
|
|
47
47
|
return await props.sdk.dialogs.selectSingleEntry({
|
|
48
48
|
locale: props.sdk.field.locale,
|
|
49
|
-
// readable CTs do not cover cases where user has partial access to a CT entry,
|
|
50
|
-
// e.g. via tags so we're passing in all available CTs (based on field validations)
|
|
51
49
|
contentTypes: getContentTypeIds(props.editorPermissions.availableContentTypes)
|
|
52
50
|
});
|
|
53
51
|
} else {
|
|
@@ -60,18 +58,11 @@ async function selectSingleEntity(props) {
|
|
|
60
58
|
async function selectMultipleEntities(props) {
|
|
61
59
|
const value = props.sdk.field.getValue();
|
|
62
60
|
const linkCount = Array.isArray(value) ? value.length : value ? 1 : 0;
|
|
63
|
-
// TODO: Why not always set `min: 1` by default? Does it make sense to enforce
|
|
64
|
-
// user to select as many entities as the field's "min" requires? What if e.g.
|
|
65
|
-
// "min" is 4 and the user wants to insert 2 entities first, then create 2 new ones?
|
|
66
61
|
const min = Math.max((props.editorPermissions.validations.numberOfLinks?.min || 1) - linkCount, 1);
|
|
67
|
-
// TODO: Consider same for max. If e.g. "max" is 4, we disable the button if the
|
|
68
|
-
// user wants to select 5 but we show no information why the button is disabled.
|
|
69
62
|
const max = (props.editorPermissions.validations.numberOfLinks?.max || +Infinity) - linkCount;
|
|
70
63
|
if (props.entityType === 'Entry') {
|
|
71
64
|
return await props.sdk.dialogs.selectMultipleEntries({
|
|
72
65
|
locale: props.sdk.field.locale,
|
|
73
|
-
// readable CTs do not cover cases where user has partial access to a CT entry,
|
|
74
|
-
// e.g. via tags so we're passing in all available CTs (based on field validations)
|
|
75
66
|
contentTypes: getContentTypeIds(props.editorPermissions.availableContentTypes),
|
|
76
67
|
min,
|
|
77
68
|
max
|
|
@@ -19,7 +19,7 @@ _export(exports, {
|
|
|
19
19
|
return container;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const _f36tokens =
|
|
22
|
+
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
23
23
|
const _emotion = require("emotion");
|
|
24
24
|
function _interop_require_default(obj) {
|
|
25
25
|
return obj && obj.__esModule ? obj : {
|
|
@@ -16,7 +16,7 @@ _export(exports, {
|
|
|
16
16
|
return separator;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _f36tokens =
|
|
19
|
+
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
20
20
|
const _emotion = require("emotion");
|
|
21
21
|
function _interop_require_default(obj) {
|
|
22
22
|
return obj && obj.__esModule ? obj : {
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "MissingEntityCard", {
|
|
|
8
8
|
return MissingEntityCard;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
|
-
const _styles =
|
|
14
|
+
const _styles = _interop_require_wildcard(require("./styles"));
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) {
|
|
16
16
|
if (typeof WeakMap !== "function") return null;
|
|
17
17
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -54,20 +54,20 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
54
54
|
return newObj;
|
|
55
55
|
}
|
|
56
56
|
function MissingEntityCard(props) {
|
|
57
|
-
return
|
|
57
|
+
return _react.createElement(_f36components.Card, {
|
|
58
58
|
className: _styles.card,
|
|
59
59
|
testId: "cf-ui-missing-entry-card",
|
|
60
60
|
isSelected: props.isSelected
|
|
61
|
-
},
|
|
61
|
+
}, _react.createElement(_f36components.Flex, {
|
|
62
62
|
alignItems: "center",
|
|
63
63
|
justifyContent: "space-between"
|
|
64
|
-
},
|
|
64
|
+
}, _react.createElement("div", {
|
|
65
65
|
className: props.asSquare ? _styles.squareCard : ''
|
|
66
|
-
},
|
|
66
|
+
}, _react.createElement(_f36components.SectionHeading, {
|
|
67
67
|
marginBottom: "none"
|
|
68
|
-
}, props.entityType, " is missing or inaccessible")), !props.isDisabled && props.onRemove &&
|
|
68
|
+
}, props.entityType, " is missing or inaccessible")), !props.isDisabled && props.onRemove && _react.createElement(_f36components.IconButton, {
|
|
69
69
|
variant: "transparent",
|
|
70
|
-
icon:
|
|
70
|
+
icon: _react.createElement(_f36icons.CloseIcon, {
|
|
71
71
|
variant: "muted"
|
|
72
72
|
}),
|
|
73
73
|
"aria-label": "Delete",
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "ResourceEntityErrorCard", {
|
|
|
8
8
|
return ResourceEntityErrorCard;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _EntityStore = require("../../common/EntityStore");
|
|
13
13
|
const _MissingEntityCard = require("../MissingEntityCard/MissingEntityCard");
|
|
14
14
|
const _UnsupportedEntityCard = require("./UnsupportedEntityCard");
|
|
@@ -55,12 +55,12 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
55
55
|
}
|
|
56
56
|
function ResourceEntityErrorCard(props) {
|
|
57
57
|
if ((0, _EntityStore.isUnsupportedError)(props.error)) {
|
|
58
|
-
return
|
|
58
|
+
return _react.createElement(_UnsupportedEntityCard.UnsupportedEntityCard, {
|
|
59
59
|
linkType: props.linkType,
|
|
60
60
|
isSelected: props.isSelected
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
return
|
|
63
|
+
return _react.createElement(_MissingEntityCard.MissingEntityCard, {
|
|
64
64
|
entityType: "Entry",
|
|
65
65
|
isDisabled: props.isDisabled,
|
|
66
66
|
isSelected: props.isSelected,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "UnsupportedEntityCard", {
|
|
|
8
8
|
return UnsupportedEntityCard;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _emotion = require("emotion");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -58,10 +58,10 @@ const styles = {
|
|
|
58
58
|
})
|
|
59
59
|
};
|
|
60
60
|
function UnsupportedEntityCard(props) {
|
|
61
|
-
return
|
|
61
|
+
return _react.createElement(_f36components.Card, {
|
|
62
62
|
className: styles.card,
|
|
63
63
|
isSelected: props.isSelected
|
|
64
|
-
},
|
|
64
|
+
}, _react.createElement(_f36components.SectionHeading, {
|
|
65
65
|
marginBottom: "none"
|
|
66
66
|
}, "Resource type ", props.linkType, " is currently not supported"));
|
|
67
67
|
}
|
|
@@ -16,7 +16,7 @@ _export(exports, {
|
|
|
16
16
|
return getScheduleTooltipContent;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _react =
|
|
19
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
20
20
|
const _f36components = require("@contentful/f36-components");
|
|
21
21
|
const _formatDateAndTime = require("./formatDateAndTime");
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -65,7 +65,7 @@ const getScheduleTooltipContent = ({ job, jobsCount })=>{
|
|
|
65
65
|
${jobsCount > 1 ? `+ ${jobsCount - 1} more` : ''}`;
|
|
66
66
|
};
|
|
67
67
|
const ScheduleTooltip = ({ job, jobsCount, children })=>{
|
|
68
|
-
return
|
|
68
|
+
return _react.createElement(_f36components.Tooltip, {
|
|
69
69
|
placement: "top",
|
|
70
70
|
testId: job.sys.id,
|
|
71
71
|
as: "div",
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "ScheduledIconWithTooltip", {
|
|
|
8
8
|
return ScheduledIconWithTooltip;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _ScheduleTooltip = require("./ScheduleTooltip");
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
14
14
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -67,9 +67,6 @@ const ScheduledIconWithTooltip = ({ entityType, entityId, getEntityScheduledActi
|
|
|
67
67
|
error: e
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
|
-
// This should only be ever called once. Following the eslint hint to add used
|
|
71
|
-
// dependencies will cause page freeze (infinite loop)
|
|
72
|
-
// eslint-disable-next-line -- TODO: describe this disable
|
|
73
70
|
}, []);
|
|
74
71
|
if (status.type === 'loading' || status.type === 'error') {
|
|
75
72
|
return null;
|
|
@@ -79,7 +76,7 @@ const ScheduledIconWithTooltip = ({ entityType, entityId, getEntityScheduledActi
|
|
|
79
76
|
return null;
|
|
80
77
|
}
|
|
81
78
|
const mostRelevantJob = jobs[0];
|
|
82
|
-
return
|
|
79
|
+
return _react.createElement(_ScheduleTooltip.ScheduleTooltip, {
|
|
83
80
|
job: mostRelevantJob,
|
|
84
81
|
jobsCount: jobs.length
|
|
85
82
|
}, children);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line -- TODO: describe this disable no-restricted-imports
|
|
2
1
|
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
@@ -20,7 +19,7 @@ _export(exports, {
|
|
|
20
19
|
return formatTime;
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
|
-
const _moment =
|
|
22
|
+
const _moment = _interop_require_default(require("moment"));
|
|
24
23
|
function _interop_require_default(obj) {
|
|
25
24
|
return obj && obj.__esModule ? obj : {
|
|
26
25
|
default: obj
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "SpaceName", {
|
|
|
8
8
|
return SpaceName;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _f36icons = require("@contentful/f36-icons");
|
|
14
|
-
const _f36tokens =
|
|
14
|
+
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
15
15
|
const _emotion = require("emotion");
|
|
16
16
|
function _interop_require_default(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : {
|
|
@@ -77,18 +77,18 @@ const styles = {
|
|
|
77
77
|
function SpaceName(props) {
|
|
78
78
|
let content = `Space: ${props.spaceName}`;
|
|
79
79
|
if (props.environmentName) content += ` (Env.: ${props.environmentName})`;
|
|
80
|
-
return
|
|
80
|
+
return _react.createElement(_f36components.Tooltip, {
|
|
81
81
|
placement: "top",
|
|
82
82
|
as: "div",
|
|
83
83
|
content: content
|
|
84
|
-
},
|
|
84
|
+
}, _react.createElement(_f36components.Flex, {
|
|
85
85
|
alignItems: "center",
|
|
86
86
|
gap: "spacingXs"
|
|
87
|
-
},
|
|
87
|
+
}, _react.createElement(_f36icons.FolderOpenTrimmedIcon, {
|
|
88
88
|
className: styles.spaceIcon,
|
|
89
89
|
size: "tiny",
|
|
90
90
|
"aria-label": "Source space"
|
|
91
|
-
}),
|
|
91
|
+
}), _react.createElement(_f36components.Text, {
|
|
92
92
|
className: styles.spaceName
|
|
93
93
|
}, props.spaceName)));
|
|
94
94
|
}
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "MultipleEntryReferenceEditor", {
|
|
|
8
8
|
return MultipleEntryReferenceEditor;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _sortable = require("@dnd-kit/sortable");
|
|
13
13
|
const _MultipleReferenceEditor = require("../common/MultipleReferenceEditor");
|
|
14
14
|
const _SortableLinkList = require("../common/SortableLinkList");
|
|
@@ -59,17 +59,17 @@ function MultipleEntryReferenceEditor(props) {
|
|
|
59
59
|
const updateBeforeSortStart = ({ index })=>{
|
|
60
60
|
setIndexToUpdate(index);
|
|
61
61
|
};
|
|
62
|
-
return
|
|
62
|
+
return _react.createElement(_MultipleReferenceEditor.MultipleReferenceEditor, {
|
|
63
63
|
...props,
|
|
64
64
|
entityType: "Entry",
|
|
65
65
|
setIndexToUpdate: setIndexToUpdate
|
|
66
|
-
}, (childrenProps)
|
|
66
|
+
}, (childrenProps)=>_react.createElement(_SortableLinkList.SortableLinkList, {
|
|
67
67
|
...childrenProps,
|
|
68
68
|
sortingStrategy: _sortable.verticalListSortingStrategy,
|
|
69
69
|
updateBeforeSortStart: updateBeforeSortStart
|
|
70
70
|
}, ({ items, item, index, isDisabled, DragHandle })=>{
|
|
71
71
|
const lastIndex = items.length - 1;
|
|
72
|
-
return
|
|
72
|
+
return _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
73
73
|
...childrenProps,
|
|
74
74
|
key: `${item.sys.id}-${index}`,
|
|
75
75
|
index: index,
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "SingleEntryReferenceEditor", {
|
|
|
8
8
|
return SingleEntryReferenceEditor;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react =
|
|
11
|
+
const _react = _interop_require_wildcard(require("react"));
|
|
12
12
|
const _SingleReferenceEditor = require("../common/SingleReferenceEditor");
|
|
13
13
|
const _FetchingWrappedEntryCard = require("./WrappedEntryCard/FetchingWrappedEntryCard");
|
|
14
14
|
function _getRequireWildcardCache(nodeInterop) {
|
|
@@ -53,11 +53,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
53
53
|
return newObj;
|
|
54
54
|
}
|
|
55
55
|
function SingleEntryReferenceEditor(props) {
|
|
56
|
-
return
|
|
56
|
+
return _react.createElement(_SingleReferenceEditor.SingleReferenceEditor, {
|
|
57
57
|
...props,
|
|
58
58
|
entityType: "Entry"
|
|
59
59
|
}, ({ allContentTypes, isDisabled, entityId, setValue, renderCustomCard, hasCardRemoveActions, hasCardEditActions })=>{
|
|
60
|
-
return
|
|
60
|
+
return _react.createElement(_FetchingWrappedEntryCard.FetchingWrappedEntryCard, {
|
|
61
61
|
...props,
|
|
62
62
|
allContentTypes: allContentTypes,
|
|
63
63
|
isDisabled: isDisabled,
|