@contentful/field-editor-reference 2.21.2 → 4.0.2
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 +76 -415
- package/dist/assets/WrappedAssetCard/AssetCardActions.d.ts +2 -2
- package/dist/assets/WrappedAssetCard/FetchingWrappedAssetCard.d.ts +3 -3
- package/dist/assets/WrappedAssetCard/WrappedAssetCard.d.ts +3 -3
- package/dist/assets/WrappedAssetCard/WrappedAssetLink.d.ts +3 -3
- package/dist/common/customCardTypes.d.ts +2 -2
- package/dist/components/CreateEntryLinkButton/CreateEntryLinkButton.d.ts +2 -3
- package/dist/components/CreateEntryLinkButton/CreateEntryMenuTrigger.d.ts +2 -3
- package/dist/components/ScheduledIconWithTooltip/ScheduleTooltip.d.ts +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/entries/WrappedEntryCard/FetchingWrappedEntryCard.d.ts +3 -3
- package/dist/entries/WrappedEntryCard/WrappedEntryCard.d.ts +3 -3
- package/dist/field-editor-reference.cjs.development.js +270 -355
- 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 +258 -343
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +5 -0
- package/package.json +7 -6
|
@@ -6,10 +6,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var React__default = _interopDefault(React);
|
|
9
|
-
var forma36ReactComponents = require('@contentful/forma-36-react-components');
|
|
10
9
|
var emotion = require('emotion');
|
|
11
|
-
var tokens = _interopDefault(require('@contentful/
|
|
10
|
+
var tokens = _interopDefault(require('@contentful/f36-tokens'));
|
|
12
11
|
var get = _interopDefault(require('lodash/get'));
|
|
12
|
+
var f36Icons = require('@contentful/f36-icons');
|
|
13
|
+
var f36Components = require('@contentful/f36-components');
|
|
13
14
|
var moment = _interopDefault(require('moment'));
|
|
14
15
|
var deepEqual = _interopDefault(require('deep-equal'));
|
|
15
16
|
var fieldEditorShared = require('@contentful/field-editor-shared');
|
|
@@ -100,21 +101,20 @@ var action = /*#__PURE__*/emotion.css({
|
|
|
100
101
|
fontWeight: 'bold'
|
|
101
102
|
});
|
|
102
103
|
|
|
103
|
-
var useGlobalMouseUp = function useGlobalMouseUp(handler) {
|
|
104
|
-
React.useEffect(function () {
|
|
105
|
-
document.addEventListener('mouseup', handler);
|
|
106
|
-
return function () {
|
|
107
|
-
return document.removeEventListener('mouseup', handler);
|
|
108
|
-
};
|
|
109
|
-
}, [handler]);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
104
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
113
105
|
var MAX_ITEMS_WITHOUT_SEARCH = 20;
|
|
106
|
+
var menuPlacementMap = {
|
|
107
|
+
'bottom-left': 'bottom-start',
|
|
108
|
+
'bottom-right': 'bottom-end'
|
|
109
|
+
};
|
|
114
110
|
var styles = {
|
|
115
111
|
wrapper: /*#__PURE__*/emotion.css({
|
|
116
112
|
position: 'relative'
|
|
117
113
|
}),
|
|
114
|
+
inputWrapper: /*#__PURE__*/emotion.css({
|
|
115
|
+
position: 'relative',
|
|
116
|
+
padding: "0 " + tokens.spacing2Xs
|
|
117
|
+
}),
|
|
118
118
|
searchInput: function searchInput(parentHasDropdown) {
|
|
119
119
|
return emotion.css({
|
|
120
120
|
'& > input': {
|
|
@@ -154,7 +154,7 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
154
154
|
dropdownSettings = _ref$dropdownSettings === void 0 ? {
|
|
155
155
|
position: 'bottom-left'
|
|
156
156
|
} : _ref$dropdownSettings,
|
|
157
|
-
|
|
157
|
+
customDropdownItems = _ref.customDropdownItems,
|
|
158
158
|
children = _ref.children;
|
|
159
159
|
|
|
160
160
|
var _useState = React.useState(false),
|
|
@@ -171,7 +171,7 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
171
171
|
|
|
172
172
|
var wrapper = React.useRef(null);
|
|
173
173
|
var textField = React.useRef(null);
|
|
174
|
-
var
|
|
174
|
+
var menuListRef = React.useRef(null);
|
|
175
175
|
/*
|
|
176
176
|
By default, dropdown wraps it's content, so it's width = the width of the widest item
|
|
177
177
|
During search, menu items change, and so the widest menu item can change
|
|
@@ -181,11 +181,11 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
181
181
|
That it had on initial mount and that fits any menu item in has
|
|
182
182
|
*/
|
|
183
183
|
|
|
184
|
-
var _useState4 = React.useState(
|
|
184
|
+
var _useState4 = React.useState(),
|
|
185
185
|
dropdownWidth = _useState4[0],
|
|
186
186
|
setDropdownWidth = _useState4[1];
|
|
187
187
|
|
|
188
|
-
var hasDropdown = contentTypes.length > 1 || !!
|
|
188
|
+
var hasDropdown = contentTypes.length > 1 || !!customDropdownItems;
|
|
189
189
|
|
|
190
190
|
var closeMenu = function closeMenu() {
|
|
191
191
|
return setOpen(false);
|
|
@@ -196,10 +196,19 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
196
196
|
setTimeout(function () {
|
|
197
197
|
var _textField$current, _textField$current$qu;
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
(_textField$current = textField.current) == null ? void 0 : (_textField$current$qu = _textField$current.querySelector('input')) == null ? void 0 : _textField$current$qu.focus({
|
|
200
|
+
preventScroll: true
|
|
201
|
+
});
|
|
200
202
|
}, 200);
|
|
201
203
|
}
|
|
202
204
|
}, [isOpen]);
|
|
205
|
+
React.useEffect(function () {
|
|
206
|
+
if (isOpen && !dropdownWidth) {
|
|
207
|
+
var _menuListRef$current;
|
|
208
|
+
|
|
209
|
+
setDropdownWidth((_menuListRef$current = menuListRef.current) == null ? void 0 : _menuListRef$current.clientWidth);
|
|
210
|
+
}
|
|
211
|
+
}, [isOpen, dropdownWidth]);
|
|
203
212
|
|
|
204
213
|
var handleSelect = function handleSelect(item) {
|
|
205
214
|
closeMenu();
|
|
@@ -215,20 +224,14 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
215
224
|
}
|
|
216
225
|
};
|
|
217
226
|
|
|
218
|
-
var
|
|
227
|
+
var handleMenuOpen = function handleMenuOpen() {
|
|
219
228
|
if (hasDropdown) {
|
|
220
|
-
setOpen(
|
|
229
|
+
setOpen(true);
|
|
221
230
|
} else {
|
|
222
231
|
handleSelect(contentTypes[0]);
|
|
223
232
|
}
|
|
224
233
|
};
|
|
225
234
|
|
|
226
|
-
var mouseUpHandler = React.useCallback(function (event) {
|
|
227
|
-
if (wrapper && wrapper.current && dropdownRef && dropdownRef.current && !wrapper.current.contains(event.target) && !dropdownRef.current.contains(event.target)) {
|
|
228
|
-
closeMenu();
|
|
229
|
-
}
|
|
230
|
-
}, [wrapper]);
|
|
231
|
-
useGlobalMouseUp(mouseUpHandler);
|
|
232
235
|
React.useEffect(function () {
|
|
233
236
|
if (!isOpen) {
|
|
234
237
|
setSearchInput('');
|
|
@@ -236,8 +239,7 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
236
239
|
}, [isOpen]);
|
|
237
240
|
|
|
238
241
|
var renderSearchResultsCount = function renderSearchResultsCount(resultsLength) {
|
|
239
|
-
return resultsLength ? React__default.createElement(
|
|
240
|
-
isTitle: true,
|
|
242
|
+
return resultsLength ? React__default.createElement(f36Components.Menu.SectionTitle, {
|
|
241
243
|
testId: "add-entru-menu-search-results"
|
|
242
244
|
}, resultsLength, " result", resultsLength > 1 ? 's' : '') : null;
|
|
243
245
|
};
|
|
@@ -254,33 +256,27 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
254
256
|
className: styles.wrapper,
|
|
255
257
|
ref: wrapper,
|
|
256
258
|
"data-test-id": testId
|
|
257
|
-
}, React__default.createElement(
|
|
258
|
-
|
|
259
|
-
position: dropdownSettings.position,
|
|
259
|
+
}, React__default.createElement(f36Components.Menu, {
|
|
260
|
+
placement: menuPlacementMap[dropdownSettings.position],
|
|
260
261
|
isAutoalignmentEnabled: dropdownSettings.isAutoalignmentEnabled,
|
|
261
|
-
isOpen: isOpen
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
getContainerRef: function getContainerRef(ref) {
|
|
269
|
-
dropdownRef.current = ref;
|
|
270
|
-
|
|
271
|
-
if (!dropdownWidth && ref) {
|
|
272
|
-
setDropdownWidth(ref.clientWidth);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}, renderCustomDropdownItems && React__default.createElement(forma36ReactComponents.DropdownList, {
|
|
262
|
+
isOpen: isOpen,
|
|
263
|
+
onClose: closeMenu,
|
|
264
|
+
onOpen: handleMenuOpen
|
|
265
|
+
}, React__default.createElement(f36Components.Menu.Trigger, null, children({
|
|
266
|
+
isOpen: isOpen,
|
|
267
|
+
isSelecting: isSelecting
|
|
268
|
+
})), isOpen && React__default.createElement(f36Components.Menu.List, {
|
|
276
269
|
className: styles.dropdownList,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
270
|
+
style: {
|
|
271
|
+
width: dropdownWidth != undefined ? dropdownWidth + "px" : undefined,
|
|
272
|
+
maxHeight: maxDropdownHeight + "px"
|
|
273
|
+
},
|
|
274
|
+
ref: menuListRef,
|
|
275
|
+
testId: "add-entry-menu"
|
|
276
|
+
}, Boolean(customDropdownItems) && React__default.createElement(React__default.Fragment, null, customDropdownItems, React__default.createElement(f36Components.Menu.Divider, null)), isSearchable && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
281
277
|
ref: textField,
|
|
282
|
-
className: styles.
|
|
283
|
-
}, React__default.createElement(
|
|
278
|
+
className: styles.inputWrapper
|
|
279
|
+
}, React__default.createElement(f36Components.TextInput, {
|
|
284
280
|
className: styles.searchInput(hasDropdown),
|
|
285
281
|
placeholder: "Search all content types",
|
|
286
282
|
testId: "add-entry-menu-search",
|
|
@@ -288,37 +284,22 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
288
284
|
onChange: function onChange(e) {
|
|
289
285
|
return setSearchInput(e.target.value);
|
|
290
286
|
}
|
|
291
|
-
}), React__default.createElement(
|
|
292
|
-
icon: "Search",
|
|
287
|
+
}), React__default.createElement(f36Icons.SearchIcon, {
|
|
293
288
|
className: styles.searchIcon
|
|
294
|
-
})), React__default.createElement(
|
|
295
|
-
className: styles.dropdownList,
|
|
296
|
-
border: "top",
|
|
297
|
-
styles: {
|
|
298
|
-
width: dropdownWidth || '',
|
|
299
|
-
maxHeight: maxDropdownHeight
|
|
300
|
-
},
|
|
301
|
-
maxHeight: maxDropdownHeight
|
|
302
|
-
}, searchInput && renderSearchResultsCount(filteredContentTypes.length), suggestedContentType && !searchInput && React__default.createElement(React__default.Fragment, null, React__default.createElement(forma36ReactComponents.DropdownListItem, {
|
|
303
|
-
isTitle: true
|
|
304
|
-
}, "Suggested Content Type"), React__default.createElement(forma36ReactComponents.DropdownListItem, {
|
|
289
|
+
})), React__default.createElement(f36Components.Menu.Divider, null)), searchInput && renderSearchResultsCount(filteredContentTypes.length), suggestedContentType && !searchInput && React__default.createElement(React__default.Fragment, null, React__default.createElement(f36Components.Menu.SectionTitle, null, "Suggested Content Type"), React__default.createElement(f36Components.Menu.Item, {
|
|
305
290
|
testId: "suggested",
|
|
306
291
|
onClick: function onClick() {
|
|
307
292
|
return handleSelect(suggestedContentType);
|
|
308
293
|
}
|
|
309
|
-
}, get(suggestedContentType, 'name')), React__default.createElement(
|
|
310
|
-
|
|
311
|
-
})), !searchInput && React__default.createElement(forma36ReactComponents.DropdownListItem, {
|
|
312
|
-
isTitle: true
|
|
313
|
-
}, contentTypesLabel), filteredContentTypes.length ? filteredContentTypes.map(function (contentType, i) {
|
|
314
|
-
return React__default.createElement(forma36ReactComponents.DropdownListItem, {
|
|
294
|
+
}, get(suggestedContentType, 'name')), React__default.createElement(f36Components.Menu.Divider, null)), !searchInput && React__default.createElement(f36Components.Menu.SectionTitle, null, contentTypesLabel), filteredContentTypes.length ? filteredContentTypes.map(function (contentType, i) {
|
|
295
|
+
return React__default.createElement(f36Components.Menu.Item, {
|
|
315
296
|
testId: "contentType",
|
|
316
297
|
key: get(contentType, 'name') + "-" + i,
|
|
317
298
|
onClick: function onClick() {
|
|
318
299
|
return handleSelect(contentType);
|
|
319
300
|
}
|
|
320
301
|
}, get(contentType, 'name', 'Untitled'));
|
|
321
|
-
}) : React__default.createElement(
|
|
302
|
+
}) : React__default.createElement(f36Components.Menu.Item, {
|
|
322
303
|
testId: "add-entru-menu-search-results"
|
|
323
304
|
}, "No results found"))));
|
|
324
305
|
};
|
|
@@ -344,7 +325,7 @@ var redesignStyles = /*#__PURE__*/_extends({}, standardStyles, {
|
|
|
344
325
|
var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
|
|
345
326
|
var contentTypes = _ref.contentTypes,
|
|
346
327
|
onSelect = _ref.onSelect,
|
|
347
|
-
|
|
328
|
+
customDropdownItems = _ref.customDropdownItems,
|
|
348
329
|
text = _ref.text,
|
|
349
330
|
testId = _ref.testId,
|
|
350
331
|
_ref$hasPlusIcon = _ref.hasPlusIcon,
|
|
@@ -358,9 +339,9 @@ var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
|
|
|
358
339
|
return ct.sys.id === suggestedContentTypeId;
|
|
359
340
|
});
|
|
360
341
|
var buttonText = text || "Add " + get(suggestedContentType || (contentTypes.length === 1 ? contentTypes[0] : {}), 'name', 'entry');
|
|
361
|
-
var hasDropdown = contentTypes.length > 1 ||
|
|
342
|
+
var hasDropdown = contentTypes.length > 1 || customDropdownItems; // TODO: Introduce `icon: string` and remove `hasPlusIcon` or remove "Plus" if we keep new layout.
|
|
362
343
|
|
|
363
|
-
var plusIcon = hasPlusIcon ?
|
|
344
|
+
var plusIcon = hasPlusIcon ? React__default.createElement(f36Icons.PlusIcon, null) : undefined; // TODO: Always use "New content" here if we fully switch to new layout.
|
|
364
345
|
|
|
365
346
|
var contentTypesLabel = useExperimentalStyles ? 'New content' : undefined;
|
|
366
347
|
var styles = useExperimentalStyles ? redesignStyles : standardStyles;
|
|
@@ -371,26 +352,19 @@ var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
|
|
|
371
352
|
onSelect: onSelect,
|
|
372
353
|
testId: testId,
|
|
373
354
|
dropdownSettings: dropdownSettings,
|
|
374
|
-
|
|
355
|
+
customDropdownItems: customDropdownItems
|
|
375
356
|
}, function (_ref2) {
|
|
376
|
-
var
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
key: "spinner",
|
|
381
|
-
className: styles.spinnerMargin
|
|
382
|
-
}), React__default.createElement(forma36ReactComponents.Button, {
|
|
383
|
-
buttonType: "muted",
|
|
384
|
-
onClick: function onClick() {
|
|
385
|
-
openMenu();
|
|
386
|
-
},
|
|
357
|
+
var isSelecting = _ref2.isSelecting;
|
|
358
|
+
return React__default.createElement(f36Components.Button, {
|
|
359
|
+
endIcon: hasDropdown ? React__default.createElement(f36Icons.ChevronDownIcon, null) : undefined,
|
|
360
|
+
variant: "secondary",
|
|
387
361
|
className: styles.action,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
indicateDropdown: Boolean(hasDropdown),
|
|
362
|
+
isDisabled: disabled || isSelecting || contentTypes && contentTypes.length === 0,
|
|
363
|
+
startIcon: isSelecting ? undefined : plusIcon,
|
|
391
364
|
size: "small",
|
|
392
|
-
testId: "create-entry-link-button"
|
|
393
|
-
|
|
365
|
+
testId: "create-entry-link-button",
|
|
366
|
+
isLoading: isSelecting
|
|
367
|
+
}, buttonText);
|
|
394
368
|
});
|
|
395
369
|
};
|
|
396
370
|
|
|
@@ -404,7 +378,7 @@ var separator = /*#__PURE__*/emotion.css({
|
|
|
404
378
|
});
|
|
405
379
|
|
|
406
380
|
function NoLinkPermissionsInfo() {
|
|
407
|
-
return React__default.createElement(
|
|
381
|
+
return React__default.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.");
|
|
408
382
|
}
|
|
409
383
|
|
|
410
384
|
var defaultEntryLabels = {
|
|
@@ -451,25 +425,25 @@ function LinkActions(props) {
|
|
|
451
425
|
onSelect: function onSelect(contentTypeId) {
|
|
452
426
|
return contentTypeId ? props.onCreate(contentTypeId, props.itemsLength) : Promise.resolve();
|
|
453
427
|
}
|
|
454
|
-
}), props.entityType === 'Asset' && React.createElement(
|
|
455
|
-
|
|
428
|
+
}), props.entityType === 'Asset' && React.createElement(f36Components.Button, {
|
|
429
|
+
isDisabled: props.isDisabled,
|
|
456
430
|
testId: testIds.createAndLink,
|
|
457
431
|
onClick: function onClick() {
|
|
458
432
|
props.onCreate(undefined, props.itemsLength);
|
|
459
433
|
},
|
|
460
|
-
|
|
461
|
-
|
|
434
|
+
variant: "secondary",
|
|
435
|
+
startIcon: React.createElement(f36Icons.PlusIcon, null),
|
|
462
436
|
size: "small"
|
|
463
437
|
}, labels.createNew()), React.createElement("span", {
|
|
464
438
|
className: separator
|
|
465
|
-
})), props.canLinkEntity && React.createElement(
|
|
466
|
-
|
|
439
|
+
})), props.canLinkEntity && React.createElement(f36Components.Button, {
|
|
440
|
+
isDisabled: props.isDisabled,
|
|
467
441
|
testId: testIds.linkExisting,
|
|
468
442
|
onClick: function onClick() {
|
|
469
443
|
props.onLinkExisting();
|
|
470
444
|
},
|
|
471
|
-
|
|
472
|
-
|
|
445
|
+
variant: "secondary",
|
|
446
|
+
startIcon: React.createElement(f36Icons.LinkIcon, null),
|
|
473
447
|
size: "small"
|
|
474
448
|
}, labels.linkExisting({
|
|
475
449
|
canLinkMultiple: props.canLinkMultiple
|
|
@@ -517,27 +491,23 @@ function CombinedEntryLinkActions(props) {
|
|
|
517
491
|
onSelect: function onSelect(contentTypeId) {
|
|
518
492
|
return contentTypeId ? props.onCreate(contentTypeId) : Promise.resolve();
|
|
519
493
|
},
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
props.onLinkExisting();
|
|
527
|
-
}
|
|
528
|
-
}, "Add existing content");
|
|
529
|
-
} : undefined
|
|
494
|
+
customDropdownItems: props.canLinkEntity ? React.createElement(f36Components.Menu.Item, {
|
|
495
|
+
testId: testIds$1.linkExisting,
|
|
496
|
+
onClick: function onClick() {
|
|
497
|
+
props.onLinkExisting();
|
|
498
|
+
}
|
|
499
|
+
}, "Add existing content") : undefined
|
|
530
500
|
});
|
|
531
501
|
} else if (props.canLinkEntity) {
|
|
532
|
-
return React.createElement(
|
|
533
|
-
|
|
502
|
+
return React.createElement(f36Components.Button, {
|
|
503
|
+
isDisabled: props.isDisabled,
|
|
534
504
|
testId: testIds$1.linkExisting,
|
|
535
505
|
className: action,
|
|
536
506
|
onClick: function onClick() {
|
|
537
507
|
props.onLinkExisting();
|
|
538
508
|
},
|
|
539
|
-
|
|
540
|
-
|
|
509
|
+
variant: "secondary",
|
|
510
|
+
startIcon: React.createElement(f36Icons.LinkIcon, null),
|
|
541
511
|
size: "small"
|
|
542
512
|
}, "Add existing content");
|
|
543
513
|
}
|
|
@@ -552,29 +522,29 @@ function CombinedAssetLinkActions(props) {
|
|
|
552
522
|
|
|
553
523
|
if (!props.canLinkEntity || !props.canCreateEntity) {
|
|
554
524
|
if (props.canLinkEntity) {
|
|
555
|
-
return React.createElement(
|
|
556
|
-
|
|
525
|
+
return React.createElement(f36Components.Button, {
|
|
526
|
+
isDisabled: props.isDisabled,
|
|
557
527
|
testId: testIds$1.linkExisting,
|
|
558
528
|
className: action,
|
|
559
529
|
onClick: function onClick() {
|
|
560
530
|
props.onLinkExisting();
|
|
561
531
|
},
|
|
562
|
-
|
|
563
|
-
|
|
532
|
+
variant: "secondary",
|
|
533
|
+
startIcon: React.createElement(f36Icons.PlusIcon, null),
|
|
564
534
|
size: "small"
|
|
565
535
|
}, "Add existing media");
|
|
566
536
|
}
|
|
567
537
|
|
|
568
538
|
if (props.canCreateEntity) {
|
|
569
|
-
return React.createElement(
|
|
570
|
-
|
|
539
|
+
return React.createElement(f36Components.Button, {
|
|
540
|
+
isDisabled: props.isDisabled,
|
|
571
541
|
testId: testIds$1.createAndLink,
|
|
572
542
|
className: action,
|
|
573
543
|
onClick: function onClick() {
|
|
574
544
|
props.onCreate();
|
|
575
545
|
},
|
|
576
|
-
|
|
577
|
-
|
|
546
|
+
variant: "secondary",
|
|
547
|
+
startIcon: React.createElement(f36Icons.PlusIcon, null),
|
|
578
548
|
size: "small"
|
|
579
549
|
}, "Add media");
|
|
580
550
|
}
|
|
@@ -584,35 +554,32 @@ function CombinedAssetLinkActions(props) {
|
|
|
584
554
|
// that works without content types to cover asset use-case.
|
|
585
555
|
|
|
586
556
|
|
|
587
|
-
return React.createElement(
|
|
557
|
+
return React.createElement(f36Components.Menu, {
|
|
588
558
|
isOpen: isOpen,
|
|
589
559
|
onClose: function onClose() {
|
|
590
|
-
|
|
560
|
+
setOpen(false);
|
|
591
561
|
},
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}, React.createElement(forma36ReactComponents.DropdownList, {
|
|
562
|
+
onOpen: function onOpen() {
|
|
563
|
+
setOpen(true);
|
|
564
|
+
}
|
|
565
|
+
}, React.createElement(f36Components.Menu.Trigger, null, React.createElement(f36Components.Button, {
|
|
566
|
+
endIcon: React.createElement(f36Icons.ChevronDownIcon, null),
|
|
567
|
+
isDisabled: props.isDisabled,
|
|
568
|
+
testId: testIds$1.actionsWrapper,
|
|
569
|
+
className: action,
|
|
570
|
+
variant: "secondary",
|
|
571
|
+
startIcon: React.createElement(f36Icons.PlusIcon, null),
|
|
572
|
+
size: "small"
|
|
573
|
+
}, "Add media")), isOpen && React.createElement(f36Components.Menu.List, {
|
|
605
574
|
testId: testIds$1.dropdown
|
|
606
|
-
}, React.createElement(
|
|
575
|
+
}, React.createElement(f36Components.Menu.Item, {
|
|
607
576
|
testId: testIds$1.linkExisting,
|
|
608
577
|
onClick: function onClick() {
|
|
609
|
-
setOpen(false);
|
|
610
578
|
props.onLinkExisting();
|
|
611
579
|
}
|
|
612
|
-
}, "Add existing media"), React.createElement(
|
|
580
|
+
}, "Add existing media"), React.createElement(f36Components.Menu.Item, {
|
|
613
581
|
testId: testIds$1.createAndLink,
|
|
614
582
|
onClick: function onClick() {
|
|
615
|
-
setOpen(false);
|
|
616
583
|
props.onCreate();
|
|
617
584
|
}
|
|
618
585
|
}, "Add new media")));
|
|
@@ -635,17 +602,19 @@ var close = /*#__PURE__*/emotion.css({
|
|
|
635
602
|
});
|
|
636
603
|
|
|
637
604
|
function MissingEntityCard(props) {
|
|
638
|
-
return React__default.createElement(
|
|
605
|
+
return React__default.createElement(f36Components.Card, {
|
|
639
606
|
className: card
|
|
640
607
|
}, React__default.createElement("div", {
|
|
641
608
|
className: props.asSquare ? squareCard : ''
|
|
642
|
-
}, React__default.createElement(
|
|
609
|
+
}, React__default.createElement(f36Components.SectionHeading, {
|
|
610
|
+
marginBottom: "none"
|
|
611
|
+
}, props.entityType === 'Entry' && 'Entry is missing or inaccessible', props.entityType === 'Asset' && 'Asset is missing or inaccessible')), !props.isDisabled && props.onRemove && React__default.createElement(f36Components.IconButton, {
|
|
612
|
+
variant: "transparent",
|
|
613
|
+
icon: React__default.createElement(f36Icons.CloseIcon, {
|
|
614
|
+
variant: "muted"
|
|
615
|
+
}),
|
|
643
616
|
className: close,
|
|
644
|
-
|
|
645
|
-
label: "Delete",
|
|
646
|
-
iconProps: {
|
|
647
|
-
icon: 'Close'
|
|
648
|
-
},
|
|
617
|
+
"aria-label": "Delete",
|
|
649
618
|
onClick: function onClick() {
|
|
650
619
|
props.onRemove && props.onRemove();
|
|
651
620
|
}
|
|
@@ -1780,67 +1749,20 @@ var formatDateAndTime = function formatDateAndTime(date, _short2) {
|
|
|
1780
1749
|
return formatDate(date, _short2) + " at " + formatTime(date);
|
|
1781
1750
|
};
|
|
1782
1751
|
|
|
1783
|
-
var
|
|
1784
|
-
// @ts-expect-error
|
|
1785
|
-
statusTag: /*#__PURE__*/emotion.css({
|
|
1786
|
-
marginLeft: tokens.spacingM,
|
|
1787
|
-
zIndex: '0 !important'
|
|
1788
|
-
}),
|
|
1789
|
-
positiveColor: /*#__PURE__*/emotion.css({
|
|
1790
|
-
color: tokens.colorPositive
|
|
1791
|
-
}),
|
|
1792
|
-
secondaryColor: /*#__PURE__*/emotion.css({
|
|
1793
|
-
color: tokens.gray500
|
|
1794
|
-
}),
|
|
1795
|
-
marginRightXS: /*#__PURE__*/emotion.css({
|
|
1796
|
-
marginRight: tokens.spacing2Xs
|
|
1797
|
-
}),
|
|
1798
|
-
paragraph: /*#__PURE__*/emotion.css({
|
|
1799
|
-
textAlign: 'center',
|
|
1800
|
-
color: tokens.gray500
|
|
1801
|
-
}),
|
|
1802
|
-
time: /*#__PURE__*/emotion.css({
|
|
1803
|
-
color: tokens.gray200
|
|
1804
|
-
})
|
|
1805
|
-
};
|
|
1806
|
-
var ScheduleTooltipContent = function ScheduleTooltipContent(_ref) {
|
|
1752
|
+
var getScheduleTooltipContent = function getScheduleTooltipContent(_ref) {
|
|
1807
1753
|
var job = _ref.job,
|
|
1808
1754
|
jobsCount = _ref.jobsCount;
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
switch (job.action.toLowerCase()) {
|
|
1812
|
-
case 'publish':
|
|
1813
|
-
colorPalette = styles$1.positiveColor;
|
|
1814
|
-
break;
|
|
1815
|
-
|
|
1816
|
-
case 'unpublish':
|
|
1817
|
-
colorPalette = styles$1.secondaryColor;
|
|
1818
|
-
break;
|
|
1819
|
-
|
|
1820
|
-
default:
|
|
1821
|
-
colorPalette = styles$1.secondaryColor;
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
return React__default.createElement(React__default.Fragment, null, React__default.createElement("span", {
|
|
1825
|
-
className: styles$1.time,
|
|
1826
|
-
"data-test-id": "cf-scheduled-time-tootlip-content"
|
|
1827
|
-
}, formatDateAndTime(job.scheduledFor.datetime)), React__default.createElement(forma36ReactComponents.Tag, {
|
|
1828
|
-
tagType: job.action === 'publish' ? 'positive' : 'secondary',
|
|
1829
|
-
testId: "scheduled-publish-trigger",
|
|
1830
|
-
className: emotion.cx(styles$1.statusTag, colorPalette)
|
|
1831
|
-
}, job.action.toUpperCase()), jobsCount > 1 && React__default.createElement(forma36ReactComponents.Paragraph, {
|
|
1832
|
-
className: styles$1.paragraph
|
|
1833
|
-
}, "+ ", jobsCount - 1, " more"));
|
|
1755
|
+
return "Will " + job.action.toLowerCase() + " " + formatDateAndTime(job.scheduledFor.datetime).toLowerCase() + "\n " + (jobsCount > 1 && "+ " + (jobsCount - 1) + " more");
|
|
1834
1756
|
};
|
|
1835
1757
|
var ScheduleTooltip = function ScheduleTooltip(_ref2) {
|
|
1836
1758
|
var job = _ref2.job,
|
|
1837
1759
|
jobsCount = _ref2.jobsCount,
|
|
1838
1760
|
children = _ref2.children;
|
|
1839
|
-
return React__default.createElement(
|
|
1840
|
-
|
|
1761
|
+
return React__default.createElement(f36Components.Tooltip, {
|
|
1762
|
+
placement: "top",
|
|
1841
1763
|
testId: job.sys.id,
|
|
1842
|
-
|
|
1843
|
-
content:
|
|
1764
|
+
as: "div",
|
|
1765
|
+
content: getScheduleTooltipContent({
|
|
1844
1766
|
job: job,
|
|
1845
1767
|
jobsCount: jobsCount
|
|
1846
1768
|
})
|
|
@@ -2496,7 +2418,7 @@ var getEntryTitle = fieldEditorShared.entityHelpers.getEntryTitle,
|
|
|
2496
2418
|
getEntityDescription = fieldEditorShared.entityHelpers.getEntityDescription,
|
|
2497
2419
|
getEntryStatus = fieldEditorShared.entityHelpers.getEntryStatus,
|
|
2498
2420
|
getEntryImage = fieldEditorShared.entityHelpers.getEntryImage;
|
|
2499
|
-
var styles$
|
|
2421
|
+
var styles$1 = {
|
|
2500
2422
|
scheduleIcon: /*#__PURE__*/emotion.css({
|
|
2501
2423
|
marginRight: tokens.spacing2Xs
|
|
2502
2424
|
})
|
|
@@ -2551,75 +2473,61 @@ function WrappedEntryCard(props) {
|
|
|
2551
2473
|
localeCode: props.localeCode,
|
|
2552
2474
|
defaultLocaleCode: props.defaultLocaleCode
|
|
2553
2475
|
});
|
|
2554
|
-
return (
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
// @ts-expect-error
|
|
2583
|
-
onClick: function onClick(e) {
|
|
2584
|
-
e.stopPropagation();
|
|
2585
|
-
}
|
|
2586
|
-
}, props.hasCardEditActions && props.onEdit && React.createElement(forma36ReactComponents.DropdownListItem, {
|
|
2587
|
-
onClick: function onClick() {
|
|
2588
|
-
props.onEdit && props.onEdit();
|
|
2589
|
-
},
|
|
2590
|
-
testId: "edit"
|
|
2591
|
-
}, "Edit"), props.onRemove && React.createElement(forma36ReactComponents.DropdownListItem, {
|
|
2592
|
-
onClick: function onClick() {
|
|
2593
|
-
props.onRemove && props.onRemove();
|
|
2594
|
-
},
|
|
2595
|
-
isDisabled: props.isDisabled,
|
|
2596
|
-
testId: "delete"
|
|
2597
|
-
}, "Remove")), props.hasMoveOptions ? React.createElement(forma36ReactComponents.DropdownList, {
|
|
2598
|
-
border: "top",
|
|
2599
|
-
// @ts-expect-error
|
|
2600
|
-
onClick: function onClick(e) {
|
|
2601
|
-
e.stopPropagation();
|
|
2602
|
-
}
|
|
2603
|
-
}, React.createElement(forma36ReactComponents.DropdownListItem, {
|
|
2604
|
-
onClick: function onClick() {
|
|
2605
|
-
return props.onMoveTop && props.onMoveTop();
|
|
2606
|
-
},
|
|
2607
|
-
isDisabled: !props.onMoveTop,
|
|
2608
|
-
testId: "move-top"
|
|
2609
|
-
}, "Move to top"), React.createElement(forma36ReactComponents.DropdownListItem, {
|
|
2610
|
-
onClick: function onClick() {
|
|
2611
|
-
return props.onMoveBottom && props.onMoveBottom();
|
|
2612
|
-
},
|
|
2613
|
-
isDisabled: !props.onMoveBottom,
|
|
2614
|
-
testId: "move-bottom"
|
|
2615
|
-
}, "Move to bottom")) : React.createElement(React.Fragment, null)) : undefined,
|
|
2616
|
-
onClick: function onClick(e) {
|
|
2617
|
-
e.preventDefault();
|
|
2618
|
-
if (!props.isClickable) return;
|
|
2476
|
+
return React.createElement(f36Components.EntryCard, {
|
|
2477
|
+
as: props.entryUrl ? 'a' : 'article',
|
|
2478
|
+
href: props.entryUrl,
|
|
2479
|
+
title: title,
|
|
2480
|
+
description: description,
|
|
2481
|
+
contentType: contentType == null ? void 0 : contentType.name,
|
|
2482
|
+
size: props.size,
|
|
2483
|
+
isSelected: props.isSelected,
|
|
2484
|
+
status: status,
|
|
2485
|
+
icon: React.createElement(ScheduledIconWithTooltip, {
|
|
2486
|
+
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
2487
|
+
entityType: "Entry",
|
|
2488
|
+
entityId: props.entry.sys.id
|
|
2489
|
+
}, React.createElement(f36Icons.ClockIcon, {
|
|
2490
|
+
className: styles$1.scheduleIcon,
|
|
2491
|
+
size: "small",
|
|
2492
|
+
variant: "muted",
|
|
2493
|
+
testId: "schedule-icon"
|
|
2494
|
+
})),
|
|
2495
|
+
thumbnailElement: file && fieldEditorShared.isValidImage(file) ? React.createElement(AssetThumbnail, {
|
|
2496
|
+
file: file
|
|
2497
|
+
}) : undefined,
|
|
2498
|
+
dragHandleRender: props.renderDragHandle,
|
|
2499
|
+
withDragHandle: !!props.renderDragHandle,
|
|
2500
|
+
actions: props.onEdit || props.onRemove ? [props.hasCardEditActions && props.onEdit ? React.createElement(f36Components.MenuItem, {
|
|
2501
|
+
key: "edit",
|
|
2502
|
+
testId: "edit",
|
|
2503
|
+
onClick: function onClick() {
|
|
2619
2504
|
props.onEdit && props.onEdit();
|
|
2620
2505
|
}
|
|
2621
|
-
})
|
|
2622
|
-
|
|
2506
|
+
}, "Edit") : null, props.onRemove ? React.createElement(f36Components.MenuItem, {
|
|
2507
|
+
key: "delete",
|
|
2508
|
+
testId: "delete",
|
|
2509
|
+
onClick: function onClick() {
|
|
2510
|
+
props.onRemove && props.onRemove();
|
|
2511
|
+
}
|
|
2512
|
+
}, "Remove") : null, props.hasMoveOptions && (props.onMoveTop || props.onMoveBottom) ? React.createElement(f36Components.MenuDivider, null) : null, props.hasMoveOptions && props.onMoveTop ? React.createElement(f36Components.MenuItem, {
|
|
2513
|
+
onClick: function onClick() {
|
|
2514
|
+
return props.onMoveTop && props.onMoveTop();
|
|
2515
|
+
},
|
|
2516
|
+
testId: "move-top"
|
|
2517
|
+
}, "Move to top") : null, props.hasMoveOptions && props.onMoveBottom ? React.createElement(f36Components.MenuItem, {
|
|
2518
|
+
onClick: function onClick() {
|
|
2519
|
+
return props.onMoveBottom && props.onMoveBottom();
|
|
2520
|
+
},
|
|
2521
|
+
testId: "move-bottom"
|
|
2522
|
+
}, "Move to bottom") : null].filter(function (item) {
|
|
2523
|
+
return item;
|
|
2524
|
+
}) : [],
|
|
2525
|
+
onClick: function onClick(e) {
|
|
2526
|
+
e.preventDefault();
|
|
2527
|
+
if (!props.isClickable) return;
|
|
2528
|
+
props.onEdit && props.onEdit();
|
|
2529
|
+
}
|
|
2530
|
+
});
|
|
2623
2531
|
}
|
|
2624
2532
|
WrappedEntryCard.defaultProps = defaultProps;
|
|
2625
2533
|
|
|
@@ -2768,9 +2676,9 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2768
2676
|
}
|
|
2769
2677
|
|
|
2770
2678
|
if (entry === undefined) {
|
|
2771
|
-
return React.createElement(
|
|
2679
|
+
return React.createElement(f36Components.EntryCard, {
|
|
2772
2680
|
size: size,
|
|
2773
|
-
|
|
2681
|
+
isLoading: true
|
|
2774
2682
|
});
|
|
2775
2683
|
}
|
|
2776
2684
|
|
|
@@ -2785,7 +2693,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2785
2693
|
size: size,
|
|
2786
2694
|
localeCode: props.sdk.field.locale,
|
|
2787
2695
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
2788
|
-
|
|
2696
|
+
renderDragHandle: props.renderDragHandle,
|
|
2789
2697
|
onEdit: onEdit,
|
|
2790
2698
|
onRemove: onRemoveEntry,
|
|
2791
2699
|
onMoveTop: props.onMoveTop,
|
|
@@ -2942,7 +2850,7 @@ MultipleReferenceEditor.defaultProps = {
|
|
|
2942
2850
|
hasCardEditActions: true
|
|
2943
2851
|
};
|
|
2944
2852
|
|
|
2945
|
-
var styles$
|
|
2853
|
+
var styles$2 = {
|
|
2946
2854
|
containter: /*#__PURE__*/emotion.css({
|
|
2947
2855
|
position: 'relative'
|
|
2948
2856
|
}),
|
|
@@ -2950,18 +2858,23 @@ var styles$3 = {
|
|
|
2950
2858
|
marginBottom: tokens.spacingM
|
|
2951
2859
|
})
|
|
2952
2860
|
};
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2861
|
+
|
|
2862
|
+
var DragHandle = function DragHandle(props) {
|
|
2863
|
+
var SortableDragHandle = reactSortableHoc.SortableHandle(function () {
|
|
2864
|
+
return props.drag;
|
|
2865
|
+
});
|
|
2866
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
2867
|
+
};
|
|
2868
|
+
|
|
2956
2869
|
var SortableLink = /*#__PURE__*/reactSortableHoc.SortableElement(function (props) {
|
|
2957
2870
|
return React__default.createElement("div", {
|
|
2958
|
-
className: styles$
|
|
2871
|
+
className: styles$2.item
|
|
2959
2872
|
}, props.children);
|
|
2960
2873
|
});
|
|
2961
2874
|
var SortableLinkList = /*#__PURE__*/reactSortableHoc.SortableContainer(function (props) {
|
|
2962
2875
|
var lastIndex = props.items.length - 1;
|
|
2963
2876
|
return React__default.createElement("div", {
|
|
2964
|
-
className: styles$
|
|
2877
|
+
className: styles$2.containter
|
|
2965
2878
|
}, props.items.map(function (item, index) {
|
|
2966
2879
|
return React__default.createElement(SortableLink, {
|
|
2967
2880
|
disabled: props.isDisabled,
|
|
@@ -2984,7 +2897,7 @@ var SortableLinkList = /*#__PURE__*/reactSortableHoc.SortableContainer(function
|
|
|
2984
2897
|
onMoveBottom: index !== lastIndex ? function () {
|
|
2985
2898
|
return props.onMove(index, lastIndex);
|
|
2986
2899
|
} : undefined,
|
|
2987
|
-
|
|
2900
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle
|
|
2988
2901
|
})));
|
|
2989
2902
|
}));
|
|
2990
2903
|
});
|
|
@@ -3000,17 +2913,6 @@ function MultipleEntryReferenceEditor(props) {
|
|
|
3000
2913
|
});
|
|
3001
2914
|
}
|
|
3002
2915
|
|
|
3003
|
-
var styles$4 = {
|
|
3004
|
-
cardDropdown: /*#__PURE__*/emotion.css({
|
|
3005
|
-
width: '300px'
|
|
3006
|
-
}),
|
|
3007
|
-
truncated: /*#__PURE__*/emotion.css({
|
|
3008
|
-
overflow: 'hidden',
|
|
3009
|
-
whiteSpace: 'nowrap',
|
|
3010
|
-
textOverflow: 'ellipsis'
|
|
3011
|
-
})
|
|
3012
|
-
};
|
|
3013
|
-
|
|
3014
2916
|
function downloadAsset(url) {
|
|
3015
2917
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
3016
2918
|
}
|
|
@@ -3021,47 +2923,51 @@ function renderAssetInfo(props) {
|
|
|
3021
2923
|
var mimeType = get(entityFile, 'contentType');
|
|
3022
2924
|
var fileSize = get(entityFile, 'details.size');
|
|
3023
2925
|
var image = get(entityFile, 'details.image');
|
|
3024
|
-
return React__default.createElement(
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
2926
|
+
return [React__default.createElement(f36Components.Menu.SectionTitle, {
|
|
2927
|
+
key: "file-section"
|
|
2928
|
+
}, "File info"), fileName && React__default.createElement(f36Components.Menu.Item, {
|
|
2929
|
+
key: "file-name"
|
|
2930
|
+
}, React__default.createElement(f36Components.Text, {
|
|
2931
|
+
isTruncated: true
|
|
2932
|
+
}, fileName)), mimeType && React__default.createElement(f36Components.Menu.Item, {
|
|
2933
|
+
key: "file-type"
|
|
2934
|
+
}, React__default.createElement(f36Components.Text, {
|
|
2935
|
+
isTruncated: true
|
|
2936
|
+
}, mimeType)), fileSize && React__default.createElement(f36Components.Menu.Item, {
|
|
2937
|
+
key: "file-size"
|
|
2938
|
+
}, fieldEditorShared.shortenStorageUnit(fileSize, 'B')), image && React__default.createElement(f36Components.Menu.Item, {
|
|
2939
|
+
key: "file-dimentions"
|
|
2940
|
+
}, image.width + " \xD7 " + image.height)].filter(function (item) {
|
|
2941
|
+
return item;
|
|
2942
|
+
});
|
|
3036
2943
|
}
|
|
3037
2944
|
function renderActions(props) {
|
|
3038
2945
|
var entityFile = props.entityFile,
|
|
3039
2946
|
isDisabled = props.isDisabled,
|
|
3040
2947
|
onEdit = props.onEdit,
|
|
3041
2948
|
onRemove = props.onRemove;
|
|
3042
|
-
return React__default.createElement(
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
e.stopPropagation();
|
|
3047
|
-
}
|
|
3048
|
-
}, React__default.createElement(forma36ReactComponents.DropdownListItem, {
|
|
3049
|
-
isTitle: true
|
|
3050
|
-
}, "Actions"), onEdit && React__default.createElement(forma36ReactComponents.DropdownListItem, {
|
|
2949
|
+
return [React__default.createElement(f36Components.Menu.SectionTitle, {
|
|
2950
|
+
key: "section-title"
|
|
2951
|
+
}, "Actions"), onEdit ? React__default.createElement(f36Components.Menu.Item, {
|
|
2952
|
+
key: "edit",
|
|
3051
2953
|
onClick: onEdit,
|
|
3052
2954
|
testId: "card-action-edit"
|
|
3053
|
-
}, "Edit"), entityFile
|
|
2955
|
+
}, "Edit") : null, entityFile ? React__default.createElement(f36Components.Menu.Item, {
|
|
2956
|
+
key: "download",
|
|
3054
2957
|
onClick: function onClick() {
|
|
3055
2958
|
if (typeof entityFile.url === 'string') {
|
|
3056
2959
|
downloadAsset(entityFile.url);
|
|
3057
2960
|
}
|
|
3058
2961
|
},
|
|
3059
2962
|
testId: "card-action-download"
|
|
3060
|
-
}, "Download"), onRemove
|
|
3061
|
-
|
|
2963
|
+
}, "Download") : null, onRemove ? React__default.createElement(f36Components.Menu.Item, {
|
|
2964
|
+
key: "remove",
|
|
2965
|
+
disabled: isDisabled,
|
|
3062
2966
|
onClick: onRemove,
|
|
3063
2967
|
testId: "card-action-remove"
|
|
3064
|
-
}, "Remove"))
|
|
2968
|
+
}, "Remove") : null].filter(function (item) {
|
|
2969
|
+
return item;
|
|
2970
|
+
});
|
|
3065
2971
|
}
|
|
3066
2972
|
|
|
3067
2973
|
var groupToIconMap = {
|
|
@@ -3077,7 +2983,7 @@ var groupToIconMap = {
|
|
|
3077
2983
|
code: 'code',
|
|
3078
2984
|
markup: 'markup'
|
|
3079
2985
|
};
|
|
3080
|
-
var styles$
|
|
2986
|
+
var styles$3 = {
|
|
3081
2987
|
scheduleIcon: /*#__PURE__*/emotion.css({
|
|
3082
2988
|
marginRight: tokens.spacing2Xs
|
|
3083
2989
|
})
|
|
@@ -3125,47 +3031,49 @@ var WrappedAssetCard = function WrappedAssetCard(props) {
|
|
|
3125
3031
|
defaultTitle: 'Untitled'
|
|
3126
3032
|
});
|
|
3127
3033
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3128
|
-
|
|
3034
|
+
var href = getAssetUrl ? getAssetUrl(props.asset.sys.id) : undefined;
|
|
3035
|
+
return React__default.createElement(f36Components.AssetCard, {
|
|
3036
|
+
as: href ? 'a' : 'article',
|
|
3129
3037
|
type: getFileType(entityFile),
|
|
3130
3038
|
title: entityTitle,
|
|
3131
3039
|
className: className,
|
|
3132
|
-
|
|
3133
|
-
href:
|
|
3040
|
+
isSelected: isSelected,
|
|
3041
|
+
href: href,
|
|
3134
3042
|
status: status,
|
|
3135
|
-
|
|
3043
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3136
3044
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3137
3045
|
entityType: "Asset",
|
|
3138
3046
|
entityId: props.asset.sys.id
|
|
3139
|
-
}, React__default.createElement(
|
|
3140
|
-
className: styles$
|
|
3141
|
-
icon: "Clock",
|
|
3047
|
+
}, React__default.createElement(f36Icons.ClockIcon, {
|
|
3048
|
+
className: styles$3.scheduleIcon,
|
|
3142
3049
|
size: "small",
|
|
3143
|
-
|
|
3050
|
+
variant: "muted",
|
|
3144
3051
|
testId: "schedule-icon"
|
|
3145
3052
|
})),
|
|
3146
3053
|
src: entityFile && entityFile.url ? size === 'small' ? entityFile.url + "?w=150&h=150&fit=thumb" : entityFile.url + "?h=300" : '',
|
|
3147
|
-
// @ts-expect-error
|
|
3148
3054
|
onClick: function onClick(e) {
|
|
3149
3055
|
e.preventDefault();
|
|
3150
3056
|
if (!isClickable) return;
|
|
3151
3057
|
onEdit && onEdit();
|
|
3152
3058
|
},
|
|
3153
|
-
|
|
3154
|
-
withDragHandle: !!props.
|
|
3155
|
-
|
|
3059
|
+
dragHandleRender: props.renderDragHandle,
|
|
3060
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3061
|
+
actions: [].concat(renderActions({
|
|
3156
3062
|
entityFile: entityFile,
|
|
3157
3063
|
isDisabled: isDisabled,
|
|
3158
3064
|
onEdit: onEdit,
|
|
3159
3065
|
onRemove: onRemove
|
|
3160
3066
|
}), entityFile ? renderAssetInfo({
|
|
3161
3067
|
entityFile: entityFile
|
|
3162
|
-
}) :
|
|
3068
|
+
}) : []).filter(function (item) {
|
|
3069
|
+
return item;
|
|
3070
|
+
}),
|
|
3163
3071
|
size: size
|
|
3164
3072
|
});
|
|
3165
3073
|
};
|
|
3166
3074
|
WrappedAssetCard.defaultProps = defaultProps$1;
|
|
3167
3075
|
|
|
3168
|
-
var styles$
|
|
3076
|
+
var styles$4 = {
|
|
3169
3077
|
scheduleIcon: /*#__PURE__*/emotion.css({
|
|
3170
3078
|
marginRight: tokens.spacing2Xs
|
|
3171
3079
|
})
|
|
@@ -3193,38 +3101,43 @@ var WrappedAssetLink = function WrappedAssetLink(props) {
|
|
|
3193
3101
|
defaultTitle: 'Untitled'
|
|
3194
3102
|
});
|
|
3195
3103
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3196
|
-
return React__default.createElement(
|
|
3104
|
+
return React__default.createElement(f36Components.EntryCard, {
|
|
3105
|
+
as: href ? 'a' : 'article',
|
|
3197
3106
|
contentType: "Asset",
|
|
3198
3107
|
title: entityTitle,
|
|
3199
3108
|
className: className,
|
|
3200
3109
|
href: href,
|
|
3201
3110
|
size: "small",
|
|
3202
3111
|
status: status,
|
|
3203
|
-
|
|
3112
|
+
thumbnailElement: entityFile && fieldEditorShared.isValidImage(entityFile) ? React__default.createElement(AssetThumbnail, {
|
|
3113
|
+
file: entityFile
|
|
3114
|
+
}) : undefined,
|
|
3115
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3204
3116
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3205
3117
|
entityType: "Asset",
|
|
3206
3118
|
entityId: props.asset.sys.id
|
|
3207
|
-
}, React__default.createElement(
|
|
3208
|
-
className: styles$
|
|
3209
|
-
icon: "Clock",
|
|
3119
|
+
}, React__default.createElement(f36Icons.ClockIcon, {
|
|
3120
|
+
className: styles$4.scheduleIcon,
|
|
3210
3121
|
size: "small",
|
|
3211
|
-
|
|
3122
|
+
variant: "muted",
|
|
3212
3123
|
testId: "schedule-icon"
|
|
3213
3124
|
})),
|
|
3214
3125
|
onClick: function onClick(e) {
|
|
3215
3126
|
e.preventDefault();
|
|
3216
3127
|
onEdit();
|
|
3217
3128
|
},
|
|
3218
|
-
|
|
3219
|
-
withDragHandle: !!props.
|
|
3220
|
-
|
|
3129
|
+
dragHandleRender: props.renderDragHandle,
|
|
3130
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3131
|
+
actions: [renderActions({
|
|
3221
3132
|
entityFile: entityFile,
|
|
3222
3133
|
isDisabled: isDisabled,
|
|
3223
3134
|
onEdit: onEdit,
|
|
3224
3135
|
onRemove: onRemove
|
|
3225
3136
|
}), entityFile ? renderAssetInfo({
|
|
3226
3137
|
entityFile: entityFile
|
|
3227
|
-
}) :
|
|
3138
|
+
}) : null].filter(function (item) {
|
|
3139
|
+
return item;
|
|
3140
|
+
})
|
|
3228
3141
|
});
|
|
3229
3142
|
};
|
|
3230
3143
|
|
|
@@ -3327,16 +3240,16 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3327
3240
|
isDisabled: props.isDisabled,
|
|
3328
3241
|
localeCode: props.sdk.field.locale,
|
|
3329
3242
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
3330
|
-
|
|
3243
|
+
renderDragHandle: props.renderDragHandle,
|
|
3331
3244
|
onEdit: onEdit,
|
|
3332
3245
|
onRemove: onRemove
|
|
3333
3246
|
};
|
|
3334
3247
|
|
|
3335
3248
|
if (props.viewType === 'link') {
|
|
3336
3249
|
if (asset === undefined) {
|
|
3337
|
-
return React.createElement(
|
|
3250
|
+
return React.createElement(f36Components.EntryCard, {
|
|
3338
3251
|
size: "small",
|
|
3339
|
-
|
|
3252
|
+
isLoading: true
|
|
3340
3253
|
});
|
|
3341
3254
|
}
|
|
3342
3255
|
|
|
@@ -3347,12 +3260,9 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3347
3260
|
}
|
|
3348
3261
|
|
|
3349
3262
|
if (asset === undefined) {
|
|
3350
|
-
return React.createElement(
|
|
3263
|
+
return React.createElement(f36Components.AssetCard, {
|
|
3351
3264
|
size: size,
|
|
3352
|
-
isLoading: true
|
|
3353
|
-
title: "",
|
|
3354
|
-
src: "",
|
|
3355
|
-
href: ""
|
|
3265
|
+
isLoading: true
|
|
3356
3266
|
});
|
|
3357
3267
|
}
|
|
3358
3268
|
|
|
@@ -3405,7 +3315,7 @@ SingleMediaEditor.defaultProps = {
|
|
|
3405
3315
|
isInitiallyDisabled: true
|
|
3406
3316
|
};
|
|
3407
3317
|
|
|
3408
|
-
var styles$
|
|
3318
|
+
var styles$5 = {
|
|
3409
3319
|
gridContainter: /*#__PURE__*/emotion.css({
|
|
3410
3320
|
position: 'relative',
|
|
3411
3321
|
display: 'flex',
|
|
@@ -3419,17 +3329,22 @@ var styles$7 = {
|
|
|
3419
3329
|
marginRight: tokens.spacingM
|
|
3420
3330
|
})
|
|
3421
3331
|
};
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3332
|
+
|
|
3333
|
+
var DragHandle$1 = function DragHandle(props) {
|
|
3334
|
+
var SortableDragHandle = reactSortableHoc.SortableHandle(function () {
|
|
3335
|
+
return props.drag;
|
|
3336
|
+
});
|
|
3337
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
3338
|
+
};
|
|
3339
|
+
|
|
3425
3340
|
var SortableLink$1 = /*#__PURE__*/reactSortableHoc.SortableElement(function (props) {
|
|
3426
3341
|
return React__default.createElement("div", {
|
|
3427
|
-
className: styles$
|
|
3342
|
+
className: styles$5.item
|
|
3428
3343
|
}, props.children);
|
|
3429
3344
|
});
|
|
3430
3345
|
var SortableLinkList$1 = /*#__PURE__*/reactSortableHoc.SortableContainer(function (props) {
|
|
3431
3346
|
return React__default.createElement("div", {
|
|
3432
|
-
className: props.viewType === 'card' ? styles$
|
|
3347
|
+
className: props.viewType === 'card' ? styles$5.gridContainter : styles$5.container
|
|
3433
3348
|
}, props.items.map(function (item, index) {
|
|
3434
3349
|
return React__default.createElement(SortableLink$1, {
|
|
3435
3350
|
disabled: props.isDisabled,
|
|
@@ -3444,7 +3359,7 @@ var SortableLinkList$1 = /*#__PURE__*/reactSortableHoc.SortableContainer(functio
|
|
|
3444
3359
|
return i !== index;
|
|
3445
3360
|
}));
|
|
3446
3361
|
},
|
|
3447
|
-
|
|
3362
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle$1
|
|
3448
3363
|
})));
|
|
3449
3364
|
}));
|
|
3450
3365
|
});
|
|
@@ -3471,11 +3386,11 @@ exports.EntityProvider = EntityProvider;
|
|
|
3471
3386
|
exports.MissingEntityCard = MissingEntityCard;
|
|
3472
3387
|
exports.MultipleEntryReferenceEditor = MultipleEntryReferenceEditor;
|
|
3473
3388
|
exports.MultipleMediaEditor = MultipleMediaEditor;
|
|
3474
|
-
exports.ScheduleTooltipContent = ScheduleTooltipContent;
|
|
3475
3389
|
exports.ScheduledIconWithTooltip = ScheduledIconWithTooltip;
|
|
3476
3390
|
exports.SingleEntryReferenceEditor = SingleEntryReferenceEditor;
|
|
3477
3391
|
exports.SingleMediaEditor = SingleMediaEditor;
|
|
3478
3392
|
exports.WrappedAssetCard = WrappedAssetCard;
|
|
3479
3393
|
exports.WrappedEntryCard = WrappedEntryCard;
|
|
3394
|
+
exports.getScheduleTooltipContent = getScheduleTooltipContent;
|
|
3480
3395
|
exports.useEntities = useEntities;
|
|
3481
3396
|
//# sourceMappingURL=field-editor-reference.cjs.development.js.map
|