@webiny/app-headless-cms 5.40.5 → 5.41.0-dbt.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.
Files changed (89) hide show
  1. package/ContentEntryEditorConfig.d.ts +245 -43
  2. package/ContentEntryListConfig.d.ts +82 -16
  3. package/admin/components/ContentEntries/BulkActions/ActionDelete.js +15 -5
  4. package/admin/components/ContentEntries/BulkActions/ActionDelete.js.map +1 -1
  5. package/admin/components/ContentEntries/BulkActions/ActionMove.js +16 -4
  6. package/admin/components/ContentEntries/BulkActions/ActionMove.js.map +1 -1
  7. package/admin/components/ContentEntries/BulkActions/ActionPublish.js +15 -5
  8. package/admin/components/ContentEntries/BulkActions/ActionPublish.js.map +1 -1
  9. package/admin/components/ContentEntries/BulkActions/ActionUnpublish.js +15 -5
  10. package/admin/components/ContentEntries/BulkActions/ActionUnpublish.js.map +1 -1
  11. package/admin/components/ContentEntries/BulkActions/BulkActions.d.ts +1 -1
  12. package/admin/components/ContentEntries/BulkActions/BulkActions.js +15 -6
  13. package/admin/components/ContentEntries/BulkActions/BulkActions.js.map +1 -1
  14. package/admin/components/ContentEntries/SelectAll/Messages.d.ts +7 -0
  15. package/admin/components/ContentEntries/SelectAll/Messages.js +29 -0
  16. package/admin/components/ContentEntries/SelectAll/Messages.js.map +1 -0
  17. package/admin/components/ContentEntries/SelectAll/SelectAll.d.ts +3 -0
  18. package/admin/components/ContentEntries/SelectAll/SelectAll.js +32 -0
  19. package/admin/components/ContentEntries/SelectAll/SelectAll.js.map +1 -0
  20. package/admin/components/ContentEntries/SelectAll/SelectAll.styled.d.ts +12 -0
  21. package/admin/components/ContentEntries/SelectAll/SelectAll.styled.js +54 -0
  22. package/admin/components/ContentEntries/SelectAll/SelectAll.styled.js.map +1 -0
  23. package/admin/components/ContentEntries/SelectAll/index.d.ts +1 -0
  24. package/admin/components/ContentEntries/SelectAll/index.js +18 -0
  25. package/admin/components/ContentEntries/SelectAll/index.js.map +1 -0
  26. package/admin/components/ContentEntries/Table/Cells/CellActions.d.ts +15 -3
  27. package/admin/components/ContentEntries/TrashBin/adapters/TrashBinBulkActionsGraphQLGateway.d.ts +12 -0
  28. package/admin/components/ContentEntries/TrashBin/adapters/TrashBinBulkActionsGraphQLGateway.js +40 -0
  29. package/admin/components/ContentEntries/TrashBin/adapters/TrashBinBulkActionsGraphQLGateway.js.map +1 -0
  30. package/admin/components/ContentEntries/TrashBin/adapters/index.d.ts +1 -0
  31. package/admin/components/ContentEntries/TrashBin/adapters/index.js +11 -0
  32. package/admin/components/ContentEntries/TrashBin/adapters/index.js.map +1 -1
  33. package/admin/components/ContentEntries/TrashBin/components/TrashBin.js +6 -0
  34. package/admin/components/ContentEntries/TrashBin/components/TrashBin.js.map +1 -1
  35. package/admin/components/ContentEntryForm/ContentEntryForm.d.ts +15 -3
  36. package/admin/components/ContentEntryForm/ContentEntryFormPreview.d.ts +15 -3
  37. package/admin/components/ContentEntryForm/FieldElement.d.ts +31 -7
  38. package/admin/components/ContentEntryForm/Header/RevisionSelector/RevisionSelector.styles.d.ts +7 -7
  39. package/admin/components/ContentModelEditor/ContentModelEditor.d.ts +15 -3
  40. package/admin/components/Droppable.d.ts +1 -1
  41. package/admin/components/FieldEditor/utils/deleteField.d.ts +1 -1
  42. package/admin/components/ModelFieldProvider/ModelFieldContext.d.ts +2 -2
  43. package/admin/components/ModelProvider/ModelContext.d.ts +1 -1
  44. package/admin/components/ModelProvider/useModel.d.ts +1 -1
  45. package/admin/config/contentEntries/editor/Actions/ButtonAction.d.ts +32 -8
  46. package/admin/config/contentEntries/editor/Actions/MenuItemAction.d.ts +32 -8
  47. package/admin/config/contentEntries/editor/Actions/index.d.ts +31 -7
  48. package/admin/config/contentEntries/editor/ContentEntryEditorConfig.d.ts +35 -7
  49. package/admin/config/contentEntries/editor/FieldElement.d.ts +5 -1
  50. package/admin/config/contentEntries/list/Browser/BulkAction.d.ts +32 -6
  51. package/admin/config/contentEntries/list/Browser/BulkAction.js +17 -2
  52. package/admin/config/contentEntries/list/Browser/BulkAction.js.map +1 -1
  53. package/admin/config/contentEntries/list/Browser/EntryAction.d.ts +15 -3
  54. package/admin/config/contentEntries/list/Browser/Filter.d.ts +20 -4
  55. package/admin/config/contentEntries/list/Browser/Table/Column.d.ts +15 -3
  56. package/admin/config/contentEntries/list/Browser/Table/index.d.ts +15 -3
  57. package/admin/config/contentEntries/list/Browser/index.d.ts +67 -13
  58. package/admin/config/contentEntries/list/ContentEntryListConfig.d.ts +67 -13
  59. package/admin/constants.d.ts +1 -1
  60. package/admin/contexts/Cms/index.d.ts +20 -8
  61. package/admin/contexts/Cms/index.js +42 -0
  62. package/admin/contexts/Cms/index.js.map +1 -1
  63. package/admin/hooks/useModelFieldGraphqlContext.d.ts +1 -1
  64. package/admin/hooks/usePermission.d.ts +1 -1
  65. package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.d.ts +46 -10
  66. package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.d.ts +1 -1
  67. package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.d.ts +106 -16
  68. package/admin/plugins/fieldRenderers/dynamicZone/TemplateItem.d.ts +15 -3
  69. package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.d.ts +16 -4
  70. package/admin/plugins/fieldRenderers/object/FieldSettings.d.ts +1 -1
  71. package/admin/plugins/fieldRenderers/ref/components/useReference.d.ts +1 -1
  72. package/admin/plugins/fields/ref/renderInfo.d.ts +1 -1
  73. package/admin/plugins/index.d.ts +3 -3
  74. package/admin/views/contentEntries/ContentEntries.d.ts +15 -3
  75. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.d.ts +7 -7
  76. package/admin/views/contentEntries/ContentEntry/RevisionsList/PublishEntryRevisionListItem.d.ts +15 -3
  77. package/admin/views/contentEntries/ContentEntry.d.ts +15 -3
  78. package/admin/views/contentEntries/Table/Main.js +2 -1
  79. package/admin/views/contentEntries/Table/Main.js.map +1 -1
  80. package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +6 -0
  81. package/admin/views/contentEntries/hooks/useContentEntriesList.js +13 -2
  82. package/admin/views/contentEntries/hooks/useContentEntriesList.js.map +1 -1
  83. package/admin/views/contentModelGroups/graphql.d.ts +1 -1
  84. package/admin/views/contentModels/OptionsMenu.d.ts +15 -3
  85. package/admin/views/utils.d.ts +1 -1
  86. package/allPlugins.d.ts +4 -4
  87. package/index.d.ts +20 -4
  88. package/package.json +29 -29
  89. package/types.d.ts +2 -2
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ActionDelete = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
9
9
  var _delete = require("@material-design-icons/svg/outlined/delete.svg");
10
10
  var _mobxReactLite = require("mobx-react-lite");
11
11
  var _parseIdentifier2 = require("@webiny/utils/parseIdentifier");
12
12
  var _appAco = require("@webiny/app-aco");
13
+ var _appAdmin = require("@webiny/app-admin");
13
14
  var _contentEntries = require("../../../config/contentEntries");
14
15
  var _hooks = require("../../../hooks");
15
16
  var _BulkActions = require("./BulkActions");
