@contentful/field-editor-reference 4.6.0 → 4.6.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 +6 -0
- package/dist/common/SortableLinkList.d.ts +1 -1
- package/dist/field-editor-reference.cjs.development.js +43 -29
- package/dist/field-editor-reference.cjs.development.js.map +1 -1
- package/dist/field-editor-reference.cjs.production.min.js +1 -1
- package/dist/field-editor-reference.cjs.production.min.js.map +1 -1
- package/dist/field-editor-reference.esm.js +43 -29
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -3295,8 +3295,7 @@ var styles$3 = {
|
|
|
3295
3295
|
position: 'relative'
|
|
3296
3296
|
}),
|
|
3297
3297
|
item: /*#__PURE__*/css({
|
|
3298
|
-
marginBottom: tokens.spacingM
|
|
3299
|
-
marginRight: tokens.spacingM
|
|
3298
|
+
marginBottom: tokens.spacingM
|
|
3300
3299
|
})
|
|
3301
3300
|
};
|
|
3302
3301
|
|
|
@@ -3316,50 +3315,58 @@ var SortableLinkListInternal = /*#__PURE__*/SortableContainer(function (props) {
|
|
|
3316
3315
|
return React__default.createElement("div", {
|
|
3317
3316
|
className: cx(styles$3.container, props.className)
|
|
3318
3317
|
}, props.items.map(function (item, index) {
|
|
3319
|
-
var _item$sys$
|
|
3318
|
+
var _item$sys$urn;
|
|
3320
3319
|
|
|
3321
3320
|
return React__default.createElement(SortableLink, {
|
|
3322
3321
|
disabled: props.isDisabled,
|
|
3323
|
-
key: ((_item$sys$
|
|
3322
|
+
key: ((_item$sys$urn = item.sys.urn) != null ? _item$sys$urn : item.sys.id) + "-" + index,
|
|
3324
3323
|
index: index
|
|
3325
|
-
}, props.children(
|
|
3324
|
+
}, props.children({
|
|
3325
|
+
items: props.items,
|
|
3326
|
+
isDisabled: props.isDisabled,
|
|
3326
3327
|
item: item,
|
|
3327
3328
|
index: index,
|
|
3328
3329
|
DragHandle: props.isDisabled ? undefined : DragHandle
|
|
3329
|
-
}))
|
|
3330
|
+
}));
|
|
3330
3331
|
}));
|
|
3331
3332
|
}); // HOC does not support generics, so we mimic it via additional component
|
|
3332
3333
|
|
|
3333
3334
|
function SortableLinkList(props) {
|
|
3334
|
-
return React__default.createElement(SortableLinkListInternal, Object.assign({}, props,
|
|
3335
|
-
children: props.children
|
|
3336
|
-
}));
|
|
3335
|
+
return React__default.createElement(SortableLinkListInternal, Object.assign({}, props), props.children);
|
|
3337
3336
|
}
|
|
3338
3337
|
|
|
3339
3338
|
function MultipleEntryReferenceEditor(props) {
|
|
3340
3339
|
return createElement(MultipleReferenceEditor, Object.assign({}, props, {
|
|
3341
3340
|
entityType: "Entry"
|
|
3342
3341
|
}), function (childrenProps) {
|
|
3343
|
-
return createElement(SortableLinkList, Object.assign({}, childrenProps
|
|
3344
|
-
|
|
3342
|
+
return createElement(SortableLinkList, Object.assign({}, props, childrenProps, {
|
|
3343
|
+
axis: "y",
|
|
3344
|
+
useDragHandle: true
|
|
3345
|
+
}), function (_ref) {
|
|
3346
|
+
var items = _ref.items,
|
|
3347
|
+
item = _ref.item,
|
|
3348
|
+
index = _ref.index,
|
|
3349
|
+
isDisabled = _ref.isDisabled,
|
|
3350
|
+
DragHandle = _ref.DragHandle;
|
|
3351
|
+
var lastIndex = items.length - 1;
|
|
3345
3352
|
return createElement(FetchingWrappedEntryCard, Object.assign({}, props, {
|
|
3346
|
-
key:
|
|
3347
|
-
index:
|
|
3353
|
+
key: item.sys.id + "-" + index,
|
|
3354
|
+
index: index,
|
|
3348
3355
|
allContentTypes: childrenProps.allContentTypes,
|
|
3349
|
-
isDisabled:
|
|
3350
|
-
entryId:
|
|
3356
|
+
isDisabled: isDisabled,
|
|
3357
|
+
entryId: item.sys.id,
|
|
3351
3358
|
onRemove: function onRemove() {
|
|
3352
|
-
childrenProps.setValue(
|
|
3353
|
-
return i !==
|
|
3359
|
+
childrenProps.setValue(items.filter(function (_value, i) {
|
|
3360
|
+
return i !== index;
|
|
3354
3361
|
}));
|
|
3355
3362
|
},
|
|
3356
|
-
onMoveTop:
|
|
3357
|
-
return childrenProps.onMove(
|
|
3363
|
+
onMoveTop: index !== 0 ? function () {
|
|
3364
|
+
return childrenProps.onMove(index, 0);
|
|
3358
3365
|
} : undefined,
|
|
3359
|
-
onMoveBottom:
|
|
3360
|
-
return childrenProps.onMove(
|
|
3366
|
+
onMoveBottom: index !== lastIndex ? function () {
|
|
3367
|
+
return childrenProps.onMove(index, lastIndex);
|
|
3361
3368
|
} : undefined,
|
|
3362
|
-
renderDragHandle:
|
|
3369
|
+
renderDragHandle: DragHandle
|
|
3363
3370
|
}));
|
|
3364
3371
|
});
|
|
3365
3372
|
});
|
|
@@ -3786,17 +3793,24 @@ function MultipleMediaEditor(props) {
|
|
|
3786
3793
|
|
|
3787
3794
|
return createElement(SortableLinkList, Object.assign({}, childrenProps, {
|
|
3788
3795
|
className: cx((_cx = {}, _cx[styles$6.gridContainer] = childrenProps.viewType === 'card', _cx)),
|
|
3789
|
-
axis: childrenProps.viewType === 'card' ? 'xy' : 'y'
|
|
3790
|
-
|
|
3796
|
+
axis: childrenProps.viewType === 'card' ? 'xy' : 'y',
|
|
3797
|
+
useDragHandle: true
|
|
3798
|
+
}), function (_ref) {
|
|
3799
|
+
var items = _ref.items,
|
|
3800
|
+
item = _ref.item,
|
|
3801
|
+
index = _ref.index,
|
|
3802
|
+
isDisabled = _ref.isDisabled,
|
|
3803
|
+
DragHandle = _ref.DragHandle;
|
|
3791
3804
|
return createElement(FetchingWrappedAssetCard, Object.assign({}, props, {
|
|
3792
|
-
|
|
3793
|
-
|
|
3805
|
+
isDisabled: isDisabled,
|
|
3806
|
+
key: item.sys.id + "-" + index,
|
|
3807
|
+
assetId: item.sys.id,
|
|
3794
3808
|
onRemove: function onRemove() {
|
|
3795
|
-
childrenProps.setValue(
|
|
3796
|
-
return i !==
|
|
3809
|
+
childrenProps.setValue(items.filter(function (_value, i) {
|
|
3810
|
+
return i !== index;
|
|
3797
3811
|
}));
|
|
3798
3812
|
},
|
|
3799
|
-
renderDragHandle:
|
|
3813
|
+
renderDragHandle: DragHandle
|
|
3800
3814
|
}));
|
|
3801
3815
|
});
|
|
3802
3816
|
});
|