@contentful/field-editor-reference 4.3.8 → 4.3.11
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 +14 -0
- package/dist/field-editor-reference.cjs.development.js +34 -36
- 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 +34 -36
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -2,8 +2,8 @@ import React__default, { useState, useRef, useEffect, createElement, Fragment, u
|
|
|
2
2
|
import { css } from 'emotion';
|
|
3
3
|
import tokens from '@contentful/f36-tokens';
|
|
4
4
|
import get from 'lodash-es/get';
|
|
5
|
-
import { SearchIcon, PlusIcon, ChevronDownIcon, LinkIcon, CloseIcon, ClockIcon } from '@contentful/f36-icons';
|
|
6
5
|
import { Menu, TextInput, Button, Paragraph, Card, SectionHeading, IconButton, Tooltip, EntryCard, MenuItem, MenuDivider, Text, AssetCard } from '@contentful/f36-components';
|
|
6
|
+
import { SearchIcon, PlusIcon, ChevronDownIcon, LinkIcon, CloseIcon, ClockIcon } from '@contentful/f36-icons';
|
|
7
7
|
import moment from 'moment';
|
|
8
8
|
import deepEqual from 'deep-equal';
|
|
9
9
|
import { FieldConnector, isValidImage, entityHelpers, shortenStorageUnit } from '@contentful/field-editor-shared';
|
|
@@ -108,20 +108,10 @@ var styles = {
|
|
|
108
108
|
position: 'relative',
|
|
109
109
|
padding: "0 " + tokens.spacing2Xs
|
|
110
110
|
}),
|
|
111
|
-
searchInput:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
borderRadius: parentHasDropdown ? 0 : undefined,
|
|
116
|
-
borderLeft: parentHasDropdown ? 'none' : undefined,
|
|
117
|
-
borderRight: parentHasDropdown ? 'none' : undefined,
|
|
118
|
-
paddingRight: tokens.spacing2Xl,
|
|
119
|
-
'::placeholder': {
|
|
120
|
-
color: tokens.gray600
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
},
|
|
111
|
+
searchInput: /*#__PURE__*/css({
|
|
112
|
+
paddingRight: tokens.spacingXl,
|
|
113
|
+
textOverflow: 'ellipsis'
|
|
114
|
+
}),
|
|
125
115
|
searchIcon: /*#__PURE__*/css({
|
|
126
116
|
position: 'absolute',
|
|
127
117
|
right: tokens.spacingM,
|
|
@@ -270,7 +260,7 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
270
260
|
ref: textField,
|
|
271
261
|
className: styles.inputWrapper
|
|
272
262
|
}, React__default.createElement(TextInput, {
|
|
273
|
-
className: styles.searchInput
|
|
263
|
+
className: styles.searchInput,
|
|
274
264
|
placeholder: "Search all content types",
|
|
275
265
|
testId: "add-entry-menu-search",
|
|
276
266
|
value: searchInput,
|
|
@@ -1541,7 +1531,8 @@ function useLinkActionsProps(props) {
|
|
|
1541
1531
|
slide: slide,
|
|
1542
1532
|
index: index
|
|
1543
1533
|
});
|
|
1544
|
-
},
|
|
1534
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
1535
|
+
[entityType, props.onCreate, props.onAction]);
|
|
1545
1536
|
var onLinkedExisting = useCallback(function (entities, index) {
|
|
1546
1537
|
if (index === void 0) {
|
|
1547
1538
|
index = itemsLength;
|
|
@@ -1558,7 +1549,8 @@ function useLinkActionsProps(props) {
|
|
|
1558
1549
|
index: index === undefined ? undefined : index + i
|
|
1559
1550
|
});
|
|
1560
1551
|
});
|
|
1561
|
-
},
|
|
1552
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
1553
|
+
[entityType, props.onLink, props.onAction]);
|
|
1562
1554
|
var onCreate = useCallback( /*#__PURE__*/function () {
|
|
1563
1555
|
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(contentTypeId, index) {
|
|
1564
1556
|
var _yield$createEntity, entity, slide;
|
|
@@ -1680,7 +1672,7 @@ function useLinkActionsProps(props) {
|
|
|
1680
1672
|
return function onLinkSeveralExisting(_x4) {
|
|
1681
1673
|
return _ref3.apply(this, arguments);
|
|
1682
1674
|
};
|
|
1683
|
-
}(); // FIXME: The memoization might rerun every time due to the always changing callback identities above
|
|
1675
|
+
}(); // FIXME: The memoization might rerun every time due to the always changing callback identities above
|
|
1684
1676
|
|
|
1685
1677
|
|
|
1686
1678
|
return useMemo(function () {
|
|
@@ -1700,7 +1692,9 @@ function useLinkActionsProps(props) {
|
|
|
1700
1692
|
onLinkedExisting: onLinkedExisting,
|
|
1701
1693
|
itemsLength: itemsLength
|
|
1702
1694
|
};
|
|
1703
|
-
},
|
|
1695
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
1696
|
+
[entityType, canLinkMultiple, isDisabled, isEmpty, isFull, editorPermissions.canCreateEntity, editorPermissions.canLinkEntity, actionLabels, // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
1697
|
+
editorPermissions.creatableContentTypes.map(function (ct) {
|
|
1704
1698
|
return ct.sys.id;
|
|
1705
1699
|
}).join(':'), onCreate, onLinkExisting, onLinkSeveralExisting, onCreated, onLinkedExisting, itemsLength]);
|
|
1706
1700
|
}
|
|
@@ -1714,7 +1708,7 @@ function LinkEntityActions(_ref4) {
|
|
|
1714
1708
|
return renderLinkActions(props);
|
|
1715
1709
|
}
|
|
1716
1710
|
|
|
1717
|
-
// eslint-disable-next-line no-restricted-imports
|
|
1711
|
+
// eslint-disable-next-line -- TODO: describe this disable no-restricted-imports
|
|
1718
1712
|
/**
|
|
1719
1713
|
* @param {Date|string} date A valid constructor argument for moment()
|
|
1720
1714
|
* @param {boolean=} short Render only Today/Tomorrow/Yesterday if valid. Defaults to false
|
|
@@ -1794,7 +1788,7 @@ var ScheduledIconWithTooltip = function ScheduledIconWithTooltip(_ref) {
|
|
|
1794
1788
|
});
|
|
1795
1789
|
}); // This should only be ever called once. Following the eslint hint to add used
|
|
1796
1790
|
// dependencies will cause page freeze (infinite loop)
|
|
1797
|
-
// eslint-disable-next-line
|
|
1791
|
+
// eslint-disable-next-line -- TODO: describe this disable
|
|
1798
1792
|
}, []);
|
|
1799
1793
|
|
|
1800
1794
|
if (status.type === 'loading' || status.type === 'error') {
|
|
@@ -1990,7 +1984,7 @@ function useEntitiesStore(props) {
|
|
|
1990
1984
|
}
|
|
1991
1985
|
});
|
|
1992
1986
|
}
|
|
1993
|
-
});
|
|
1987
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
1994
1988
|
}, [props.sdk, state.assets, state.entries]);
|
|
1995
1989
|
return _extends({
|
|
1996
1990
|
getOrLoadEntry: getOrLoadEntry,
|
|
@@ -2172,7 +2166,7 @@ function useContentTypePermissions(props) {
|
|
|
2172
2166
|
return _checkContentTypeAccess.apply(this, arguments);
|
|
2173
2167
|
}
|
|
2174
2168
|
|
|
2175
|
-
void checkContentTypeAccess();
|
|
2169
|
+
void checkContentTypeAccess(); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2176
2170
|
}, [availableContentTypes]);
|
|
2177
2171
|
return {
|
|
2178
2172
|
creatableContentTypes: creatableContentTypes,
|
|
@@ -2184,7 +2178,7 @@ function useContentTypePermissions(props) {
|
|
|
2184
2178
|
function fromFieldValidations(field) {
|
|
2185
2179
|
var _field$items$validati, _field$items, _linkContentTypeValid, _linkMimetypeGroupVal;
|
|
2186
2180
|
|
|
2187
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2181
|
+
// eslint-disable-next-line -- TODO: describe this disable @typescript-eslint/no-explicit-any
|
|
2188
2182
|
var validations = [].concat(field.validations, (_field$items$validati = (_field$items = field.items) == null ? void 0 : _field$items.validations) != null ? _field$items$validati : []);
|
|
2189
2183
|
var linkContentTypeValidations = validations.find(function (v) {
|
|
2190
2184
|
return 'linkContentType' in v;
|
|
@@ -2312,7 +2306,7 @@ function useEditorPermissions(props) {
|
|
|
2312
2306
|
return _checkCreateAccess.apply(this, arguments);
|
|
2313
2307
|
}
|
|
2314
2308
|
|
|
2315
|
-
void checkCreateAccess();
|
|
2309
|
+
void checkCreateAccess(); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2316
2310
|
}, [entityType, parameters.instance, creatableContentTypes]);
|
|
2317
2311
|
useEffect(function () {
|
|
2318
2312
|
if (parameters.instance.showLinkEntityAction === false) {
|
|
@@ -2374,7 +2368,7 @@ function useEditorPermissions(props) {
|
|
|
2374
2368
|
return _checkLinkAccess.apply(this, arguments);
|
|
2375
2369
|
}
|
|
2376
2370
|
|
|
2377
|
-
void checkLinkAccess();
|
|
2371
|
+
void checkLinkAccess(); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2378
2372
|
}, [entityType, parameters.instance, readableContentTypes]);
|
|
2379
2373
|
return {
|
|
2380
2374
|
canCreateEntity: canCreateEntity,
|
|
@@ -2418,7 +2412,8 @@ function Editor(props) {
|
|
|
2418
2412
|
|
|
2419
2413
|
var customCardRenderer = useCallback(function (cardProps, _, renderDefaultCard) {
|
|
2420
2414
|
return props.renderCustomCard ? props.renderCustomCard(cardProps, linkActionsProps, renderDefaultCard) : false;
|
|
2421
|
-
},
|
|
2415
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2416
|
+
[linkActionsProps]);
|
|
2422
2417
|
|
|
2423
2418
|
if (!props.entityId) {
|
|
2424
2419
|
return createElement(LinkEntityActions, Object.assign({
|
|
@@ -2637,7 +2632,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2637
2632
|
entries = _useEntities.entries;
|
|
2638
2633
|
|
|
2639
2634
|
useEffect(function () {
|
|
2640
|
-
getOrLoadEntry(props.entryId);
|
|
2635
|
+
getOrLoadEntry(props.entryId); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2641
2636
|
}, [props.entryId]);
|
|
2642
2637
|
var size = props.viewType === 'link' ? 'small' : 'default';
|
|
2643
2638
|
var entry = entries[props.entryId];
|
|
@@ -2695,7 +2690,8 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2695
2690
|
type: 'rendered',
|
|
2696
2691
|
entity: 'Entry'
|
|
2697
2692
|
});
|
|
2698
|
-
}
|
|
2693
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2694
|
+
|
|
2699
2695
|
}, [entry]);
|
|
2700
2696
|
return useMemo(function () {
|
|
2701
2697
|
if (entry === 'failed') {
|
|
@@ -2769,7 +2765,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2769
2765
|
}
|
|
2770
2766
|
}
|
|
2771
2767
|
|
|
2772
|
-
return renderDefaultCard();
|
|
2768
|
+
return renderDefaultCard(); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2773
2769
|
}, [props, entityKey]);
|
|
2774
2770
|
}
|
|
2775
2771
|
|
|
@@ -2868,7 +2864,8 @@ function Editor$1(props) {
|
|
|
2868
2864
|
}));
|
|
2869
2865
|
var customCardRenderer = useCallback(function (cardProps, _, renderDefaultCard) {
|
|
2870
2866
|
return props.renderCustomCard ? props.renderCustomCard(cardProps, linkActionsProps, renderDefaultCard) : false;
|
|
2871
|
-
},
|
|
2867
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
2868
|
+
[linkActionsProps]);
|
|
2872
2869
|
return createElement(Fragment, null, props.children(_extends({}, props, {
|
|
2873
2870
|
onSortStart: onSortStart,
|
|
2874
2871
|
onSortEnd: onSortEnd,
|
|
@@ -3039,7 +3036,7 @@ var styles$3 = {
|
|
|
3039
3036
|
};
|
|
3040
3037
|
var defaultProps$1 = {
|
|
3041
3038
|
isClickable: true
|
|
3042
|
-
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3039
|
+
}; // eslint-disable-next-line -- TODO: describe this disable @typescript-eslint/no-explicit-any
|
|
3043
3040
|
|
|
3044
3041
|
function getFileType(file) {
|
|
3045
3042
|
if (!file) {
|
|
@@ -3200,7 +3197,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3200
3197
|
assets = _useEntities.assets;
|
|
3201
3198
|
|
|
3202
3199
|
useEffect(function () {
|
|
3203
|
-
getOrLoadAsset(props.assetId);
|
|
3200
|
+
getOrLoadAsset(props.assetId); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
3204
3201
|
}, [props.assetId]);
|
|
3205
3202
|
var asset = assets[props.assetId];
|
|
3206
3203
|
var entityKey = asset === 'failed' ? 'failed' : asset === undefined ? 'undefined' : ":" + asset.sys.id + ":" + asset.sys.version;
|
|
@@ -3210,7 +3207,8 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3210
3207
|
type: 'rendered',
|
|
3211
3208
|
entity: 'Asset'
|
|
3212
3209
|
});
|
|
3213
|
-
}
|
|
3210
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
3211
|
+
|
|
3214
3212
|
}, [asset]);
|
|
3215
3213
|
|
|
3216
3214
|
var onEdit = /*#__PURE__*/function () {
|
|
@@ -3342,7 +3340,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3342
3340
|
}
|
|
3343
3341
|
}
|
|
3344
3342
|
|
|
3345
|
-
return renderDefaultCard();
|
|
3343
|
+
return renderDefaultCard(); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
3346
3344
|
}, [props, entityKey]);
|
|
3347
3345
|
}
|
|
3348
3346
|
|