@webiny/app-headless-cms 5.20.0 → 5.22.0-beta.1
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/HeadlessCMS.d.ts +12 -0
- package/HeadlessCMS.js +27 -0
- package/admin/components/ContentEntryForm/useContentEntryForm.js +101 -12
- package/admin/components/ContentModelEditor/Context.js +3 -1
- package/admin/components/ContentModelEditor/Editor.d.ts +1 -1
- package/admin/components/ContentModelEditor/Editor.js +1 -1
- package/admin/components/Draggable.d.ts +3 -2
- package/admin/components/Draggable.js +5 -3
- package/admin/components/Droppable.d.ts +3 -2
- package/admin/components/Droppable.js +5 -3
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.d.ts +10 -5
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js +9 -5
- package/admin/components/FieldEditor/Field.js +4 -4
- package/admin/components/FieldEditor/FieldEditor.js +1 -1
- package/admin/components/FieldEditor/Styled.d.ts +2 -2
- package/admin/contexts/Cms/index.d.ts +1 -2
- package/admin/elements/ContentGroupMenuElement.js +2 -1
- package/admin/elements/ContentModelMenuElement.js +2 -1
- package/admin/elements/NothingToShowElement.js +1 -1
- package/admin/graphql/contentModels.d.ts +1 -1
- package/admin/graphql/contentModels.js +1 -1
- package/admin/hooks/usePermission.d.ts +2 -2
- package/admin/menus/CmsMenuLoader.d.ts +2 -0
- package/admin/menus/CmsMenuLoader.js +39 -0
- package/admin/menus/ContentGroupsMenuItems.d.ts +1 -0
- package/admin/menus/ContentGroupsMenuItems.js +88 -0
- package/admin/{plugins/menus → menus}/GlobalSearchPlugins.d.ts +0 -0
- package/admin/{plugins/menus → menus}/GlobalSearchPlugins.js +2 -2
- package/admin/menus/NothingToShowElement.d.ts +2 -0
- package/admin/menus/NothingToShowElement.js +42 -0
- package/admin/plugins/editor/defaultBar/BackButton.js +1 -1
- package/admin/plugins/editor/defaultBar/CreateContentButton.js +1 -1
- package/admin/plugins/editor/defaultBar/Divider.d.ts +1 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.js +1 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +2 -2
- package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +3 -3
- package/admin/plugins/editor/formSettings/index.js +1 -1
- package/admin/plugins/fieldRenderers/DynamicSection.js +1 -1
- package/admin/plugins/fieldRenderers/checkboxes.js +18 -15
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.d.ts +9 -0
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.js +39 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.d.ts +2 -3
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js +61 -59
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.d.ts +4 -4
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js +52 -51
- package/admin/plugins/fieldRenderers/dateTime/Input.d.ts +6 -7
- package/admin/plugins/fieldRenderers/dateTime/Input.js +2 -5
- package/admin/plugins/fieldRenderers/dateTime/Select.d.ts +10 -3
- package/admin/plugins/fieldRenderers/dateTime/Select.js +2 -5
- package/admin/plugins/fieldRenderers/dateTime/Time.d.ts +3 -3
- package/admin/plugins/fieldRenderers/dateTime/Time.js +33 -9
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js +8 -13
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js +9 -13
- package/admin/plugins/fieldRenderers/dateTime/utils.d.ts +7 -6
- package/admin/plugins/fieldRenderers/dateTime/utils.js +51 -9
- package/admin/plugins/fieldRenderers/file/File.js +2 -2
- package/admin/plugins/fieldRenderers/file/utils.d.ts +1 -1
- package/admin/plugins/fieldRenderers/file/utils.js +2 -2
- package/admin/plugins/fieldRenderers/longText/longTexts.js +1 -1
- package/admin/plugins/fieldRenderers/number/numberInputs.js +1 -1
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +1 -1
- package/admin/plugins/fieldRenderers/radioButtons.js +4 -3
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js +1 -1
- package/admin/plugins/fieldRenderers/text/textInputs.js +1 -1
- package/admin/plugins/fieldValidators/date/createDateInputField.js +8 -13
- package/admin/plugins/fieldValidators/unique.d.ts +3 -0
- package/admin/plugins/fieldValidators/unique.js +12 -0
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.d.ts +7 -4
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js +88 -53
- package/admin/plugins/fields/boolean.js +19 -2
- package/admin/plugins/fields/dateTime.js +17 -6
- package/admin/plugins/fields/file.js +1 -1
- package/admin/plugins/fields/longText.js +1 -1
- package/admin/plugins/fields/number.js +1 -1
- package/admin/plugins/fields/object.js +1 -1
- package/admin/plugins/fields/ref.js +1 -1
- package/admin/plugins/fields/richText.js +1 -1
- package/admin/plugins/fields/text.js +2 -2
- package/admin/plugins/index.d.ts +1 -7
- package/admin/plugins/index.js +1 -3
- package/admin/plugins/install.js +1 -1
- package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +1 -1
- package/admin/plugins/permissionRenderer/index.js +1 -1
- package/admin/plugins/transformers/dateTransformer.js +5 -7
- package/admin/plugins/validators/unique.d.ts +7 -0
- package/admin/plugins/validators/unique.js +38 -0
- package/admin/views/contentEntries/ContentEntriesList.js +2 -2
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js +9 -9
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.js +2 -2
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js +1 -1
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js +1 -1
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.js +1 -1
- package/admin/views/contentEntries/ContentEntry.js +1 -1
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js +2 -2
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js +1 -1
- package/admin/views/contentModels/ContentModelEditor.js +2 -8
- package/admin/views/contentModels/ContentModelsDataList.js +4 -4
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +31 -37
- package/types.d.ts +4 -1
- package/admin/plugins/menus/CmsMenuLoader.d.ts +0 -7
- package/admin/plugins/menus/CmsMenuLoader.js +0 -76
- package/admin/plugins/menus/ContentGroupsMenuItems.d.ts +0 -6
- package/admin/plugins/menus/ContentGroupsMenuItems.js +0 -154
- package/admin/plugins/menus.d.ts +0 -4
- package/admin/plugins/menus.js +0 -19
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import React, { useEffect } from "react";
|
|
5
|
-
import get from "lodash/get";
|
|
6
|
-
import pluralize from "pluralize";
|
|
7
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
8
|
-
import { LIST_MENU_CONTENT_GROUPS_MODELS } from "../../viewsGraphql";
|
|
9
|
-
import useQuery from "../../hooks/useQuery";
|
|
10
|
-
import usePermission from "../../hooks/usePermission";
|
|
11
|
-
import { ContentGroupMenuElement } from "../../elements/ContentGroupMenuElement";
|
|
12
|
-
import { NothingToShowElement } from "../../elements/NothingToShowElement";
|
|
13
|
-
import { ContentModelMenuElement } from "../../elements/ContentModelMenuElement";
|
|
14
|
-
export var ContentGroupsMenuItems = function ContentGroupsMenuItems(_ref) {
|
|
15
|
-
var view = _ref.view;
|
|
16
|
-
var response = useQuery(LIST_MENU_CONTENT_GROUPS_MODELS);
|
|
17
|
-
|
|
18
|
-
var _ref2 = get(response, "data.listContentModelGroups") || {},
|
|
19
|
-
groups = _ref2.data;
|
|
20
|
-
|
|
21
|
-
var _usePermission = usePermission(),
|
|
22
|
-
canReadEntries = _usePermission.canReadEntries;
|
|
23
|
-
|
|
24
|
-
function createMenuItems() {
|
|
25
|
-
return _createMenuItems.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _createMenuItems() {
|
|
29
|
-
_createMenuItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
30
|
-
var mainMenu, _iterator, _step, _loop, _ret;
|
|
31
|
-
|
|
32
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
33
|
-
while (1) {
|
|
34
|
-
switch (_context.prev = _context.next) {
|
|
35
|
-
case 0:
|
|
36
|
-
_context.next = 2;
|
|
37
|
-
return view.awaitElement("headlessCms.mainMenu");
|
|
38
|
-
|
|
39
|
-
case 2:
|
|
40
|
-
mainMenu = _context.sent;
|
|
41
|
-
|
|
42
|
-
if (mainMenu) {
|
|
43
|
-
_context.next = 5;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return _context.abrupt("return");
|
|
48
|
-
|
|
49
|
-
case 5:
|
|
50
|
-
_iterator = _createForOfIteratorHelper(groups);
|
|
51
|
-
_context.prev = 6;
|
|
52
|
-
|
|
53
|
-
_loop = function _loop() {
|
|
54
|
-
var group = _step.value;
|
|
55
|
-
// Check if user has "contentEntry" permission for any content model for a content model group
|
|
56
|
-
var hasContentEntryPermission = group.contentModels.some(function (contentModel) {
|
|
57
|
-
return canReadEntries({
|
|
58
|
-
contentModelGroup: group,
|
|
59
|
-
contentModel: contentModel
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
if (group.contentModels.length > 0 && !hasContentEntryPermission) {
|
|
64
|
-
return "continue";
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
var groupMenuItem = mainMenu.addElement(new ContentGroupMenuElement("cms-content-models-".concat(group.id), {
|
|
68
|
-
label: group.name,
|
|
69
|
-
icon: /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
70
|
-
style: {
|
|
71
|
-
color: "var(--mdc-theme-text-secondary-on-background)"
|
|
72
|
-
},
|
|
73
|
-
icon: group.icon.split("/")
|
|
74
|
-
})
|
|
75
|
-
}));
|
|
76
|
-
groupMenuItem.addElement(new NothingToShowElement("cms-content-models-".concat(group.id, "-empty"), {
|
|
77
|
-
label: "Nothing to show.",
|
|
78
|
-
shouldRender: function shouldRender() {
|
|
79
|
-
return group.contentModels.length === 0;
|
|
80
|
-
}
|
|
81
|
-
}));
|
|
82
|
-
group.contentModels.forEach(function (contentModel) {
|
|
83
|
-
if (canReadEntries({
|
|
84
|
-
contentModelGroup: group,
|
|
85
|
-
contentModel: contentModel
|
|
86
|
-
})) {
|
|
87
|
-
groupMenuItem.addElement(new ContentModelMenuElement(contentModel.modelId, {
|
|
88
|
-
label: pluralize(contentModel.name),
|
|
89
|
-
path: "/cms/content-entries/".concat(contentModel.modelId)
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
_iterator.s();
|
|
96
|
-
|
|
97
|
-
case 9:
|
|
98
|
-
if ((_step = _iterator.n()).done) {
|
|
99
|
-
_context.next = 15;
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
_ret = _loop();
|
|
104
|
-
|
|
105
|
-
if (!(_ret === "continue")) {
|
|
106
|
-
_context.next = 13;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return _context.abrupt("continue", 13);
|
|
111
|
-
|
|
112
|
-
case 13:
|
|
113
|
-
_context.next = 9;
|
|
114
|
-
break;
|
|
115
|
-
|
|
116
|
-
case 15:
|
|
117
|
-
_context.next = 20;
|
|
118
|
-
break;
|
|
119
|
-
|
|
120
|
-
case 17:
|
|
121
|
-
_context.prev = 17;
|
|
122
|
-
_context.t0 = _context["catch"](6);
|
|
123
|
-
|
|
124
|
-
_iterator.e(_context.t0);
|
|
125
|
-
|
|
126
|
-
case 20:
|
|
127
|
-
_context.prev = 20;
|
|
128
|
-
|
|
129
|
-
_iterator.f();
|
|
130
|
-
|
|
131
|
-
return _context.finish(20);
|
|
132
|
-
|
|
133
|
-
case 23:
|
|
134
|
-
view.refresh();
|
|
135
|
-
|
|
136
|
-
case 24:
|
|
137
|
-
case "end":
|
|
138
|
-
return _context.stop();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, _callee, null, [[6, 17, 20, 23]]);
|
|
142
|
-
}));
|
|
143
|
-
return _createMenuItems.apply(this, arguments);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
useEffect(function () {
|
|
147
|
-
if (!groups) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
createMenuItems();
|
|
152
|
-
}, [groups]);
|
|
153
|
-
return null;
|
|
154
|
-
};
|
package/admin/plugins/menus.d.ts
DELETED
package/admin/plugins/menus.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { GenericElement } from "@webiny/app-admin/ui/elements/GenericElement";
|
|
3
|
-
import { CmsMenuLoader } from "./menus/CmsMenuLoader";
|
|
4
|
-
import { UIViewPlugin } from "@webiny/app-admin/ui/UIView";
|
|
5
|
-
import { NavigationView } from "@webiny/app-admin/ui/views/NavigationView"; // import { NavigationMenuElement } from "@webiny/app-admin/elements/NavigationMenuElement";
|
|
6
|
-
// import { ReactComponent as BeenHere } from "~/admin/icons/beenhere.svg";
|
|
7
|
-
|
|
8
|
-
export default [new UIViewPlugin(NavigationView, function (view) {
|
|
9
|
-
view.addElement(new GenericElement("headlessCms.menuLoader", function () {
|
|
10
|
-
return /*#__PURE__*/React.createElement(CmsMenuLoader, {
|
|
11
|
-
view: view
|
|
12
|
-
});
|
|
13
|
-
})); // !EXAMPLE!
|
|
14
|
-
// This shows how you can move dynamically generated CMS menu items around and place them anywhere in the menu.
|
|
15
|
-
// view.awaitElement<NavigationMenuElement>("advancedTopic").then(element => {
|
|
16
|
-
// element.setIcon(<BeenHere />);
|
|
17
|
-
// element.moveBefore(view.getElement("headlessCms.mainMenu"));
|
|
18
|
-
// });
|
|
19
|
-
})];
|