@@ -20,6 +21,8 @@ var ActionDelete = exports.ActionDelete = (0, _mobxReactLite.observer)(function
20
21
  deleteEntry = _useCms.deleteEntry;
21
22
  var _useRecords = (0, _appAco.useRecords)(),
22
23
  removeRecordFromCache = _useRecords.removeRecordFromCache;
24
+ var _useSnackbar = (0, _appAdmin.useSnackbar)(),
25
+ showSnackbar = _useSnackbar.showSnackbar;
23
26
  var _ContentEntryListConf = _contentEntries.ContentEntryListConfig.Browser.BulkAction,
24
27
  useWorker = _ContentEntryListConf.useWorker,
25
28
  useButtons = _ContentEntryListConf.useButtons,
@@ -30,15 +33,22 @@ var ActionDelete = exports.ActionDelete = (0, _mobxReactLite.observer)(function
30
33
  var _useDialog = useDialog(),
31
34
  showConfirmationDialog = _useDialog.showConfirmationDialog,
32
35
  showResultsDialog = _useDialog.showResultsDialog;
33
- var entriesLabel = (0, _react.useMemo)(function () {
34
- return (0, _BulkActions.getEntriesLabel)(worker.items.length);
35
- }, [worker.items.length]);
36
+ var entriesLabel = (0, _BulkActions.getEntriesLabel)();
36
37
  var openDeleteEntriesDialog = function openDeleteEntriesDialog() {
37
38
  return showConfirmationDialog({
38
39
  title: "Trash entries",
39
40
  message: "You are about to move ".concat(entriesLabel, " to trash. Are you sure you want to continue?"),
40
41
  loadingLabel: "Processing ".concat(entriesLabel),
41
42
  execute: async function execute() {
43
+ if (worker.isSelectedAll) {
44
+ await worker.processInBulk("MoveToTrash");
45
+ worker.resetItems();
46
+ showSnackbar("All entries will be moved to trash. This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running.", {
47
+ dismissIcon: true,
48
+ timeout: -1
49
+ });
50
+ return;
51
+ }
42
52
  await worker.processInSeries(async function (_ref) {
43
53
  var item = _ref.item,
44
54
  report = _ref.report;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_delete","_mobxReactLite","_parseIdentifier2","_appAco","_contentEntries","_hooks","_BulkActions","ActionDelete","exports","observer","_useModel","useModel","model","_useCms","useCms","deleteEntry","_useRecords","useRecords","removeRecordFromCache","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","entriesLabel","useMemo","getEntriesLabel","items","length","openDeleteEntriesDialog","title","message","concat","loadingLabel","execute","processInSeries","_ref","item","report","_parseIdentifier","parseIdentifier","id","response","Error","error","success","meta","e","resetItems","results","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionDelete.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ReactComponent as DeleteIcon } from \"@material-design-icons/svg/outlined/delete.svg\";\nimport { observer } from \"mobx-react-lite\";\nimport { parseIdentifier } from \"@webiny/utils/parseIdentifier\";\nimport { useRecords } from \"@webiny/app-aco\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { useCms, useModel } from \"~/admin/hooks\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\n\nexport const ActionDelete = observer(() => {\n const { model } = useModel();\n const { deleteEntry } = useCms();\n const { removeRecordFromCache } = useRecords();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n\n const entriesLabel = useMemo(() => {\n return getEntriesLabel(worker.items.length);\n }, [worker.items.length]);\n\n const openDeleteEntriesDialog = () =>\n showConfirmationDialog({\n title: \"Trash entries\",\n message: `You are about to move ${entriesLabel} to trash. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n await worker.processInSeries(async ({ item, report }) => {\n try {\n /**\n * We need an entryId because we want to delete all revisions of the entry.\n * By sending an entryId (id without #version), we are telling to the API to delete all revisions.\n */\n const { id } = parseIdentifier(item.id);\n const response = await deleteEntry({ model, id });\n\n if (typeof response !== \"boolean\") {\n throw new Error(\n response.error.message ||\n \"Unknown error while moving the entry to trash.\"\n );\n }\n\n removeRecordFromCache(id);\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully moved to trash.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Trash entries\",\n message: \"Finished moving entries to trash! See full report below:\"\n });\n }\n });\n\n return (\n <IconButton\n icon={<DeleteIcon />}\n onAction={openDeleteEntriesDialog}\n label={`Trash ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;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AAC4B,UAAU,CAAC,CAAC;QAEnBzB,iBAAiB,CAAC;UACd0B,OAAO,EAAE7B,MAAM,CAAC6B,OAAO;UACvBnB,KAAK,EAAE,eAAe;UACtBC,OAAO,EAAE;QACb,CAAC,CAAC;MACN;IACJ,CAAC,CAAC;EAAA;EAEN,oBACI1C,MAAA,CAAA6D,OAAA,CAAAC,aAAA,CAAChC,UAAU;IACPiC,IAAI,eAAE/D,MAAA,CAAA6D,OAAA,CAAAC,aAAA,CAAC3D,OAAA,CAAA6D,cAAU,MAAE,CAAE;IACrBC,QAAQ,EAAEzB,uBAAwB;IAClC0B,KAAK,WAAAvB,MAAA,CAAWR,YAAY,CAAG;IAC/BgC,gBAAgB,EAAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_delete","_mobxReactLite","_parseIdentifier2","_appAco","_appAdmin","_contentEntries","_hooks","_BulkActions","ActionDelete","exports","observer","_useModel","useModel","model","_useCms","useCms","deleteEntry","_useRecords","useRecords","removeRecordFromCache","_useSnackbar","useSnackbar","showSnackbar","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","entriesLabel","getEntriesLabel","openDeleteEntriesDialog","title","message","concat","loadingLabel","execute","isSelectedAll","processInBulk","resetItems","dismissIcon","timeout","processInSeries","_ref","item","report","_parseIdentifier","parseIdentifier","id","response","Error","error","success","meta","e","results","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionDelete.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as DeleteIcon } from \"@material-design-icons/svg/outlined/delete.svg\";\nimport { observer } from \"mobx-react-lite\";\nimport { parseIdentifier } from \"@webiny/utils/parseIdentifier\";\nimport { useRecords } from \"@webiny/app-aco\";\nimport { useSnackbar } from \"@webiny/app-admin\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { useCms, useModel } from \"~/admin/hooks\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\n\nexport const ActionDelete = observer(() => {\n const { model } = useModel();\n const { deleteEntry } = useCms();\n const { removeRecordFromCache } = useRecords();\n const { showSnackbar } = useSnackbar();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n\n const entriesLabel = getEntriesLabel();\n\n const openDeleteEntriesDialog = () =>\n showConfirmationDialog({\n title: \"Trash entries\",\n message: `You are about to move ${entriesLabel} to trash. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n if (worker.isSelectedAll) {\n await worker.processInBulk(\"MoveToTrash\");\n worker.resetItems();\n showSnackbar(\n \"All entries will be moved to trash. This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running.\",\n {\n dismissIcon: true,\n timeout: -1\n }\n );\n return;\n }\n\n await worker.processInSeries(async ({ item, report }) => {\n try {\n /**\n * We need an entryId because we want to delete all revisions of the entry.\n * By sending an entryId (id without #version), we are telling to the API to delete all revisions.\n */\n const { id } = parseIdentifier(item.id);\n const response = await deleteEntry({ model, id });\n\n if (typeof response !== \"boolean\") {\n throw new Error(\n response.error.message ||\n \"Unknown error while moving the entry to trash.\"\n );\n }\n\n removeRecordFromCache(id);\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully moved to trash.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Trash entries\",\n message: \"Finished moving entries to trash! See full report below:\"\n });\n }\n });\n\n return (\n <IconButton\n icon={<DeleteIcon />}\n onAction={openDeleteEntriesDialog}\n label={`Trash ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":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AC,CAAC;UACN,CAAC,CAAC,OAAOqB,CAAC,EAAE;YACRT,MAAM,CAACM,KAAK,CAAC;cACTnB,KAAK,KAAAE,MAAA,CAAKU,IAAI,CAACS,IAAI,CAACrB,KAAK,CAAE;cAC3BC,OAAO,EAAEqB,CAAC,CAACrB;YACf,CAAC,CAAC;UACN;QACJ,CAAC,CAAC;QAEFR,MAAM,CAACc,UAAU,CAAC,CAAC;QAEnBX,iBAAiB,CAAC;UACd2B,OAAO,EAAE9B,MAAM,CAAC8B,OAAO;UACvBvB,KAAK,EAAE,eAAe;UACtBC,OAAO,EAAE;QACb,CAAC,CAAC;MACN;IACJ,CAAC,CAAC;EAAA;EAEN,oBACI3C,MAAA,CAAAkE,OAAA,CAAAC,aAAA,CAACjC,UAAU;IACPkC,IAAI,eAAEpE,MAAA,CAAAkE,OAAA,CAAAC,aAAA,CAAChE,OAAA,CAAAkE,cAAU,MAAE,CAAE;IACrBC,QAAQ,EAAE7B,uBAAwB;IAClC8B,KAAK,WAAA3B,MAAA,CAAWL,YAAY,CAAG;IAC/BiC,gBAAgB,EAAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -8,6 +8,7 @@ exports.ActionMove = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _drive_file_move = require("@material-design-icons/svg/outlined/drive_file_move.svg");
10
10
  var _appAco = require("@webiny/app-aco");
11
+ var _appAdmin = require("@webiny/app-admin");
11
12
  var _mobxReactLite = require("mobx-react-lite");
12
13
  var _contentEntries = require("../../../config/contentEntries");
13
14
  var _constants = require("../../../constants");
@@ -17,6 +18,8 @@ var ActionMove = exports.ActionMove = (0, _mobxReactLite.observer)(function () {
17
18
  moveRecord = _useRecords.moveRecord;
18
19
  var _useNavigateFolder = (0, _appAco.useNavigateFolder)(),
19
20
  currentFolderId = _useNavigateFolder.currentFolderId;
21
+ var _useSnackbar = (0, _appAdmin.useSnackbar)(),
22
+ showSnackbar = _useSnackbar.showSnackbar;
20
23
  var _ContentEntryListConf = _contentEntries.ContentEntryListConfig.Browser.BulkAction,
21
24
  useWorker = _ContentEntryListConf.useWorker,
22
25
  useButtons = _ContentEntryListConf.useButtons,
@@ -29,15 +32,24 @@ var ActionMove = exports.ActionMove = (0, _mobxReactLite.observer)(function () {
29
32
  showResultsDialog = _useDialog.showResultsDialog;
30
33
  var _useMoveToFolderDialo = (0, _appAco.useMoveToFolderDialog)(),
31
34
  showMoveDialog = _useMoveToFolderDialo.showDialog;
32
- var entriesLabel = (0, _react.useMemo)(function () {
33
- return (0, _BulkActions.getEntriesLabel)(worker.items.length);
34
- }, [worker.items.length]);
35
+ var entriesLabel = (0, _BulkActions.getEntriesLabel)();
35
36
  var openWorkerDialog = (0, _react.useCallback)(function (folder) {
36
37
  showConfirmationDialog({
37
38
  title: "Move entries",
38
39
  message: "You are about to move ".concat(entriesLabel, " to ").concat(folder.title, ". Are you sure you want to continue?"),
39
40
  loadingLabel: "Processing ".concat(entriesLabel),
40
41
  execute: async function execute() {
42
+ if (worker.isSelectedAll) {
43
+ await worker.processInBulk("MoveToFolder", {
44
+ folderId: folder.id
45
+ });
46
+ worker.resetItems();
47
+ showSnackbar("All entries will be moved to ".concat(folder.title, ". This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running."), {
48
+ dismissIcon: true,
49
+ timeout: -1
50
+ });
51
+ return;
52
+ }
41
53
  await worker.processInSeries(async function (_ref) {
42
54
  var item = _ref.item,
43
55
  report = _ref.report;
@@ -67,7 +79,7 @@ var ActionMove = exports.ActionMove = (0, _mobxReactLite.observer)(function () {
67
79
  });
68
80
  }
69
81
  });
70
- }, [entriesLabel]);
82
+ }, [entriesLabel, worker.isSelectedAll]);
71
83
  var openMoveEntriesDialog = function openMoveEntriesDialog() {
72
84
  return showMoveDialog({
73
85
  title: "Select folder",
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_drive_file_move","_appAco","_mobxReactLite","_contentEntries","_constants","_BulkActions","ActionMove","exports","observer","_useRecords","useRecords","moveRecord","_useNavigateFolder","useNavigateFolder","currentFolderId","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","_useMoveToFolderDialo","useMoveToFolderDialog","showMoveDialog","showDialog","entriesLabel","useMemo","getEntriesLabel","items","length","openWorkerDialog","useCallback","folder","title","message","concat","loadingLabel","execute","processInSeries","_ref","item","report","id","location","folderId","success","meta","e","error","resetItems","results","openMoveEntriesDialog","acceptLabel","focusedFolderId","ROOT_FOLDER","onAccept","_ref2","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionMove.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { ReactComponent as MoveIcon } from \"@material-design-icons/svg/outlined/drive_file_move.svg\";\nimport { useRecords, useMoveToFolderDialog, useNavigateFolder } from \"@webiny/app-aco\";\nimport { FolderItem } from \"@webiny/app-aco/types\";\nimport { observer } from \"mobx-react-lite\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { ROOT_FOLDER } from \"~/admin/constants\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\n\nexport const ActionMove = observer(() => {\n const { moveRecord } = useRecords();\n const { currentFolderId } = useNavigateFolder();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n const { showDialog: showMoveDialog } = useMoveToFolderDialog();\n\n const entriesLabel = useMemo(() => {\n return getEntriesLabel(worker.items.length);\n }, [worker.items.length]);\n\n const openWorkerDialog = useCallback(\n (folder: FolderItem) => {\n showConfirmationDialog({\n title: \"Move entries\",\n message: `You are about to move ${entriesLabel} to ${folder.title}. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n await worker.processInSeries(async ({ item, report }) => {\n try {\n await moveRecord({\n id: item.id,\n location: {\n folderId: folder.id\n }\n });\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully moved.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Move entries\",\n message: \"Finished moving entries! See full report below:\"\n });\n }\n });\n },\n [entriesLabel]\n );\n\n const openMoveEntriesDialog = () =>\n showMoveDialog({\n title: \"Select folder\",\n message: \"Select a new location for selected entries:\",\n loadingLabel: `Processing ${entriesLabel}`,\n acceptLabel: `Move`,\n focusedFolderId: currentFolderId || ROOT_FOLDER,\n async onAccept({ folder }) {\n openWorkerDialog(folder);\n }\n });\n\n return (\n <IconButton\n icon={<MoveIcon />}\n onAction={openMoveEntriesDialog}\n label={`Move ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAEO,IAAMO,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,IAAAE,uBAAQ,EAAC,YAAM;EACrC,IAAAC,WAAA,GAAuB,IAAAC,kBAAU,EAAC,CAAC;IAA3BC,UAAU,GAAAF,WAAA,CAAVE,UAAU;EAClB,IAAAC,kBAAA,GAA4B,IAAAC,yBAAiB,EAAC,CAAC;IAAvCC,eAAe,GAAAF,kBAAA,CAAfE,eAAe;EAEvB,IAAAC,qBAAA,GAA6CC,sCAAsB,CAACC,OAAO,CAACC,UAAU;IAA9EC,SAAS,GAAAJ,qBAAA,CAATI,SAAS;IAAEC,UAAU,GAAAL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CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_drive_file_move","_appAco","_appAdmin","_mobxReactLite","_contentEntries","_constants","_BulkActions","ActionMove","exports","observer","_useRecords","useRecords","moveRecord","_useNavigateFolder","useNavigateFolder","currentFolderId","_useSnackbar","useSnackbar","showSnackbar","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","_useMoveToFolderDialo","useMoveToFolderDialog","showMoveDialog","showDialog","entriesLabel","getEntriesLabel","openWorkerDialog","useCallback","folder","title","message","concat","loadingLabel","execute","isSelectedAll","processInBulk","folderId","id","resetItems","dismissIcon","timeout","processInSeries","_ref","item","report","location","success","meta","e","error","results","openMoveEntriesDialog","acceptLabel","focusedFolderId","ROOT_FOLDER","onAccept","_ref2","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionMove.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport { ReactComponent as MoveIcon } from \"@material-design-icons/svg/outlined/drive_file_move.svg\";\nimport { useRecords, useMoveToFolderDialog, useNavigateFolder } from \"@webiny/app-aco\";\nimport { useSnackbar } from \"@webiny/app-admin\";\nimport { FolderItem } from \"@webiny/app-aco/types\";\nimport { observer } from \"mobx-react-lite\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { ROOT_FOLDER } from \"~/admin/constants\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\n\nexport const ActionMove = observer(() => {\n const { moveRecord } = useRecords();\n const { currentFolderId } = useNavigateFolder();\n const { showSnackbar } = useSnackbar();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n const { showDialog: showMoveDialog } = useMoveToFolderDialog();\n\n const entriesLabel = getEntriesLabel();\n\n const openWorkerDialog = useCallback(\n (folder: FolderItem) => {\n showConfirmationDialog({\n title: \"Move entries\",\n message: `You are about to move ${entriesLabel} to ${folder.title}. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n if (worker.isSelectedAll) {\n await worker.processInBulk(\"MoveToFolder\", {\n folderId: folder.id\n });\n worker.resetItems();\n showSnackbar(\n `All entries will be moved to ${folder.title}. This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running.`,\n {\n dismissIcon: true,\n timeout: -1\n }\n );\n return;\n }\n\n await worker.processInSeries(async ({ item, report }) => {\n try {\n await moveRecord({\n id: item.id,\n location: {\n folderId: folder.id\n }\n });\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully moved.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Move entries\",\n message: \"Finished moving entries! See full report below:\"\n });\n }\n });\n },\n [entriesLabel, worker.isSelectedAll]\n );\n\n const openMoveEntriesDialog = () =>\n showMoveDialog({\n title: \"Select folder\",\n message: \"Select a new location for selected entries:\",\n loadingLabel: `Processing ${entriesLabel}`,\n acceptLabel: `Move`,\n focusedFolderId: currentFolderId || ROOT_FOLDER,\n async onAccept({ folder }) {\n openWorkerDialog(folder);\n }\n });\n\n return (\n <IconButton\n icon={<MoveIcon />}\n onAction={openMoveEntriesDialog}\n label={`Move ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OA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;EACN,CAAC,EACD,CAACN,YAAY,EAAER,MAAM,CAACkB,aAAa,CACvC,CAAC;EAED,IAAMiB,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAA;IAAA,OACvB7B,cAAc,CAAC;MACXO,KAAK,EAAE,eAAe;MACtBC,OAAO,EAAE,6CAA6C;MACtDE,YAAY,gBAAAD,MAAA,CAAgBP,YAAY,CAAE;MAC1C4B,WAAW,QAAQ;MACnBC,eAAe,EAAElD,eAAe,IAAImD,sBAAW;MACzCC,QAAQ,iBAAAA,SAAAC,KAAA,EAAa;QAAA,IAAV5B,MAAM,GAAA4B,KAAA,CAAN5B,MAAM;QACnBF,gBAAgB,CAACE,MAAM,CAAC;MAC5B;IACJ,CAAC,CAAC;EAAA;EAEN,oBACI3C,MAAA,CAAAwE,OAAA,CAAAC,aAAA,CAAC3C,UAAU;IACP4C,IAAI,eAAE1E,MAAA,CAAAwE,OAAA,CAAAC,aAAA,CAACtE,gBAAA,CAAAwE,cAAQ,MAAE,CAAE;IACnBC,QAAQ,EAAEV,qBAAsB;IAChCW,KAAK,UAAA/B,MAAA,CAAUP,YAAY,CAAG;IAC9BuC,gBAAgB,EAAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ActionPublish = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
9
9
  var _publish = require("@material-design-icons/svg/outlined/publish.svg");
10
10
  var _mobxReactLite = require("mobx-react-lite");
11
11
  var _contentEntries = require("../../../config/contentEntries");
12
12
  var _hooks = require("../../../hooks");
13
13
  var _BulkActions = require("./BulkActions");
14
14
  var _appAco = require("@webiny/app-aco");
15
+ var _appAdmin = require("@webiny/app-admin");
15
16
  var ActionPublish = exports.ActionPublish = (0, _mobxReactLite.observer)(function () {
16
17
  var _useModel = (0, _hooks.useModel)(),
17
18
  model = _useModel.model;
@@ -21,6 +22,8 @@ var ActionPublish = exports.ActionPublish = (0, _mobxReactLite.observer)(functio
21
22
  publishEntryRevision = _useCms.publishEntryRevision;
22
23
  var _useRecords = (0, _appAco.useRecords)(),
23
24
  updateRecordInCache = _useRecords.updateRecordInCache;
25
+ var _useSnackbar = (0, _appAdmin.useSnackbar)(),
26
+ showSnackbar = _useSnackbar.showSnackbar;
24
27
  var _ContentEntryListConf = _contentEntries.ContentEntryListConfig.Browser.BulkAction,
25
28
  useWorker = _ContentEntryListConf.useWorker,
26
29
  useButtons = _ContentEntryListConf.useButtons,
@@ -31,15 +34,22 @@ var ActionPublish = exports.ActionPublish = (0, _mobxReactLite.observer)(functio
31
34
  var _useDialog = useDialog(),
32
35
  showConfirmationDialog = _useDialog.showConfirmationDialog,
33
36
  showResultsDialog = _useDialog.showResultsDialog;
34
- var entriesLabel = (0, _react.useMemo)(function () {
35
- return (0, _BulkActions.getEntriesLabel)(worker.items.length);
36
- }, [worker.items.length]);
37
+ var entriesLabel = (0, _BulkActions.getEntriesLabel)();
37
38
  var openPublishEntriesDialog = function openPublishEntriesDialog() {
38
39
  return showConfirmationDialog({
39
40
  title: "Publish entries",
40
41
  message: "You are about to publish ".concat(entriesLabel, ". Are you sure you want to continue?"),
41
42
  loadingLabel: "Processing ".concat(entriesLabel),
42
43
  execute: async function execute() {
44
+ if (worker.isSelectedAll) {
45
+ await worker.processInBulk("Publish");
46
+ worker.resetItems();
47
+ showSnackbar("All entries will be published. This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running.", {
48
+ dismissIcon: true,
49
+ timeout: -1
50
+ });
51
+ return;
52
+ }
43
53
  await worker.processInSeries(async function (_ref) {
44
54
  var item = _ref.item,
45
55
  report = _ref.report;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_publish","_mobxReactLite","_contentEntries","_hooks","_BulkActions","_appAco","ActionPublish","exports","observer","_useModel","useModel","model","_usePermission","usePermission","canPublish","_useCms","useCms","publishEntryRevision","_useRecords","useRecords","updateRecordInCache","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","entriesLabel","useMemo","getEntriesLabel","items","length","openPublishEntriesDialog","title","message","concat","loadingLabel","execute","processInSeries","_ref","item","report","response","id","error","Error","entry","success","meta","e","resetItems","results","console","log","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionPublish.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ReactComponent as PublishIcon } from \"@material-design-icons/svg/outlined/publish.svg\";\nimport { observer } from \"mobx-react-lite\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { usePermission, useCms, useModel } from \"~/admin/hooks\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\nimport { useRecords } from \"@webiny/app-aco\";\n\nexport const ActionPublish = observer(() => {\n const { model } = useModel();\n const { canPublish } = usePermission();\n const { publishEntryRevision } = useCms();\n const { updateRecordInCache } = useRecords();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n\n const entriesLabel = useMemo(() => {\n return getEntriesLabel(worker.items.length);\n }, [worker.items.length]);\n\n const openPublishEntriesDialog = () =>\n showConfirmationDialog({\n title: \"Publish entries\",\n message: `You are about to publish ${entriesLabel}. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n await worker.processInSeries(async ({ item, report }) => {\n try {\n const response = await publishEntryRevision({ model, id: item.id });\n\n const { error } = response;\n\n if (error) {\n throw new Error(\n error.message || \"Unknown error while publishing the entry\"\n );\n }\n\n updateRecordInCache(response.entry);\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully published.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Publish entries\",\n message: \"Finished publishing entries! See full report below:\"\n });\n }\n });\n\n if (!canPublish(\"cms.contentEntry\")) {\n console.log(\"You don't have permissions to publish entries.\");\n return null;\n }\n\n return (\n <IconButton\n icon={<PublishIcon />}\n onAction={openPublishEntriesDialog}\n label={`Publish ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEO,IAAMO,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,uBAAQ,EAAC,YAAM;EACxC,IAAAC,SAAA,GAAkB,IAAAC,eAAQ,EAAC,CAAC;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK;EACb,IAAAC,cAAA,GAAuB,IAAAC,oBAAa,EAAC,CAAC;IAA9BC,UAAU,GAAAF,cAAA,CAAVE,UAAU;EAClB,IAAAC,OAAA,GAAiC,IAAAC,aAAM,EAAC,CAAC;IAAjCC,oBAAoB,GAAAF,OAAA,CAApBE,oBAAoB;EAC5B,IAAAC,WAAA,GAAgC,IAAAC,kBAAU,EAAC,CAAC;IAApCC,mBAAmB,GAAAF,WAAA,CAAnBE,mBAAmB;EAE3B,IAAAC,qBAAA,GAA6CC,sCAAsB,CAACC,OAAO,CAACC,UAAU;IAA9EC,SAAS,GAAAJ,qBAAA,CAATI,S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mBAAmB,CAAC6B,QAAQ,CAACI,KAAK,CAAC;YAEnCL,MAAM,CAACM,OAAO,CAAC;cACXd,KAAK,KAAAE,MAAA,CAAKK,IAAI,CAACQ,IAAI,CAACf,KAAK,CAAE;cAC3BC,OAAO,EAAE;YACb,CAAC,CAAC;UACN,CAAC,CAAC,OAAOe,CAAC,EAAE;YACRR,MAAM,CAACG,KAAK,CAAC;cACTX,KAAK,KAAAE,MAAA,CAAKK,IAAI,CAACQ,IAAI,CAACf,KAAK,CAAE;cAC3BC,OAAO,EAAEe,CAAC,CAACf;YACf,CAAC,CAAC;UACN;QACJ,CAAC,CAAC;QAEFX,MAAM,CAAC2B,UAAU,CAAC,CAAC;QAEnBxB,iBAAiB,CAAC;UACdyB,OAAO,EAAE5B,MAAM,CAAC4B,OAAO;UACvBlB,KAAK,EAAE,iBAAiB;UACxBC,OAAO,EAAE;QACb,CAAC,CAAC;MACN;IACJ,CAAC,CAAC;EAAA;EAEN,IAAI,CAAC3B,UAAU,CAAC,kBAAkB,CAAC,EAAE;IACjC6C,OAAO,CAACC,GAAG,CAAC,gDAAgD,CAAC;IAC7D,OAAO,IAAI;EACf;EAEA,oBACI/D,MAAA,CAAAgE,OAAA,CAAAC,aAAA,CAACjC,UAAU;IACPkC,IAAI,eAAElE,MAAA,CAAAgE,OAAA,CAAAC,aAAA,CAAC9D,QAAA,CAAAgE,cAAW,MAAE,CAAE;IACtBC,QAAQ,EAAE1B,wBAAyB;IACnC2B,KAAK,aAAAxB,MAAA,CAAaR,YAAY,CAAG;IACjCiC,gBAAgB,EAAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_publish","_mobxReactLite","_contentEntries","_hooks","_BulkActions","_appAco","_appAdmin","ActionPublish","exports","observer","_useModel","useModel","model","_usePermission","usePermission","canPublish","_useCms","useCms","publishEntryRevision","_useRecords","useRecords","updateRecordInCache","_useSnackbar","useSnackbar","showSnackbar","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","entriesLabel","getEntriesLabel","openPublishEntriesDialog","title","message","concat","loadingLabel","execute","isSelectedAll","processInBulk","resetItems","dismissIcon","timeout","processInSeries","_ref","item","report","response","id","error","Error","entry","success","meta","e","results","console","log","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionPublish.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as PublishIcon } from \"@material-design-icons/svg/outlined/publish.svg\";\nimport { observer } from \"mobx-react-lite\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { usePermission, useCms, useModel } from \"~/admin/hooks\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\nimport { useRecords } from \"@webiny/app-aco\";\nimport { useSnackbar } from \"@webiny/app-admin\";\n\nexport const ActionPublish = observer(() => {\n const { model } = useModel();\n const { canPublish } = usePermission();\n const { publishEntryRevision } = useCms();\n const { updateRecordInCache } = useRecords();\n const { showSnackbar } = useSnackbar();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n\n const entriesLabel = getEntriesLabel();\n\n const openPublishEntriesDialog = () =>\n showConfirmationDialog({\n title: \"Publish entries\",\n message: `You are about to publish ${entriesLabel}. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n if (worker.isSelectedAll) {\n await worker.processInBulk(\"Publish\");\n worker.resetItems();\n showSnackbar(\n \"All entries will be published. This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running.\",\n {\n dismissIcon: true,\n timeout: -1\n }\n );\n return;\n }\n\n await worker.processInSeries(async ({ item, report }) => {\n try {\n const response = await publishEntryRevision({ model, id: item.id });\n\n const { error } = response;\n\n if (error) {\n throw new Error(\n error.message || \"Unknown error while publishing the entry\"\n );\n }\n\n updateRecordInCache(response.entry);\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully published.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Publish entries\",\n message: \"Finished publishing entries! See full report below:\"\n });\n }\n });\n\n if (!canPublish(\"cms.contentEntry\")) {\n console.log(\"You don't have permissions to publish entries.\");\n return null;\n }\n\n return (\n <IconButton\n icon={<PublishIcon />}\n onAction={openPublishEntriesDialog}\n label={`Publish ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEO,IAAMQ,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,uBAAQ,EAAC,YAAM;EACxC,IAAAC,SAAA,GAAkB,IAAAC,eAAQ,EAAC,CAAC;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK;EACb,IAAAC,cAAA,GAAuB,IAAAC,oBAAa,EAAC,CAAC;IAA9BC,UAAU,GAAAF,cAAA,CAAVE,UAAU;EAClB,IAAAC,OAAA,GAAiC,IAAAC,aAAM,EAAC,CAAC;IAAjCC,oBAAoB,GAAAF,OAAA,CAApBE,oBAAoB;EAC5B,IAAAC,WAAA,GAAgC,IAAAC,kBAAU,EAAC,CAAC;IAApCC,mBAAmB,GAAAF,WAAA,CAAnBE,mBAAmB;EAC3B,IAAAC,YAAA,GAAyB,IAAAC,qB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AAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ActionUnpublish = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireDefault(require("react"));
9
9
  var _settings_backup_restore = require("@material-design-icons/svg/outlined/settings_backup_restore.svg");
10
10
  var _mobxReactLite = require("mobx-react-lite");
11
11
  var _contentEntries = require("../../../config/contentEntries");
12
12
  var _hooks = require("../../../hooks");
13
13
  var _BulkActions = require("./BulkActions");
14
14
  var _appAco = require("@webiny/app-aco");
15
+ var _appAdmin = require("@webiny/app-admin");
15
16
  var ActionUnpublish = exports.ActionUnpublish = (0, _mobxReactLite.observer)(function () {
16
17
  var _useModel = (0, _hooks.useModel)(),
17
18
  model = _useModel.model;
@@ -21,6 +22,8 @@ var ActionUnpublish = exports.ActionUnpublish = (0, _mobxReactLite.observer)(fun
21
22
  unpublishEntryRevision = _useCms.unpublishEntryRevision;
22
23
  var _useRecords = (0, _appAco.useRecords)(),
23
24
  updateRecordInCache = _useRecords.updateRecordInCache;
25
+ var _useSnackbar = (0, _appAdmin.useSnackbar)(),
26
+ showSnackbar = _useSnackbar.showSnackbar;
24
27
  var _ContentEntryListConf = _contentEntries.ContentEntryListConfig.Browser.BulkAction,
25
28
  useWorker = _ContentEntryListConf.useWorker,
26
29
  useButtons = _ContentEntryListConf.useButtons,
@@ -31,15 +34,22 @@ var ActionUnpublish = exports.ActionUnpublish = (0, _mobxReactLite.observer)(fun
31
34
  var _useDialog = useDialog(),
32
35
  showConfirmationDialog = _useDialog.showConfirmationDialog,
33
36
  showResultsDialog = _useDialog.showResultsDialog;
34
- var entriesLabel = (0, _react.useMemo)(function () {
35
- return (0, _BulkActions.getEntriesLabel)(worker.items.length);
36
- }, [worker.items.length]);
37
+ var entriesLabel = (0, _BulkActions.getEntriesLabel)();
37
38
  var openUnpublishEntriesDialog = function openUnpublishEntriesDialog() {
38
39
  return showConfirmationDialog({
39
40
  title: "Unpublish entries",
40
41
  message: "You are about to unpublish ".concat(entriesLabel, ". Are you sure you want to continue?"),
41
42
  loadingLabel: "Processing ".concat(entriesLabel),
42
43
  execute: async function execute() {
44
+ if (worker.isSelectedAll) {
45
+ await worker.processInBulk("Unpublish");
46
+ worker.resetItems();
47
+ showSnackbar("All entries will be unpublished. This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running.", {
48
+ dismissIcon: true,
49
+ timeout: -1
50
+ });
51
+ return;
52
+ }
43
53
  await worker.processInSeries(async function (_ref) {
44
54
  var item = _ref.item,
45
55
  report = _ref.report;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_settings_backup_restore","_mobxReactLite","_contentEntries","_hooks","_BulkActions","_appAco","ActionUnpublish","exports","observer","_useModel","useModel","model","_usePermission","usePermission","canUnpublish","_useCms","useCms","unpublishEntryRevision","_useRecords","useRecords","updateRecordInCache","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","entriesLabel","useMemo","getEntriesLabel","items","length","openUnpublishEntriesDialog","title","message","concat","loadingLabel","execute","processInSeries","_ref","item","report","response","id","error","Error","entry","success","meta","e","resetItems","results","console","log","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionUnpublish.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ReactComponent as UnpublishIcon } from \"@material-design-icons/svg/outlined/settings_backup_restore.svg\";\nimport { observer } from \"mobx-react-lite\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { useCms, useModel, usePermission } from \"~/admin/hooks\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\nimport { useRecords } from \"@webiny/app-aco\";\n\nexport const ActionUnpublish = observer(() => {\n const { model } = useModel();\n const { canUnpublish } = usePermission();\n const { unpublishEntryRevision } = useCms();\n const { updateRecordInCache } = useRecords();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n\n const entriesLabel = useMemo(() => {\n return getEntriesLabel(worker.items.length);\n }, [worker.items.length]);\n\n const openUnpublishEntriesDialog = () =>\n showConfirmationDialog({\n title: \"Unpublish entries\",\n message: `You are about to unpublish ${entriesLabel}. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n await worker.processInSeries(async ({ item, report }) => {\n try {\n const response = await unpublishEntryRevision({\n model,\n id: item.id\n });\n\n const { error } = response;\n\n if (error) {\n throw new Error(\n error.message || \"Unknown error while unpublishing the entry\"\n );\n }\n\n updateRecordInCache(response.entry);\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully unpublished.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Unpublish entries\",\n message: \"Finished unpublishing entries! See full report below:\"\n });\n }\n });\n\n if (!canUnpublish(\"cms.contentEntry\")) {\n console.log(\"You don't have permissions to unpublish entries.\");\n return null;\n }\n\n return (\n <IconButton\n icon={<UnpublishIcon />}\n onAction={openUnpublishEntriesDialog}\n label={`Unpublish ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,MAAA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EAEN,IAAI,CAAC3B,YAAY,CAAC,kBAAkB,CAAC,EAAE;IACnC6C,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IAC/D,OAAO,IAAI;EACf;EAEA,oBACI/D,MAAA,CAAAgE,OAAA,CAAAC,aAAA,CAACjC,UAAU;IACPkC,IAAI,eAAElE,MAAA,CAAAgE,OAAA,CAAAC,aAAA,CAAC9D,wBAAA,CAAAgE,cAAa,MAAE,CAAE;IACxBC,QAAQ,EAAE1B,0BAA2B;IACrC2B,KAAK,eAAAxB,MAAA,CAAeR,YAAY,CAAG;IACnCiC,gBAAgB,EAAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_settings_backup_restore","_mobxReactLite","_contentEntries","_hooks","_BulkActions","_appAco","_appAdmin","ActionUnpublish","exports","observer","_useModel","useModel","model","_usePermission","usePermission","canUnpublish","_useCms","useCms","unpublishEntryRevision","_useRecords","useRecords","updateRecordInCache","_useSnackbar","useSnackbar","showSnackbar","_ContentEntryListConf","ContentEntryListConfig","Browser","BulkAction","useWorker","useButtons","useDialog","_useButtons","IconButton","worker","_useDialog","showConfirmationDialog","showResultsDialog","entriesLabel","getEntriesLabel","openUnpublishEntriesDialog","title","message","concat","loadingLabel","execute","isSelectedAll","processInBulk","resetItems","dismissIcon","timeout","processInSeries","_ref","item","report","response","id","error","Error","entry","success","meta","e","results","console","log","default","createElement","icon","ReactComponent","onAction","label","tooltipPlacement"],"sources":["ActionUnpublish.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as UnpublishIcon } from \"@material-design-icons/svg/outlined/settings_backup_restore.svg\";\nimport { observer } from \"mobx-react-lite\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { useCms, useModel, usePermission } from \"~/admin/hooks\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\nimport { useRecords } from \"@webiny/app-aco\";\nimport { useSnackbar } from \"@webiny/app-admin\";\n\nexport const ActionUnpublish = observer(() => {\n const { model } = useModel();\n const { canUnpublish } = usePermission();\n const { unpublishEntryRevision } = useCms();\n const { updateRecordInCache } = useRecords();\n const { showSnackbar } = useSnackbar();\n\n const { useWorker, useButtons, useDialog } = ContentEntryListConfig.Browser.BulkAction;\n const { IconButton } = useButtons();\n const worker = useWorker();\n const { showConfirmationDialog, showResultsDialog } = useDialog();\n\n const entriesLabel = getEntriesLabel();\n\n const openUnpublishEntriesDialog = () =>\n showConfirmationDialog({\n title: \"Unpublish entries\",\n message: `You are about to unpublish ${entriesLabel}. Are you sure you want to continue?`,\n loadingLabel: `Processing ${entriesLabel}`,\n execute: async () => {\n if (worker.isSelectedAll) {\n await worker.processInBulk(\"Unpublish\");\n worker.resetItems();\n showSnackbar(\n \"All entries will be unpublished. This process will be carried out in the background and may take some time. You can safely navigate away from this page while the process is running.\",\n {\n dismissIcon: true,\n timeout: -1\n }\n );\n return;\n }\n\n await worker.processInSeries(async ({ item, report }) => {\n try {\n const response = await unpublishEntryRevision({\n model,\n id: item.id\n });\n\n const { error } = response;\n\n if (error) {\n throw new Error(\n error.message || \"Unknown error while unpublishing the entry\"\n );\n }\n\n updateRecordInCache(response.entry);\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully unpublished.\"\n });\n } catch (e) {\n report.error({\n title: `${item.meta.title}`,\n message: e.message\n });\n }\n });\n\n worker.resetItems();\n\n showResultsDialog({\n results: worker.results,\n title: \"Unpublish entries\",\n message: \"Finished unpublishing entries! See full report below:\"\n });\n }\n });\n\n if (!canUnpublish(\"cms.contentEntry\")) {\n console.log(\"You don't have permissions to unpublish entries.\");\n return null;\n }\n\n return (\n <IconButton\n icon={<UnpublishIcon />}\n onAction={openUnpublishEntriesDialog}\n label={`Unpublish ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OA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AAC;cACThB,KAAK,KAAAE,MAAA,CAAKU,IAAI,CAACQ,IAAI,CAACpB,KAAK,CAAE;cAC3BC,OAAO,EAAEoB,CAAC,CAACpB;YACf,CAAC,CAAC;UACN;QACJ,CAAC,CAAC;QAEFR,MAAM,CAACc,UAAU,CAAC,CAAC;QAEnBX,iBAAiB,CAAC;UACd0B,OAAO,EAAE7B,MAAM,CAAC6B,OAAO;UACvBtB,KAAK,EAAE,mBAAmB;UAC1BC,OAAO,EAAE;QACb,CAAC,CAAC;MACN;IACJ,CAAC,CAAC;EAAA;EAEN,IAAI,CAAC3B,YAAY,CAAC,kBAAkB,CAAC,EAAE;IACnCiD,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IAC/D,OAAO,IAAI;EACf;EAEA,oBACIpE,MAAA,CAAAqE,OAAA,CAAAC,aAAA,CAAClC,UAAU;IACPmC,IAAI,eAAEvE,MAAA,CAAAqE,OAAA,CAAAC,aAAA,CAACnE,wBAAA,CAAAqE,cAAa,MAAE,CAAE;IACxBC,QAAQ,EAAE9B,0BAA2B;IACrC+B,KAAK,eAAA5B,MAAA,CAAeL,YAAY,CAAG;IACnCkC,gBAAgB,EAAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- export declare const getEntriesLabel: (count?: number) => string;
2
+ export declare const getEntriesLabel: () => string;
3
3
  export declare const BulkActions: () => React.JSX.Element | null;
@@ -19,20 +19,29 @@ var _i18n = require("@webiny/app/i18n");
19
19
  var _templateObject;
20
20
  var t = _i18n.i18n.ns("app-headless-cms/admin/content-entries/bulk-actions");
21
21
  var getEntriesLabel = exports.getEntriesLabel = function getEntriesLabel() {
22
- var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
23
- return "".concat(count, " ").concat(count === 1 ? "entry" : "entries");
22
+ var _useContentEntriesLis = (0, _hooks.useContentEntriesList)(),
23
+ selected = _useContentEntriesLis.selected,
24
+ isSelectedAll = _useContentEntriesLis.isSelectedAll;
25
+ if (isSelectedAll) {
26
+ return "all entries";
27
+ }
28
+ return "".concat(selected.length, " ").concat(selected.length === 1 ? "entry" : "entries");
24
29
  };
25
30
  var BulkActions = exports.BulkActions = function BulkActions() {
26
31
  var _useContentEntryListC = (0, _contentEntries.useContentEntryListConfig)(),
27
32
  browser = _useContentEntryListC.browser;
28
- var _useContentEntriesLis = (0, _hooks.useContentEntriesList)(),
29
- selected = _useContentEntriesLis.selected,
30
- setSelected = _useContentEntriesLis.setSelected;
33
+ var _useContentEntriesLis2 = (0, _hooks.useContentEntriesList)(),
34
+ selected = _useContentEntriesLis2.selected,
35
+ setSelected = _useContentEntriesLis2.setSelected,
36
+ isSelectedAll = _useContentEntriesLis2.isSelectedAll;
31
37
  var headline = (0, _react.useMemo)(function () {
38
+ if (isSelectedAll) {
39
+ return t("All entries selected:");
40
+ }
32
41
  return t(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["{count|count:1:entry:default:entries} selected:"])))({
33
42
  count: selected.length
34
43
  });
35
- }, [selected]);
44
+ }, [selected.length, isSelectedAll]);
36
45
  if (!selected.length) {
37
46
  return null;
38
47
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_close","_appAdmin","_Button","_contentEntries","_hooks","_BulkActions","_Typography","_i18n","_templateObject","t","i18n","ns","getEntriesLabel","exports","count","arguments","length","undefined","concat","BulkActions","_useContentEntryListC","useContentEntryListConfig","browser","_useContentEntriesLis","useContentEntriesList","selected","setSelected","headline","useMemo","_taggedTemplateLiteral2","default","createElement","BulkActionsContainer","BulkActionsInner","ButtonsContainer","Typography","use","Buttons","actions","bulkActions","IconButton","icon","ReactComponent","onClick"],"sources":["BulkActions.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ReactComponent as Close } from \"@material-design-icons/svg/outlined/close.svg\";\nimport { Buttons } from \"@webiny/app-admin\";\nimport { IconButton } from \"@webiny/ui/Button\";\n\nimport { useContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { useContentEntriesList } from \"~/admin/views/contentEntries/hooks\";\n\nimport { BulkActionsContainer, BulkActionsInner, ButtonsContainer } from \"./BulkActions.styled\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { i18n } from \"@webiny/app/i18n\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/content-entries/bulk-actions\");\n\nexport const getEntriesLabel = (count = 0): string => {\n return `${count} ${count === 1 ? \"entry\" : \"entries\"}`;\n};\n\nexport const BulkActions = () => {\n const { browser } = useContentEntryListConfig();\n const { selected, setSelected } = useContentEntriesList();\n\n const headline = useMemo((): string => {\n return t`{count|count:1:entry:default:entries} selected:`({\n count: selected.length\n });\n }, [selected]);\n\n if (!selected.length) {\n return null;\n }\n\n return (\n <BulkActionsContainer>\n <BulkActionsInner>\n <ButtonsContainer>\n <Typography use={\"headline6\"}>{headline}</Typography>\n <Buttons actions={browser.bulkActions} />\n </ButtonsContainer>\n <IconButton icon={<Close />} onClick={() => setSelected([])} />\n </BulkActionsInner>\n </BulkActionsContainer>\n );\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAAwC,IAAAS,eAAA;AAExC,IAAMC,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,qDAAqD,CAAC;AAEjE,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAA,EAA0B;EAAA,IAAtBE,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,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ACnB1C,MAAA,CAAAiC,OAAA,CAAAC,aAAA,CAAC7B,OAAA,CAAAsC,UAAU;IAACC,IAAI,eAAE5C,MAAA,CAAAiC,OAAA,CAAAC,aAAA,CAAC/B,MAAA,CAAA0C,cAAK,MAAE,CAAE;IAACC,OAAO,EAAE,SAAAA,QAAA;MAAA,OAAMjB,WAAW,CAAC,EAAE,CAAC;IAAA;EAAC,CAAE,CAChD,CACA,CAAC;AAE/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_close","_appAdmin","_Button","_contentEntries","_hooks","_BulkActions","_Typography","_i18n","_templateObject","t","i18n","ns","getEntriesLabel","exports","_useContentEntriesLis","useContentEntriesList","selected","isSelectedAll","concat","length","BulkActions","_useContentEntryListC","useContentEntryListConfig","browser","_useContentEntriesLis2","setSelected","headline","useMemo","_taggedTemplateLiteral2","default","count","createElement","BulkActionsContainer","BulkActionsInner","ButtonsContainer","Typography","use","Buttons","actions","bulkActions","IconButton","icon","ReactComponent","onClick"],"sources":["BulkActions.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ReactComponent as Close } from \"@material-design-icons/svg/outlined/close.svg\";\nimport { Buttons } from \"@webiny/app-admin\";\nimport { IconButton } from \"@webiny/ui/Button\";\n\nimport { useContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { useContentEntriesList } from \"~/admin/views/contentEntries/hooks\";\n\nimport { BulkActionsContainer, BulkActionsInner, ButtonsContainer } from \"./BulkActions.styled\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { i18n } from \"@webiny/app/i18n\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/content-entries/bulk-actions\");\n\nexport const getEntriesLabel = (): string => {\n const { selected, isSelectedAll } = useContentEntriesList();\n\n if (isSelectedAll) {\n return \"all entries\";\n }\n\n return `${selected.length} ${selected.length === 1 ? \"entry\" : \"entries\"}`;\n};\n\nexport const BulkActions = () => {\n const { browser } = useContentEntryListConfig();\n const { selected, setSelected, isSelectedAll } = useContentEntriesList();\n\n const headline = useMemo((): string => {\n if (isSelectedAll) {\n return t(\"All entries selected:\");\n }\n\n return t`{count|count:1:entry:default:entries} selected:`({\n count: selected.length\n });\n }, [selected.length, isSelectedAll]);\n\n if (!selected.length) {\n return null;\n }\n\n return (\n <BulkActionsContainer>\n <BulkActionsInner>\n <ButtonsContainer>\n <Typography use={\"headline6\"}>{headline}</Typography>\n <Buttons actions={browser.bulkActions} />\n </ButtonsContainer>\n <IconButton icon={<Close />} onClick={() => setSelected([])} />\n </BulkActionsInner>\n </BulkActionsContainer>\n );\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AAAwC,IAAAS,eAAA;AAExC,IAAMC,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,qDAAqD,CAAC;AAEjE,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAA,EAAiB;EACzC,IAAAE,qBAAA,GAAoC,IAAAC,4BAAqB,EAAC,CAAC;IAAnDC,QAAQ,GAAAF,qBAAA,CAARE,QAAQ;IAAEC,aAAa,GAAAH,qBAAA,CAAbG,aAAa;EAE/B,IAAIA,aAAa,EAAE;IACf,OAAO,aAAa;EACxB;EAEA,UAAAC,MAAA,CAAUF,QAAQ,CAACG,MAAM,OAAAD,MAAA,CAAIF,QAAQ,CAACG,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,SAAS;AAC5E,CAAC;AAEM,IAAMC,WAAW,GAAAP,OAAA,CAAAO,WAAA,G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C,UAAU;IAACC,IAAI,eAAE5C,MAAA,CAAAgC,OAAA,CAAAE,aAAA,CAAC/B,MAAA,CAAA0C,cAAK,MAAE,CAAE;IAACC,OAAO,EAAE,SAAAA,QAAA;MAAA,OAAMlB,WAAW,CAAC,EAAE,CAAC;IAAA;EAAC,CAAE,CAChD,CACA,CAAC;AAE/B,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export interface MessagesProps {
3
+ onClick: () => void;
4
+ selected: number;
5
+ }
6
+ export declare const SelectAllMessage: (props: MessagesProps) => React.JSX.Element;
7
+ export declare const ClearSelectionMessage: (props: MessagesProps) => React.JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SelectAllMessage = exports.ClearSelectionMessage = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _Typography = require("@webiny/ui/Typography");
10
+ var _SelectAll = require("./SelectAll");
11
+ var _SelectAll2 = require("./SelectAll.styled");
12
+ var SelectAllMessage = exports.SelectAllMessage = function SelectAllMessage(props) {
13
+ return /*#__PURE__*/_react.default.createElement(_SelectAll2.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
14
+ use: "body1"
15
+ }, "".concat((0, _SelectAll.getEntriesLabel)(props.selected), " selected.")), /*#__PURE__*/_react.default.createElement(_SelectAll2.Button, {
16
+ small: true,
17
+ onClick: props.onClick
18
+ }, "Select all remaining entries"));
19
+ };
20
+ var ClearSelectionMessage = exports.ClearSelectionMessage = function ClearSelectionMessage(props) {
21
+ return /*#__PURE__*/_react.default.createElement(_SelectAll2.MessageContainer, null, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
22
+ use: "body1"
23
+ }, "All entries are selected."), /*#__PURE__*/_react.default.createElement(_SelectAll2.Button, {
24
+ small: true,
25
+ onClick: props.onClick
26
+ }, "Clear selection"));
27
+ };
28
+
29
+ //# sourceMappingURL=Messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_Typography","_SelectAll","_SelectAll2","SelectAllMessage","exports","props","default","createElement","MessageContainer","Typography","use","concat","getEntriesLabel","selected","Button","small","onClick","ClearSelectionMessage"],"sources":["Messages.tsx"],"sourcesContent":["import React from \"react\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { getEntriesLabel } from \"./SelectAll\";\nimport { Button, MessageContainer } from \"./SelectAll.styled\";\n\nexport interface MessagesProps {\n onClick: () => void;\n selected: number;\n}\n\nexport const SelectAllMessage = (props: MessagesProps) => {\n return (\n <MessageContainer>\n <Typography use={\"body1\"}>{`${getEntriesLabel(props.selected)} selected.`}</Typography>\n <Button small={true} onClick={props.onClick}>{`Select all remaining entries`}</Button>\n </MessageContainer>\n );\n};\n\nexport const ClearSelectionMessage = (props: MessagesProps) => {\n return (\n <MessageContainer>\n <Typography use={\"body1\"}>{`All entries are selected.`}</Typography>\n <Button small={true} onClick={props.onClick}>{`Clear selection`}</Button>\n </MessageContainer>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOO,IAAMI,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAIE,KAAoB,EAAK;EACtD,oBACIR,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACL,WAAA,CAAAM,gBAAgB,qBACbX,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACP,WAAA,CAAAS,UAAU;IAACC,GAAG,EAAE;EAAQ,MAAAC,MAAA,CAAK,IAAAC,0BAAe,EAACP,KAAK,CAACQ,QAAQ,CAAC,eAAyB,CAAC,eACvFhB,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACL,WAAA,CAAAY,MAAM;IAACC,KAAK,EAAE,IAAK;IAACC,OAAO,EAAEX,KAAK,CAACW;EAAQ,iCAAyC,CACvE,CAAC;AAE3B,CAAC;AAEM,IAAMC,qBAAqB,GAAAb,OAAA,CAAAa,qBAAA,GAAG,SAAxBA,qBAAqBA,CAAIZ,KAAoB,EAAK;EAC3D,oBACIR,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACL,WAAA,CAAAM,gBAAgB,qBACbX,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACP,WAAA,CAAAS,UAAU;IAACC,GAAG,EAAE;EAAQ,8BAA0C,CAAC,eACpEb,MAAA,CAAAS,OAAA,CAAAC,aAAA,CAACL,WAAA,CAAAY,MAAM;IAACC,KAAK,EAAE,IAAK;IAACC,OAAO,EAAEX,KAAK,CAACW;EAAQ,oBAA4B,CAC1D,CAAC;AAE3B,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ export declare const getEntriesLabel: (count?: number) => string;
3
+ export declare const SelectAll: () => React.JSX.Element | null;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getEntriesLabel = exports.SelectAll = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _hooks = require("../../../views/contentEntries/hooks");
10
+ var _SelectAll = require("./SelectAll.styled");
11
+ var _Messages = require("./Messages");
12
+ var getEntriesLabel = exports.getEntriesLabel = function getEntriesLabel() {
13
+ var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
14
+ return "".concat(count, " ").concat(count === 1 ? "entry" : "entries");
15
+ };
16
+ var SelectAll = exports.SelectAll = function SelectAll() {
17
+ var list = (0, _hooks.useContentEntriesList)();
18
+ if (!list.showingSelectAll) {
19
+ return null;
20
+ }
21
+ return /*#__PURE__*/_react.default.createElement(_SelectAll.SelectAllContainer, {
22
+ "data-testid": "select-all-container"
23
+ }, list.isSelectedAll ? /*#__PURE__*/_react.default.createElement(_Messages.ClearSelectionMessage, {
24
+ onClick: list.unselectAll,
25
+ selected: list.selected.length
26
+ }) : /*#__PURE__*/_react.default.createElement(_Messages.SelectAllMessage, {
27
+ onClick: list.selectAll,
28
+ selected: list.selected.length
29
+ }));
30
+ };
31
+
32
+ //# sourceMappingURL=SelectAll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_hooks","_SelectAll","_Messages","getEntriesLabel","exports","count","arguments","length","undefined","concat","SelectAll","list","useContentEntriesList","showingSelectAll","default","createElement","SelectAllContainer","isSelectedAll","ClearSelectionMessage","onClick","unselectAll","selected","SelectAllMessage","selectAll"],"sources":["SelectAll.tsx"],"sourcesContent":["import React from \"react\";\nimport { useContentEntriesList } from \"~/admin/views/contentEntries/hooks\";\nimport { SelectAllContainer } from \"./SelectAll.styled\";\nimport { ClearSelectionMessage, SelectAllMessage } from \"./Messages\";\n\nexport const getEntriesLabel = (count = 0): string => {\n return `${count} ${count === 1 ? \"entry\" : \"entries\"}`;\n};\n\nexport const SelectAll = () => {\n const list = useContentEntriesList();\n\n if (!list.showingSelectAll) {\n return null;\n }\n\n return (\n <SelectAllContainer data-testid={\"select-all-container\"}>\n {list.isSelectedAll ? (\n <ClearSelectionMessage onClick={list.unselectAll} selected={list.selected.length} />\n ) : (\n <SelectAllMessage onClick={list.selectAll} selected={list.selected.length} />\n )}\n </SelectAllContainer>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEO,IAAMI,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CAAA,EAA0B;EAAA,IAAtBE,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EACrC,UAAAG,MAAA,CAAUJ,KAAK,OAAAI,MAAA,CAAIJ,KAAK,KAAK,CAAC,GAAG,OAAO,GAAG,SAAS;AACxD,CAAC;AAEM,IAAMK,SAAS,GAAAN,OAAA,CAAAM,SAAA,GAAG,SAAZA,SAASA,CAAA,EAAS;EAC3B,IAAMC,IAAI,GAAG,IAAAC,4BAAqB,EAAC,CAAC;EAEpC,IAAI,CAACD,IAAI,CAACE,gBAAgB,EAAE;IACxB,OAAO,IAAI;EACf;EAEA,oBACIhB,MAAA,CAAAiB,OAAA,CAAAC,aAAA,CAACd,UAAA,CAAAe,kBAAkB;IAAC,eAAa;EAAuB,GACnDL,IAAI,CAACM,aAAa,gBACfpB,MAAA,CAAAiB,OAAA,CAAAC,aAAA,CAACb,SAAA,CAAAgB,qBAAqB;IAACC,OAAO,EAAER,IAAI,CAACS,WAAY;IAACC,QAAQ,EAAEV,IAAI,CAACU,QAAQ,CAACd;EAAO,CAAE,CAAC,gBAEpFV,MAAA,CAAAiB,OAAA,CAAAC,aAAA,CAACb,SAAA,CAAAoB,gBAAgB;IAACH,OAAO,EAAER,IAAI,CAACY,SAAU;IAACF,QAAQ,EAAEV,IAAI,CAACU,QAAQ,CAACd;EAAO,CAAE,CAEhE,CAAC;AAE7B,CAAC","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export declare const SelectAllContainer: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const MessageContainer: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ export declare const Button: import("@emotion/styled").StyledComponent<import("@webiny/ui/Button").ButtonProps & {
11
+ theme?: import("@emotion/react").Theme | undefined;
12
+ }, {}, {}>;