@contentful/field-editor-reference 4.6.0 → 4.6.3
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 +18 -0
- package/dist/common/SortableLinkList.d.ts +1 -1
- package/dist/field-editor-reference.cjs.development.js +49 -31
- 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 +49 -31
- 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,62 @@ 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
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3335
|
+
// with the default distance of 0 the drag start event is "confused" with the click event,
|
|
3336
|
+
// so the latter one isn't fired and click handlers on child elements don't work
|
|
3337
|
+
return React__default.createElement(SortableLinkListInternal, Object.assign({
|
|
3338
|
+
distance: 1
|
|
3339
|
+
}, props), props.children);
|
|
3337
3340
|
}
|
|
3338
3341
|
|
|
3339
3342
|
function MultipleEntryReferenceEditor(props) {
|
|
3340
3343
|
return createElement(MultipleReferenceEditor, Object.assign({}, props, {
|
|
3341
3344
|
entityType: "Entry"
|
|
3342
3345
|
}), function (childrenProps) {
|
|
3343
|
-
return createElement(SortableLinkList, Object.assign({}, childrenProps
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3346
|
+
return createElement(SortableLinkList, Object.assign({}, childrenProps, {
|
|
3347
|
+
axis: "y",
|
|
3348
|
+
useDragHandle: true
|
|
3349
|
+
}), function (_ref) {
|
|
3350
|
+
var items = _ref.items,
|
|
3351
|
+
item = _ref.item,
|
|
3352
|
+
index = _ref.index,
|
|
3353
|
+
isDisabled = _ref.isDisabled,
|
|
3354
|
+
DragHandle = _ref.DragHandle;
|
|
3355
|
+
var lastIndex = items.length - 1;
|
|
3356
|
+
return createElement(FetchingWrappedEntryCard, Object.assign({}, childrenProps, {
|
|
3357
|
+
key: item.sys.id + "-" + index,
|
|
3358
|
+
index: index,
|
|
3348
3359
|
allContentTypes: childrenProps.allContentTypes,
|
|
3349
|
-
isDisabled:
|
|
3350
|
-
entryId:
|
|
3360
|
+
isDisabled: isDisabled,
|
|
3361
|
+
entryId: item.sys.id,
|
|
3351
3362
|
onRemove: function onRemove() {
|
|
3352
|
-
childrenProps.setValue(
|
|
3353
|
-
return i !==
|
|
3363
|
+
childrenProps.setValue(items.filter(function (_value, i) {
|
|
3364
|
+
return i !== index;
|
|
3354
3365
|
}));
|
|
3355
3366
|
},
|
|
3356
|
-
onMoveTop:
|
|
3357
|
-
return childrenProps.onMove(
|
|
3367
|
+
onMoveTop: index !== 0 ? function () {
|
|
3368
|
+
return childrenProps.onMove(index, 0);
|
|
3358
3369
|
} : undefined,
|
|
3359
|
-
onMoveBottom:
|
|
3360
|
-
return childrenProps.onMove(
|
|
3370
|
+
onMoveBottom: index !== lastIndex ? function () {
|
|
3371
|
+
return childrenProps.onMove(index, lastIndex);
|
|
3361
3372
|
} : undefined,
|
|
3362
|
-
renderDragHandle:
|
|
3373
|
+
renderDragHandle: DragHandle
|
|
3363
3374
|
}));
|
|
3364
3375
|
});
|
|
3365
3376
|
});
|
|
@@ -3786,17 +3797,24 @@ function MultipleMediaEditor(props) {
|
|
|
3786
3797
|
|
|
3787
3798
|
return createElement(SortableLinkList, Object.assign({}, childrenProps, {
|
|
3788
3799
|
className: cx((_cx = {}, _cx[styles$6.gridContainer] = childrenProps.viewType === 'card', _cx)),
|
|
3789
|
-
axis: childrenProps.viewType === 'card' ? 'xy' : 'y'
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3800
|
+
axis: childrenProps.viewType === 'card' ? 'xy' : 'y',
|
|
3801
|
+
useDragHandle: true
|
|
3802
|
+
}), function (_ref) {
|
|
3803
|
+
var items = _ref.items,
|
|
3804
|
+
item = _ref.item,
|
|
3805
|
+
index = _ref.index,
|
|
3806
|
+
isDisabled = _ref.isDisabled,
|
|
3807
|
+
DragHandle = _ref.DragHandle;
|
|
3808
|
+
return createElement(FetchingWrappedAssetCard, Object.assign({}, childrenProps, {
|
|
3809
|
+
isDisabled: isDisabled,
|
|
3810
|
+
key: item.sys.id + "-" + index,
|
|
3811
|
+
assetId: item.sys.id,
|
|
3794
3812
|
onRemove: function onRemove() {
|
|
3795
|
-
childrenProps.setValue(
|
|
3796
|
-
return i !==
|
|
3813
|
+
childrenProps.setValue(items.filter(function (_value, i) {
|
|
3814
|
+
return i !== index;
|
|
3797
3815
|
}));
|
|
3798
3816
|
},
|
|
3799
|
-
renderDragHandle:
|
|
3817
|
+
renderDragHandle: DragHandle
|
|
3800
3818
|
}));
|
|
3801
3819
|
});
|
|
3802
3820
|
});
|