@contentful/field-editor-reference 2.21.2 → 3.0.0
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 +65 -420
- 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 +265 -362
- 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 +253 -350
- 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
|
+
})), 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
|
}
|
|
@@ -546,35 +516,31 @@ function CombinedEntryLinkActions(props) {
|
|
|
546
516
|
}
|
|
547
517
|
|
|
548
518
|
function CombinedAssetLinkActions(props) {
|
|
549
|
-
var _React$useState = React.useState(false),
|
|
550
|
-
isOpen = _React$useState[0],
|
|
551
|
-
setOpen = _React$useState[1];
|
|
552
|
-
|
|
553
519
|
if (!props.canLinkEntity || !props.canCreateEntity) {
|
|
554
520
|
if (props.canLinkEntity) {
|
|
555
|
-
return React.createElement(
|
|
556
|
-
|
|
521
|
+
return React.createElement(f36Components.Button, {
|
|
522
|
+
isDisabled: props.isDisabled,
|
|
557
523
|
testId: testIds$1.linkExisting,
|
|
558
524
|
className: action,
|
|
559
525
|
onClick: function onClick() {
|
|
560
526
|
props.onLinkExisting();
|
|
561
527
|
},
|
|
562
|
-
|
|
563
|
-
|
|
528
|
+
variant: "secondary",
|
|
529
|
+
startIcon: React.createElement(f36Icons.PlusIcon, null),
|
|
564
530
|
size: "small"
|
|
565
531
|
}, "Add existing media");
|
|
566
532
|
}
|
|
567
533
|
|
|
568
534
|
if (props.canCreateEntity) {
|
|
569
|
-
return React.createElement(
|
|
570
|
-
|
|
535
|
+
return React.createElement(f36Components.Button, {
|
|
536
|
+
isDisabled: props.isDisabled,
|
|
571
537
|
testId: testIds$1.createAndLink,
|
|
572
538
|
className: action,
|
|
573
539
|
onClick: function onClick() {
|
|
574
540
|
props.onCreate();
|
|
575
541
|
},
|
|
576
|
-
|
|
577
|
-
|
|
542
|
+
variant: "secondary",
|
|
543
|
+
startIcon: React.createElement(f36Icons.PlusIcon, null),
|
|
578
544
|
size: "small"
|
|
579
545
|
}, "Add media");
|
|
580
546
|
}
|
|
@@ -584,35 +550,24 @@ function CombinedAssetLinkActions(props) {
|
|
|
584
550
|
// that works without content types to cover asset use-case.
|
|
585
551
|
|
|
586
552
|
|
|
587
|
-
return React.createElement(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
onClick: function onClick() {
|
|
597
|
-
setOpen(!isOpen);
|
|
598
|
-
},
|
|
599
|
-
buttonType: "muted",
|
|
600
|
-
icon: "Plus",
|
|
601
|
-
indicateDropdown: true,
|
|
602
|
-
size: "small"
|
|
603
|
-
}, "Add media"))
|
|
604
|
-
}, React.createElement(forma36ReactComponents.DropdownList, {
|
|
553
|
+
return React.createElement(f36Components.Menu, null, React.createElement(f36Components.Menu.Trigger, null, React.createElement(f36Components.Button, {
|
|
554
|
+
endIcon: React.createElement(f36Icons.ChevronDownIcon, null),
|
|
555
|
+
isDisabled: props.isDisabled,
|
|
556
|
+
testId: testIds$1.actionsWrapper,
|
|
557
|
+
className: action,
|
|
558
|
+
variant: "secondary",
|
|
559
|
+
startIcon: React.createElement(f36Icons.PlusIcon, null),
|
|
560
|
+
size: "small"
|
|
561
|
+
}, "Add media")), React.createElement(f36Components.Menu.List, {
|
|
605
562
|
testId: testIds$1.dropdown
|
|
606
|
-
}, React.createElement(
|
|
563
|
+
}, React.createElement(f36Components.Menu.Item, {
|
|
607
564
|
testId: testIds$1.linkExisting,
|
|
608
565
|
onClick: function onClick() {
|
|
609
|
-
setOpen(false);
|
|
610
566
|
props.onLinkExisting();
|
|
611
567
|
}
|
|
612
|
-
}, "Add existing media"), React.createElement(
|
|
568
|
+
}, "Add existing media"), React.createElement(f36Components.Menu.Item, {
|
|
613
569
|
testId: testIds$1.createAndLink,
|
|
614
570
|
onClick: function onClick() {
|
|
615
|
-
setOpen(false);
|
|
616
571
|
props.onCreate();
|
|
617
572
|
}
|
|
618
573
|
}, "Add new media")));
|
|
@@ -635,17 +590,19 @@ var close = /*#__PURE__*/emotion.css({
|
|
|
635
590
|
});
|
|
636
591
|
|
|
637
592
|
function MissingEntityCard(props) {
|
|
638
|
-
return React__default.createElement(
|
|
593
|
+
return React__default.createElement(f36Components.Card, {
|
|
639
594
|
className: card
|
|
640
595
|
}, React__default.createElement("div", {
|
|
641
596
|
className: props.asSquare ? squareCard : ''
|
|
642
|
-
}, React__default.createElement(
|
|
597
|
+
}, React__default.createElement(f36Components.SectionHeading, {
|
|
598
|
+
marginBottom: "none"
|
|
599
|
+
}, 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, {
|
|
600
|
+
variant: "transparent",
|
|
601
|
+
icon: React__default.createElement(f36Icons.CloseIcon, {
|
|
602
|
+
variant: "muted"
|
|
603
|
+
}),
|
|
643
604
|
className: close,
|
|
644
|
-
|
|
645
|
-
label: "Delete",
|
|
646
|
-
iconProps: {
|
|
647
|
-
icon: 'Close'
|
|
648
|
-
},
|
|
605
|
+
"aria-label": "Delete",
|
|
649
606
|
onClick: function onClick() {
|
|
650
607
|
props.onRemove && props.onRemove();
|
|
651
608
|
}
|
|
@@ -1780,67 +1737,20 @@ var formatDateAndTime = function formatDateAndTime(date, _short2) {
|
|
|
1780
1737
|
return formatDate(date, _short2) + " at " + formatTime(date);
|
|
1781
1738
|
};
|
|
1782
1739
|
|
|
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) {
|
|
1740
|
+
var getScheduleTooltipContent = function getScheduleTooltipContent(_ref) {
|
|
1807
1741
|
var job = _ref.job,
|
|
1808
1742
|
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"));
|
|
1743
|
+
return "Will " + job.action.toLowerCase() + " " + formatDateAndTime(job.scheduledFor.datetime).toLowerCase() + "\n " + (jobsCount > 1 && "+ " + (jobsCount - 1) + " more");
|
|
1834
1744
|
};
|
|
1835
1745
|
var ScheduleTooltip = function ScheduleTooltip(_ref2) {
|
|
1836
1746
|
var job = _ref2.job,
|
|
1837
1747
|
jobsCount = _ref2.jobsCount,
|
|
1838
1748
|
children = _ref2.children;
|
|
1839
|
-
return React__default.createElement(
|
|
1840
|
-
|
|
1749
|
+
return React__default.createElement(f36Components.Tooltip, {
|
|
1750
|
+
placement: "top",
|
|
1841
1751
|
testId: job.sys.id,
|
|
1842
|
-
|
|
1843
|
-
content:
|
|
1752
|
+
as: "div",
|
|
1753
|
+
content: getScheduleTooltipContent({
|
|
1844
1754
|
job: job,
|
|
1845
1755
|
jobsCount: jobsCount
|
|
1846
1756
|
})
|
|
@@ -2496,7 +2406,7 @@ var getEntryTitle = fieldEditorShared.entityHelpers.getEntryTitle,
|
|
|
2496
2406
|
getEntityDescription = fieldEditorShared.entityHelpers.getEntityDescription,
|
|
2497
2407
|
getEntryStatus = fieldEditorShared.entityHelpers.getEntryStatus,
|
|
2498
2408
|
getEntryImage = fieldEditorShared.entityHelpers.getEntryImage;
|
|
2499
|
-
var styles$
|
|
2409
|
+
var styles$1 = {
|
|
2500
2410
|
scheduleIcon: /*#__PURE__*/emotion.css({
|
|
2501
2411
|
marginRight: tokens.spacing2Xs
|
|
2502
2412
|
})
|
|
@@ -2551,75 +2461,61 @@ function WrappedEntryCard(props) {
|
|
|
2551
2461
|
localeCode: props.localeCode,
|
|
2552
2462
|
defaultLocaleCode: props.defaultLocaleCode
|
|
2553
2463
|
});
|
|
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;
|
|
2464
|
+
return React.createElement(f36Components.EntryCard, {
|
|
2465
|
+
as: props.entryUrl ? 'a' : 'article',
|
|
2466
|
+
href: props.entryUrl,
|
|
2467
|
+
title: title,
|
|
2468
|
+
description: description,
|
|
2469
|
+
contentType: contentType == null ? void 0 : contentType.name,
|
|
2470
|
+
size: props.size,
|
|
2471
|
+
isSelected: props.isSelected,
|
|
2472
|
+
status: status,
|
|
2473
|
+
icon: React.createElement(ScheduledIconWithTooltip, {
|
|
2474
|
+
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
2475
|
+
entityType: "Entry",
|
|
2476
|
+
entityId: props.entry.sys.id
|
|
2477
|
+
}, React.createElement(f36Icons.ClockIcon, {
|
|
2478
|
+
className: styles$1.scheduleIcon,
|
|
2479
|
+
size: "small",
|
|
2480
|
+
variant: "muted",
|
|
2481
|
+
testId: "schedule-icon"
|
|
2482
|
+
})),
|
|
2483
|
+
thumbnailElement: file && fieldEditorShared.isValidImage(file) ? React.createElement(AssetThumbnail, {
|
|
2484
|
+
file: file
|
|
2485
|
+
}) : undefined,
|
|
2486
|
+
dragHandleRender: props.renderDragHandle,
|
|
2487
|
+
withDragHandle: !!props.renderDragHandle,
|
|
2488
|
+
actions: props.onEdit || props.onRemove ? [props.hasCardEditActions && props.onEdit ? React.createElement(f36Components.MenuItem, {
|
|
2489
|
+
key: "edit",
|
|
2490
|
+
testId: "edit",
|
|
2491
|
+
onClick: function onClick() {
|
|
2619
2492
|
props.onEdit && props.onEdit();
|
|
2620
2493
|
}
|
|
2621
|
-
})
|
|
2622
|
-
|
|
2494
|
+
}, "Edit") : null, props.onRemove ? React.createElement(f36Components.MenuItem, {
|
|
2495
|
+
key: "delete",
|
|
2496
|
+
testId: "delete",
|
|
2497
|
+
onClick: function onClick() {
|
|
2498
|
+
props.onRemove && props.onRemove();
|
|
2499
|
+
}
|
|
2500
|
+
}, "Remove") : null, props.hasMoveOptions && (props.onMoveTop || props.onMoveBottom) ? React.createElement(f36Components.MenuDivider, null) : null, props.hasMoveOptions && props.onMoveTop ? React.createElement(f36Components.MenuItem, {
|
|
2501
|
+
onClick: function onClick() {
|
|
2502
|
+
return props.onMoveTop && props.onMoveTop();
|
|
2503
|
+
},
|
|
2504
|
+
testId: "move-top"
|
|
2505
|
+
}, "Move to top") : null, props.hasMoveOptions && props.onMoveBottom ? React.createElement(f36Components.MenuItem, {
|
|
2506
|
+
onClick: function onClick() {
|
|
2507
|
+
return props.onMoveBottom && props.onMoveBottom();
|
|
2508
|
+
},
|
|
2509
|
+
testId: "move-bottom"
|
|
2510
|
+
}, "Move to bottom") : null].filter(function (item) {
|
|
2511
|
+
return item;
|
|
2512
|
+
}) : [],
|
|
2513
|
+
onClick: function onClick(e) {
|
|
2514
|
+
e.preventDefault();
|
|
2515
|
+
if (!props.isClickable) return;
|
|
2516
|
+
props.onEdit && props.onEdit();
|
|
2517
|
+
}
|
|
2518
|
+
});
|
|
2623
2519
|
}
|
|
2624
2520
|
WrappedEntryCard.defaultProps = defaultProps;
|
|
2625
2521
|
|
|
@@ -2768,9 +2664,9 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2768
2664
|
}
|
|
2769
2665
|
|
|
2770
2666
|
if (entry === undefined) {
|
|
2771
|
-
return React.createElement(
|
|
2667
|
+
return React.createElement(f36Components.EntryCard, {
|
|
2772
2668
|
size: size,
|
|
2773
|
-
|
|
2669
|
+
isLoading: true
|
|
2774
2670
|
});
|
|
2775
2671
|
}
|
|
2776
2672
|
|
|
@@ -2785,7 +2681,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2785
2681
|
size: size,
|
|
2786
2682
|
localeCode: props.sdk.field.locale,
|
|
2787
2683
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
2788
|
-
|
|
2684
|
+
renderDragHandle: props.renderDragHandle,
|
|
2789
2685
|
onEdit: onEdit,
|
|
2790
2686
|
onRemove: onRemoveEntry,
|
|
2791
2687
|
onMoveTop: props.onMoveTop,
|
|
@@ -2942,7 +2838,7 @@ MultipleReferenceEditor.defaultProps = {
|
|
|
2942
2838
|
hasCardEditActions: true
|
|
2943
2839
|
};
|
|
2944
2840
|
|
|
2945
|
-
var styles$
|
|
2841
|
+
var styles$2 = {
|
|
2946
2842
|
containter: /*#__PURE__*/emotion.css({
|
|
2947
2843
|
position: 'relative'
|
|
2948
2844
|
}),
|
|
@@ -2950,18 +2846,23 @@ var styles$3 = {
|
|
|
2950
2846
|
marginBottom: tokens.spacingM
|
|
2951
2847
|
})
|
|
2952
2848
|
};
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2849
|
+
|
|
2850
|
+
var DragHandle = function DragHandle(props) {
|
|
2851
|
+
var SortableDragHandle = reactSortableHoc.SortableHandle(function () {
|
|
2852
|
+
return props.drag;
|
|
2853
|
+
});
|
|
2854
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
2855
|
+
};
|
|
2856
|
+
|
|
2956
2857
|
var SortableLink = /*#__PURE__*/reactSortableHoc.SortableElement(function (props) {
|
|
2957
2858
|
return React__default.createElement("div", {
|
|
2958
|
-
className: styles$
|
|
2859
|
+
className: styles$2.item
|
|
2959
2860
|
}, props.children);
|
|
2960
2861
|
});
|
|
2961
2862
|
var SortableLinkList = /*#__PURE__*/reactSortableHoc.SortableContainer(function (props) {
|
|
2962
2863
|
var lastIndex = props.items.length - 1;
|
|
2963
2864
|
return React__default.createElement("div", {
|
|
2964
|
-
className: styles$
|
|
2865
|
+
className: styles$2.containter
|
|
2965
2866
|
}, props.items.map(function (item, index) {
|
|
2966
2867
|
return React__default.createElement(SortableLink, {
|
|
2967
2868
|
disabled: props.isDisabled,
|
|
@@ -2984,7 +2885,7 @@ var SortableLinkList = /*#__PURE__*/reactSortableHoc.SortableContainer(function
|
|
|
2984
2885
|
onMoveBottom: index !== lastIndex ? function () {
|
|
2985
2886
|
return props.onMove(index, lastIndex);
|
|
2986
2887
|
} : undefined,
|
|
2987
|
-
|
|
2888
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle
|
|
2988
2889
|
})));
|
|
2989
2890
|
}));
|
|
2990
2891
|
});
|
|
@@ -3000,17 +2901,6 @@ function MultipleEntryReferenceEditor(props) {
|
|
|
3000
2901
|
});
|
|
3001
2902
|
}
|
|
3002
2903
|
|
|
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
2904
|
function downloadAsset(url) {
|
|
3015
2905
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
3016
2906
|
}
|
|
@@ -3021,47 +2911,51 @@ function renderAssetInfo(props) {
|
|
|
3021
2911
|
var mimeType = get(entityFile, 'contentType');
|
|
3022
2912
|
var fileSize = get(entityFile, 'details.size');
|
|
3023
2913
|
var image = get(entityFile, 'details.image');
|
|
3024
|
-
return React__default.createElement(
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
2914
|
+
return [React__default.createElement(f36Components.Menu.SectionTitle, {
|
|
2915
|
+
key: "file-section"
|
|
2916
|
+
}, "File info"), fileName && React__default.createElement(f36Components.Menu.Item, {
|
|
2917
|
+
key: "file-name"
|
|
2918
|
+
}, React__default.createElement(f36Components.Text, {
|
|
2919
|
+
isTruncated: true
|
|
2920
|
+
}, fileName)), mimeType && React__default.createElement(f36Components.Menu.Item, {
|
|
2921
|
+
key: "file-type"
|
|
2922
|
+
}, React__default.createElement(f36Components.Text, {
|
|
2923
|
+
isTruncated: true
|
|
2924
|
+
}, mimeType)), fileSize && React__default.createElement(f36Components.Menu.Item, {
|
|
2925
|
+
key: "file-size"
|
|
2926
|
+
}, fieldEditorShared.shortenStorageUnit(fileSize, 'B')), image && React__default.createElement(f36Components.Menu.Item, {
|
|
2927
|
+
key: "file-dimentions"
|
|
2928
|
+
}, image.width + " \xD7 " + image.height)].filter(function (item) {
|
|
2929
|
+
return item;
|
|
2930
|
+
});
|
|
3036
2931
|
}
|
|
3037
2932
|
function renderActions(props) {
|
|
3038
2933
|
var entityFile = props.entityFile,
|
|
3039
2934
|
isDisabled = props.isDisabled,
|
|
3040
2935
|
onEdit = props.onEdit,
|
|
3041
2936
|
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, {
|
|
2937
|
+
return [React__default.createElement(f36Components.Menu.SectionTitle, {
|
|
2938
|
+
key: "section-title"
|
|
2939
|
+
}, "Actions"), onEdit ? React__default.createElement(f36Components.Menu.Item, {
|
|
2940
|
+
key: "edit",
|
|
3051
2941
|
onClick: onEdit,
|
|
3052
2942
|
testId: "card-action-edit"
|
|
3053
|
-
}, "Edit"), entityFile
|
|
2943
|
+
}, "Edit") : null, entityFile ? React__default.createElement(f36Components.Menu.Item, {
|
|
2944
|
+
key: "download",
|
|
3054
2945
|
onClick: function onClick() {
|
|
3055
2946
|
if (typeof entityFile.url === 'string') {
|
|
3056
2947
|
downloadAsset(entityFile.url);
|
|
3057
2948
|
}
|
|
3058
2949
|
},
|
|
3059
2950
|
testId: "card-action-download"
|
|
3060
|
-
}, "Download"), onRemove
|
|
3061
|
-
|
|
2951
|
+
}, "Download") : null, onRemove ? React__default.createElement(f36Components.Menu.Item, {
|
|
2952
|
+
key: "remove",
|
|
2953
|
+
disabled: isDisabled,
|
|
3062
2954
|
onClick: onRemove,
|
|
3063
2955
|
testId: "card-action-remove"
|
|
3064
|
-
}, "Remove"))
|
|
2956
|
+
}, "Remove") : null].filter(function (item) {
|
|
2957
|
+
return item;
|
|
2958
|
+
});
|
|
3065
2959
|
}
|
|
3066
2960
|
|
|
3067
2961
|
var groupToIconMap = {
|
|
@@ -3077,7 +2971,7 @@ var groupToIconMap = {
|
|
|
3077
2971
|
code: 'code',
|
|
3078
2972
|
markup: 'markup'
|
|
3079
2973
|
};
|
|
3080
|
-
var styles$
|
|
2974
|
+
var styles$3 = {
|
|
3081
2975
|
scheduleIcon: /*#__PURE__*/emotion.css({
|
|
3082
2976
|
marginRight: tokens.spacing2Xs
|
|
3083
2977
|
})
|
|
@@ -3125,47 +3019,49 @@ var WrappedAssetCard = function WrappedAssetCard(props) {
|
|
|
3125
3019
|
defaultTitle: 'Untitled'
|
|
3126
3020
|
});
|
|
3127
3021
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3128
|
-
|
|
3022
|
+
var href = getAssetUrl ? getAssetUrl(props.asset.sys.id) : undefined;
|
|
3023
|
+
return React__default.createElement(f36Components.AssetCard, {
|
|
3024
|
+
as: href ? 'a' : 'article',
|
|
3129
3025
|
type: getFileType(entityFile),
|
|
3130
3026
|
title: entityTitle,
|
|
3131
3027
|
className: className,
|
|
3132
|
-
|
|
3133
|
-
href:
|
|
3028
|
+
isSelected: isSelected,
|
|
3029
|
+
href: href,
|
|
3134
3030
|
status: status,
|
|
3135
|
-
|
|
3031
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3136
3032
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3137
3033
|
entityType: "Asset",
|
|
3138
3034
|
entityId: props.asset.sys.id
|
|
3139
|
-
}, React__default.createElement(
|
|
3140
|
-
className: styles$
|
|
3141
|
-
icon: "Clock",
|
|
3035
|
+
}, React__default.createElement(f36Icons.ClockIcon, {
|
|
3036
|
+
className: styles$3.scheduleIcon,
|
|
3142
3037
|
size: "small",
|
|
3143
|
-
|
|
3038
|
+
variant: "muted",
|
|
3144
3039
|
testId: "schedule-icon"
|
|
3145
3040
|
})),
|
|
3146
3041
|
src: entityFile && entityFile.url ? size === 'small' ? entityFile.url + "?w=150&h=150&fit=thumb" : entityFile.url + "?h=300" : '',
|
|
3147
|
-
// @ts-expect-error
|
|
3148
3042
|
onClick: function onClick(e) {
|
|
3149
3043
|
e.preventDefault();
|
|
3150
3044
|
if (!isClickable) return;
|
|
3151
3045
|
onEdit && onEdit();
|
|
3152
3046
|
},
|
|
3153
|
-
|
|
3154
|
-
withDragHandle: !!props.
|
|
3155
|
-
|
|
3047
|
+
dragHandleRender: props.renderDragHandle,
|
|
3048
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3049
|
+
actions: [].concat(renderActions({
|
|
3156
3050
|
entityFile: entityFile,
|
|
3157
3051
|
isDisabled: isDisabled,
|
|
3158
3052
|
onEdit: onEdit,
|
|
3159
3053
|
onRemove: onRemove
|
|
3160
3054
|
}), entityFile ? renderAssetInfo({
|
|
3161
3055
|
entityFile: entityFile
|
|
3162
|
-
}) :
|
|
3056
|
+
}) : []).filter(function (item) {
|
|
3057
|
+
return item;
|
|
3058
|
+
}),
|
|
3163
3059
|
size: size
|
|
3164
3060
|
});
|
|
3165
3061
|
};
|
|
3166
3062
|
WrappedAssetCard.defaultProps = defaultProps$1;
|
|
3167
3063
|
|
|
3168
|
-
var styles$
|
|
3064
|
+
var styles$4 = {
|
|
3169
3065
|
scheduleIcon: /*#__PURE__*/emotion.css({
|
|
3170
3066
|
marginRight: tokens.spacing2Xs
|
|
3171
3067
|
})
|
|
@@ -3193,38 +3089,43 @@ var WrappedAssetLink = function WrappedAssetLink(props) {
|
|
|
3193
3089
|
defaultTitle: 'Untitled'
|
|
3194
3090
|
});
|
|
3195
3091
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3196
|
-
return React__default.createElement(
|
|
3092
|
+
return React__default.createElement(f36Components.EntryCard, {
|
|
3093
|
+
as: href ? 'a' : 'article',
|
|
3197
3094
|
contentType: "Asset",
|
|
3198
3095
|
title: entityTitle,
|
|
3199
3096
|
className: className,
|
|
3200
3097
|
href: href,
|
|
3201
3098
|
size: "small",
|
|
3202
3099
|
status: status,
|
|
3203
|
-
|
|
3100
|
+
thumbnailElement: entityFile && fieldEditorShared.isValidImage(entityFile) ? React__default.createElement(AssetThumbnail, {
|
|
3101
|
+
file: entityFile
|
|
3102
|
+
}) : undefined,
|
|
3103
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3204
3104
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3205
3105
|
entityType: "Asset",
|
|
3206
3106
|
entityId: props.asset.sys.id
|
|
3207
|
-
}, React__default.createElement(
|
|
3208
|
-
className: styles$
|
|
3209
|
-
icon: "Clock",
|
|
3107
|
+
}, React__default.createElement(f36Icons.ClockIcon, {
|
|
3108
|
+
className: styles$4.scheduleIcon,
|
|
3210
3109
|
size: "small",
|
|
3211
|
-
|
|
3110
|
+
variant: "muted",
|
|
3212
3111
|
testId: "schedule-icon"
|
|
3213
3112
|
})),
|
|
3214
3113
|
onClick: function onClick(e) {
|
|
3215
3114
|
e.preventDefault();
|
|
3216
3115
|
onEdit();
|
|
3217
3116
|
},
|
|
3218
|
-
|
|
3219
|
-
withDragHandle: !!props.
|
|
3220
|
-
|
|
3117
|
+
dragHandleRender: props.renderDragHandle,
|
|
3118
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3119
|
+
actions: [renderActions({
|
|
3221
3120
|
entityFile: entityFile,
|
|
3222
3121
|
isDisabled: isDisabled,
|
|
3223
3122
|
onEdit: onEdit,
|
|
3224
3123
|
onRemove: onRemove
|
|
3225
3124
|
}), entityFile ? renderAssetInfo({
|
|
3226
3125
|
entityFile: entityFile
|
|
3227
|
-
}) :
|
|
3126
|
+
}) : null].filter(function (item) {
|
|
3127
|
+
return item;
|
|
3128
|
+
})
|
|
3228
3129
|
});
|
|
3229
3130
|
};
|
|
3230
3131
|
|
|
@@ -3327,16 +3228,16 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3327
3228
|
isDisabled: props.isDisabled,
|
|
3328
3229
|
localeCode: props.sdk.field.locale,
|
|
3329
3230
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
3330
|
-
|
|
3231
|
+
renderDragHandle: props.renderDragHandle,
|
|
3331
3232
|
onEdit: onEdit,
|
|
3332
3233
|
onRemove: onRemove
|
|
3333
3234
|
};
|
|
3334
3235
|
|
|
3335
3236
|
if (props.viewType === 'link') {
|
|
3336
3237
|
if (asset === undefined) {
|
|
3337
|
-
return React.createElement(
|
|
3238
|
+
return React.createElement(f36Components.EntryCard, {
|
|
3338
3239
|
size: "small",
|
|
3339
|
-
|
|
3240
|
+
isLoading: true
|
|
3340
3241
|
});
|
|
3341
3242
|
}
|
|
3342
3243
|
|
|
@@ -3347,12 +3248,9 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3347
3248
|
}
|
|
3348
3249
|
|
|
3349
3250
|
if (asset === undefined) {
|
|
3350
|
-
return React.createElement(
|
|
3251
|
+
return React.createElement(f36Components.AssetCard, {
|
|
3351
3252
|
size: size,
|
|
3352
|
-
isLoading: true
|
|
3353
|
-
title: "",
|
|
3354
|
-
src: "",
|
|
3355
|
-
href: ""
|
|
3253
|
+
isLoading: true
|
|
3356
3254
|
});
|
|
3357
3255
|
}
|
|
3358
3256
|
|
|
@@ -3405,7 +3303,7 @@ SingleMediaEditor.defaultProps = {
|
|
|
3405
3303
|
isInitiallyDisabled: true
|
|
3406
3304
|
};
|
|
3407
3305
|
|
|
3408
|
-
var styles$
|
|
3306
|
+
var styles$5 = {
|
|
3409
3307
|
gridContainter: /*#__PURE__*/emotion.css({
|
|
3410
3308
|
position: 'relative',
|
|
3411
3309
|
display: 'flex',
|
|
@@ -3419,17 +3317,22 @@ var styles$7 = {
|
|
|
3419
3317
|
marginRight: tokens.spacingM
|
|
3420
3318
|
})
|
|
3421
3319
|
};
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3320
|
+
|
|
3321
|
+
var DragHandle$1 = function DragHandle(props) {
|
|
3322
|
+
var SortableDragHandle = reactSortableHoc.SortableHandle(function () {
|
|
3323
|
+
return props.drag;
|
|
3324
|
+
});
|
|
3325
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
3326
|
+
};
|
|
3327
|
+
|
|
3425
3328
|
var SortableLink$1 = /*#__PURE__*/reactSortableHoc.SortableElement(function (props) {
|
|
3426
3329
|
return React__default.createElement("div", {
|
|
3427
|
-
className: styles$
|
|
3330
|
+
className: styles$5.item
|
|
3428
3331
|
}, props.children);
|
|
3429
3332
|
});
|
|
3430
3333
|
var SortableLinkList$1 = /*#__PURE__*/reactSortableHoc.SortableContainer(function (props) {
|
|
3431
3334
|
return React__default.createElement("div", {
|
|
3432
|
-
className: props.viewType === 'card' ? styles$
|
|
3335
|
+
className: props.viewType === 'card' ? styles$5.gridContainter : styles$5.container
|
|
3433
3336
|
}, props.items.map(function (item, index) {
|
|
3434
3337
|
return React__default.createElement(SortableLink$1, {
|
|
3435
3338
|
disabled: props.isDisabled,
|
|
@@ -3444,7 +3347,7 @@ var SortableLinkList$1 = /*#__PURE__*/reactSortableHoc.SortableContainer(functio
|
|
|
3444
3347
|
return i !== index;
|
|
3445
3348
|
}));
|
|
3446
3349
|
},
|
|
3447
|
-
|
|
3350
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle$1
|
|
3448
3351
|
})));
|
|
3449
3352
|
}));
|
|
3450
3353
|
});
|
|
@@ -3471,11 +3374,11 @@ exports.EntityProvider = EntityProvider;
|
|
|
3471
3374
|
exports.MissingEntityCard = MissingEntityCard;
|
|
3472
3375
|
exports.MultipleEntryReferenceEditor = MultipleEntryReferenceEditor;
|
|
3473
3376
|
exports.MultipleMediaEditor = MultipleMediaEditor;
|
|
3474
|
-
exports.ScheduleTooltipContent = ScheduleTooltipContent;
|
|
3475
3377
|
exports.ScheduledIconWithTooltip = ScheduledIconWithTooltip;
|
|
3476
3378
|
exports.SingleEntryReferenceEditor = SingleEntryReferenceEditor;
|
|
3477
3379
|
exports.SingleMediaEditor = SingleMediaEditor;
|
|
3478
3380
|
exports.WrappedAssetCard = WrappedAssetCard;
|
|
3479
3381
|
exports.WrappedEntryCard = WrappedEntryCard;
|
|
3382
|
+
exports.getScheduleTooltipContent = getScheduleTooltipContent;
|
|
3480
3383
|
exports.useEntities = useEntities;
|
|
3481
3384
|
//# sourceMappingURL=field-editor-reference.cjs.development.js.map
|