@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,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { css } from "emotion";
|
|
3
4
|
import { Cell } from "@webiny/ui/Grid";
|
|
@@ -120,17 +121,58 @@ export var UTC_TIMEZONES = [{
|
|
|
120
121
|
value: "+14:00",
|
|
121
122
|
label: "UTC+14:00"
|
|
122
123
|
}];
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
export var DEFAULT_TIMEZONE = "+01:00";
|
|
125
|
+
export var getDefaultFieldValue = function getDefaultFieldValue(field, bind, getCurrent) {
|
|
126
|
+
var def = field.settings ? field.settings.defaultSetValue || "null" : "null";
|
|
127
|
+
|
|
128
|
+
if (bind.value || def !== "current") {
|
|
129
|
+
return bind.value || "";
|
|
130
|
+
}
|
|
126
131
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
return getCurrent();
|
|
133
|
+
};
|
|
134
|
+
export var getCurrentTimeZone = function getCurrentTimeZone(date) {
|
|
135
|
+
if (!date) {
|
|
136
|
+
date = new Date();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var value = date.toTimeString();
|
|
140
|
+
var matches = value.match(/GMT([+-][0-9]{4})/);
|
|
141
|
+
|
|
142
|
+
if (!matches) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var timezone = matches[1];
|
|
147
|
+
return "".concat(timezone.substr(0, 3), ":").concat(timezone.substr(3));
|
|
148
|
+
};
|
|
149
|
+
export var getCurrentLocalTime = function getCurrentLocalTime(date) {
|
|
150
|
+
if (!date) {
|
|
151
|
+
date = new Date();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var value = date.toTimeString();
|
|
155
|
+
|
|
156
|
+
var _value$split = value.split(" "),
|
|
157
|
+
_value$split2 = _slicedToArray(_value$split, 1),
|
|
158
|
+
time = _value$split2[0];
|
|
159
|
+
|
|
160
|
+
if (!time || time.match(/^([0-9]{2}):([0-9]{2}):([0-9]{2})$/) === null) {
|
|
161
|
+
return "00:00:00";
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return time;
|
|
165
|
+
};
|
|
166
|
+
export var getCurrentDate = function getCurrentDate(date) {
|
|
167
|
+
if (!date) {
|
|
168
|
+
date = new Date();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
var year = String(date.getFullYear()).padStart(4, "0");
|
|
172
|
+
var month = String(date.getMonth() + 1).padStart(2, "0");
|
|
173
|
+
var day = String(date.getDate()).padStart(2, "0");
|
|
174
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
130
175
|
};
|
|
131
|
-
export var DEFAULT_TIME = "00:00:00";
|
|
132
|
-
export var DEFAULT_DATE = getCurrentDateString();
|
|
133
|
-
export var DEFAULT_TIMEZONE = "+01:00";
|
|
134
176
|
var deleteIconStyles = /*#__PURE__*/css({
|
|
135
177
|
width: "100% !important",
|
|
136
178
|
height: "100% !important",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { Image } from "@webiny/app/components";
|
|
3
3
|
import * as Ui from "@webiny/ui/ImageUpload";
|
|
4
|
-
import { createRenderImagePreview,
|
|
4
|
+
import { createRenderImagePreview, imagePlugins } from "./utils";
|
|
5
5
|
import fileIcon from "../../fields/icons/round_insert_drive_file-24px.svg";
|
|
6
6
|
import { FormElementMessage } from "@webiny/ui/FormElementMessage";
|
|
7
7
|
var imagePreviewProps = {
|
|
@@ -32,7 +32,7 @@ var File = function File(props) {
|
|
|
32
32
|
var styles = props.styles || defaultStyles;
|
|
33
33
|
var validation = props.validation || defaultValidation;
|
|
34
34
|
var isImage = useCallback(function (url) {
|
|
35
|
-
return
|
|
35
|
+
return imagePlugins.some(function (extension) {
|
|
36
36
|
return url.includes(extension);
|
|
37
37
|
});
|
|
38
38
|
}, []);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const imagePlugins: string[];
|
|
3
3
|
export declare const imageWrapperStyles: string;
|
|
4
4
|
export declare const createRenderImagePreview: ({ value, imagePreviewProps }: {
|
|
5
5
|
value: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { css } from "emotion";
|
|
3
|
-
import { ReactComponent as FileIcon } from "
|
|
4
|
-
export var
|
|
3
|
+
import { ReactComponent as FileIcon } from "../../fields/icons/round_insert_drive_file-24px.svg";
|
|
4
|
+
export var imagePlugins = [".jpg", ".jpeg", ".gif", ".png", ".svg"];
|
|
5
5
|
export var imageWrapperStyles = /*#__PURE__*/css({
|
|
6
6
|
height: "auto"
|
|
7
7
|
}, "label:imageWrapperStyles;");
|
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
import get from "lodash/get";
|
|
7
7
|
import { Input } from "@webiny/ui/Input";
|
|
8
8
|
import { i18n } from "@webiny/app/i18n";
|
|
9
|
-
import { ReactComponent as DeleteIcon } from "
|
|
9
|
+
import { ReactComponent as DeleteIcon } from "../../../icons/close.svg";
|
|
10
10
|
import DynamicSection from "../DynamicSection";
|
|
11
11
|
var t = i18n.ns("app-headless-cms/admin/fields/text");
|
|
12
12
|
var plugin = {
|
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
import get from "lodash/get";
|
|
7
7
|
import { Input } from "@webiny/ui/Input";
|
|
8
8
|
import { i18n } from "@webiny/app/i18n";
|
|
9
|
-
import { ReactComponent as DeleteIcon } from "
|
|
9
|
+
import { ReactComponent as DeleteIcon } from "../../../icons/close.svg";
|
|
10
10
|
import DynamicSection from "../DynamicSection";
|
|
11
11
|
var t = i18n.ns("app-headless-cms/admin/fields/text");
|
|
12
12
|
var plugin = {
|
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
import { i18n } from "@webiny/app/i18n";
|
|
7
7
|
import DynamicSection from "../DynamicSection";
|
|
8
8
|
import { Fields } from "../../../components/ContentEntryForm/Fields";
|
|
9
|
-
import { ReactComponent as DeleteIcon } from "
|
|
9
|
+
import { ReactComponent as DeleteIcon } from "../../../icons/close.svg";
|
|
10
10
|
import { IconButton } from "@webiny/ui/Button";
|
|
11
11
|
import { Cell } from "@webiny/ui/Grid";
|
|
12
12
|
import { FormElementMessage } from "@webiny/ui/FormElementMessage";
|
|
@@ -30,12 +30,13 @@ var plugin = {
|
|
|
30
30
|
var onChange = _ref3.onChange,
|
|
31
31
|
getValue = _ref3.getValue;
|
|
32
32
|
return /*#__PURE__*/React.createElement(React.Fragment, null, options.map(function (option, index) {
|
|
33
|
+
var value = field.type === "number" ? Number(option.value) : option.value;
|
|
33
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
key: option.value + index
|
|
35
|
+
key: String(option.value) + index
|
|
35
36
|
}, /*#__PURE__*/React.createElement(Radio, {
|
|
36
37
|
label: option.label,
|
|
37
|
-
value: getValue(
|
|
38
|
-
onChange: onChange(
|
|
38
|
+
value: getValue(value),
|
|
39
|
+
onChange: onChange(value)
|
|
39
40
|
}));
|
|
40
41
|
}));
|
|
41
42
|
}));
|
|
@@ -5,7 +5,7 @@ var _templateObject, _templateObject2;
|
|
|
5
5
|
import React, { useMemo } from "react";
|
|
6
6
|
import get from "lodash/get";
|
|
7
7
|
import { i18n } from "@webiny/app/i18n";
|
|
8
|
-
import { ReactComponent as DeleteIcon } from "
|
|
8
|
+
import { ReactComponent as DeleteIcon } from "../../../icons/close.svg";
|
|
9
9
|
import DynamicSection from "../DynamicSection";
|
|
10
10
|
import { RichTextEditor, createPropsFromConfig } from "@webiny/app-admin/components/RichTextEditor";
|
|
11
11
|
import { IconButton } from "@webiny/ui/Button";
|
|
@@ -5,7 +5,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import get from "lodash/get";
|
|
7
7
|
import { i18n } from "@webiny/app/i18n";
|
|
8
|
-
import { ReactComponent as DeleteIcon } from "
|
|
8
|
+
import { ReactComponent as DeleteIcon } from "../../../icons/close.svg";
|
|
9
9
|
import DynamicSection from "../DynamicSection";
|
|
10
10
|
import { Input } from "@webiny/ui/Input";
|
|
11
11
|
var t = i18n.ns("app-headless-cms/admin/fields/text");
|
|
@@ -1,33 +1,28 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import DateTimeWithoutTimezone from "../../fieldRenderers/dateTime/DateTimeWithoutTimezone";
|
|
3
|
-
import DateTimeWithTimezone from "../../fieldRenderers/dateTime/DateTimeWithTimezone";
|
|
4
|
-
import Time from "../../fieldRenderers/dateTime/Time";
|
|
5
|
-
import
|
|
2
|
+
import { DateTimeWithoutTimezone } from "../../fieldRenderers/dateTime/DateTimeWithoutTimezone";
|
|
3
|
+
import { DateTimeWithTimezone } from "../../fieldRenderers/dateTime/DateTimeWithTimezone";
|
|
4
|
+
import { Time } from "../../fieldRenderers/dateTime/Time";
|
|
5
|
+
import { DateOnly } from "../../fieldRenderers/dateTime/DateOnly";
|
|
6
6
|
export var createInputField = function createInputField(field, bind) {
|
|
7
7
|
if (field.settings.type === "dateTimeWithoutTimezone") {
|
|
8
8
|
return /*#__PURE__*/React.createElement(DateTimeWithoutTimezone, {
|
|
9
9
|
field: field,
|
|
10
10
|
bind: bind
|
|
11
11
|
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (field.settings.type === "dateTimeWithTimezone") {
|
|
12
|
+
} else if (field.settings.type === "dateTimeWithTimezone") {
|
|
15
13
|
return /*#__PURE__*/React.createElement(DateTimeWithTimezone, {
|
|
16
14
|
field: field,
|
|
17
15
|
bind: bind
|
|
18
16
|
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (field.settings.type === "time") {
|
|
17
|
+
} else if (field.settings.type === "time") {
|
|
22
18
|
return /*#__PURE__*/React.createElement(Time, {
|
|
23
19
|
field: field,
|
|
24
20
|
bind: bind
|
|
25
21
|
});
|
|
26
22
|
}
|
|
27
23
|
|
|
28
|
-
return /*#__PURE__*/React.createElement(
|
|
24
|
+
return /*#__PURE__*/React.createElement(DateOnly, {
|
|
29
25
|
bind: bind,
|
|
30
|
-
field: field
|
|
31
|
-
type: field.settings.type
|
|
26
|
+
field: field
|
|
32
27
|
});
|
|
33
28
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default (function () {
|
|
2
|
+
return {
|
|
3
|
+
type: "cms-editor-field-validator",
|
|
4
|
+
name: "cms-editor-field-validator-unique",
|
|
5
|
+
validator: {
|
|
6
|
+
name: "unique",
|
|
7
|
+
label: "Unique",
|
|
8
|
+
description: "You won't be able to submit the form if this field is not unique",
|
|
9
|
+
defaultMessage: "Value must be unique."
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CmsEditorField } from "../../../types";
|
|
3
|
+
export interface Props {
|
|
4
|
+
getBind: (value?: any) => any;
|
|
4
5
|
renderValueInput?: any;
|
|
5
|
-
|
|
6
|
+
field: CmsEditorField;
|
|
7
|
+
}
|
|
8
|
+
declare const PredefinedValuesDynamicFieldset: React.FC<Props>;
|
|
6
9
|
export default PredefinedValuesDynamicFieldset;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
3
|
|
|
3
4
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
4
5
|
|
|
@@ -11,6 +12,7 @@ import { DynamicFieldset } from "@webiny/ui/DynamicFieldset";
|
|
|
11
12
|
import { Typography } from "@webiny/ui/Typography";
|
|
12
13
|
import { ButtonPrimary, ButtonSecondary } from "@webiny/ui/Button";
|
|
13
14
|
import { Input } from "@webiny/ui/Input";
|
|
15
|
+
import { Switch } from "@webiny/ui/Switch";
|
|
14
16
|
var t = i18n.ns("app-headless-cms/admin/fields/dynamic-fieldset-predefined-values");
|
|
15
17
|
var Fieldset = /*#__PURE__*/styled("div", {
|
|
16
18
|
target: "e1vzahbl0",
|
|
@@ -46,63 +48,96 @@ var Header = /*#__PURE__*/styled("div", {
|
|
|
46
48
|
marginBottom: 15
|
|
47
49
|
});
|
|
48
50
|
|
|
49
|
-
function
|
|
51
|
+
var onSelectedChange = function onSelectedChange(params) {
|
|
52
|
+
var bind = params.bind,
|
|
53
|
+
field = params.field,
|
|
54
|
+
targetIndex = params.index,
|
|
55
|
+
setToValue = params.value;
|
|
56
|
+
bind.form.setValue("predefinedValues.values", bind.value.map(function (value, index) {
|
|
57
|
+
var defaultValue = field.multipleValues ? value.selected : false;
|
|
58
|
+
return _objectSpread(_objectSpread({}, value), {}, {
|
|
59
|
+
selected: index === targetIndex ? setToValue : defaultValue
|
|
60
|
+
});
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var PredefinedValuesDynamicFieldset = function PredefinedValuesDynamicFieldset(_ref) {
|
|
50
65
|
var getBind = _ref.getBind,
|
|
51
66
|
_ref$renderValueInput = _ref.renderValueInput,
|
|
52
|
-
renderValueInput = _ref$renderValueInput === void 0 ? null : _ref$renderValueInput
|
|
67
|
+
renderValueInput = _ref$renderValueInput === void 0 ? null : _ref$renderValueInput,
|
|
68
|
+
field = _ref.field;
|
|
53
69
|
var Bind = getBind();
|
|
54
70
|
return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
55
71
|
span: 12
|
|
56
|
-
}, /*#__PURE__*/React.createElement(Bind, null,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Bind, null, function (bind) {
|
|
73
|
+
return /*#__PURE__*/React.createElement(DynamicFieldset, bind, function (_ref2) {
|
|
74
|
+
var actions = _ref2.actions,
|
|
75
|
+
header = _ref2.header,
|
|
76
|
+
row = _ref2.row,
|
|
77
|
+
empty = _ref2.empty;
|
|
78
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, row(function (_ref3) {
|
|
79
|
+
var index = _ref3.index;
|
|
80
|
+
var Bind = getBind(index);
|
|
81
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GridInner, null, /*#__PURE__*/React.createElement(Cell, {
|
|
82
|
+
span: 4
|
|
83
|
+
}, /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement(Bind, {
|
|
84
|
+
name: "label"
|
|
85
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
86
|
+
label: t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Label"])))
|
|
87
|
+
})))), /*#__PURE__*/React.createElement(Cell, {
|
|
88
|
+
span: 4
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Fieldset, null, renderValueInput ? renderValueInput(Bind) : /*#__PURE__*/React.createElement(Bind, {
|
|
90
|
+
name: "value"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
92
|
+
label: t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Value"])))
|
|
93
|
+
})))), /*#__PURE__*/React.createElement(Cell, {
|
|
94
|
+
span: 2
|
|
95
|
+
}, /*#__PURE__*/React.createElement(Fieldset, null, /*#__PURE__*/React.createElement(Bind, {
|
|
96
|
+
name: "selected"
|
|
97
|
+
}, function (selectedBind) {
|
|
98
|
+
return /*#__PURE__*/React.createElement(Switch, Object.assign({}, selectedBind, {
|
|
99
|
+
label: "Selected",
|
|
100
|
+
description: "Mark as selected value",
|
|
101
|
+
onChange: function onChange(value) {
|
|
102
|
+
onSelectedChange({
|
|
103
|
+
bind: bind,
|
|
104
|
+
field: field,
|
|
105
|
+
index: index,
|
|
106
|
+
value: value
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
}))), /*#__PURE__*/React.createElement(Cell, {
|
|
111
|
+
span: 2,
|
|
112
|
+
className: controlButtons
|
|
113
|
+
}, /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
114
|
+
small: true,
|
|
115
|
+
onClick: actions.add(index)
|
|
116
|
+
}, "+"), /*#__PURE__*/React.createElement(ButtonSecondary, {
|
|
117
|
+
small: true,
|
|
118
|
+
onClick: actions.remove(index)
|
|
119
|
+
}, "-"))));
|
|
120
|
+
}), empty(function () {
|
|
121
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
122
|
+
use: "overline"
|
|
123
|
+
}, t(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["Predefined values"]))))), /*#__PURE__*/React.createElement(GridInner, {
|
|
124
|
+
className: emptyStyles
|
|
125
|
+
}, /*#__PURE__*/React.createElement(Cell, {
|
|
126
|
+
span: 12
|
|
127
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
128
|
+
use: "subtitle1"
|
|
129
|
+
}, t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["There are no predefined values available."]))))), /*#__PURE__*/React.createElement(Cell, {
|
|
130
|
+
span: 12
|
|
131
|
+
}, /*#__PURE__*/React.createElement(ButtonPrimary, {
|
|
132
|
+
onClick: actions.add()
|
|
133
|
+
}, t(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Add a predefined value"])))))));
|
|
134
|
+
}), header(function () {
|
|
135
|
+
return /*#__PURE__*/React.createElement(Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
136
|
+
use: "overline"
|
|
137
|
+
}, t(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["Predefined values"])))));
|
|
138
|
+
}));
|
|
139
|
+
});
|
|
140
|
+
})));
|
|
141
|
+
};
|
|
107
142
|
|
|
108
143
|
export default PredefinedValuesDynamicFieldset;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
4
4
|
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { ReactComponent as BooleanIcon } from "
|
|
6
|
+
import { ReactComponent as BooleanIcon } from "./icons/toggle_on-black-24px.svg";
|
|
7
7
|
import { i18n } from "@webiny/app/i18n";
|
|
8
|
+
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
9
|
+
import { Select } from "@webiny/ui/Select";
|
|
8
10
|
var t = i18n.ns("app-headless-cms/admin/fields");
|
|
9
11
|
var plugin = {
|
|
10
12
|
type: "cms-editor-field-type",
|
|
@@ -25,6 +27,21 @@ var plugin = {
|
|
|
25
27
|
name: ""
|
|
26
28
|
}
|
|
27
29
|
};
|
|
30
|
+
},
|
|
31
|
+
renderSettings: function renderSettings(_ref) {
|
|
32
|
+
var Bind = _ref.form.Bind;
|
|
33
|
+
return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
34
|
+
span: 12
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
36
|
+
name: "settings.defaultValue"
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
38
|
+
label: t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Default value"]))),
|
|
39
|
+
description: "Default value for the field"
|
|
40
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
41
|
+
value: "true"
|
|
42
|
+
}, "True"), /*#__PURE__*/React.createElement("option", {
|
|
43
|
+
value: ""
|
|
44
|
+
}, "False")))));
|
|
28
45
|
}
|
|
29
46
|
}
|
|
30
47
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
3
|
|
|
4
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
8
8
|
import { Select } from "@webiny/ui/Select";
|
|
9
9
|
import { Input } from "@webiny/ui/Input";
|
|
10
10
|
import { i18n } from "@webiny/app/i18n";
|
|
11
|
-
import { ReactComponent as DateTimeIcon } from "
|
|
11
|
+
import { ReactComponent as DateTimeIcon } from "./icons/schedule-black-24px.svg";
|
|
12
12
|
var t = i18n.ns("app-headless-cms/admin/fields");
|
|
13
13
|
var plugin = {
|
|
14
14
|
type: "cms-editor-field-type",
|
|
@@ -47,15 +47,15 @@ var plugin = {
|
|
|
47
47
|
var lockedField = lockedFields.find(function (lockedField) {
|
|
48
48
|
return lockedField.fieldId === fieldId;
|
|
49
49
|
});
|
|
50
|
-
return /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
51
51
|
span: 12
|
|
52
52
|
}, /*#__PURE__*/React.createElement(Bind, {
|
|
53
53
|
name: "placeholderText"
|
|
54
54
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
55
55
|
label: t(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["Placeholder text"]))),
|
|
56
56
|
description: t(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["Placeholder text (optional)"])))
|
|
57
|
-
}))), /*#__PURE__*/React.createElement(Cell, {
|
|
58
|
-
span:
|
|
57
|
+
})))), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
|
|
58
|
+
span: 6
|
|
59
59
|
}, /*#__PURE__*/React.createElement(Bind, {
|
|
60
60
|
name: "settings.type"
|
|
61
61
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
@@ -70,7 +70,18 @@ var plugin = {
|
|
|
70
70
|
value: t(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["dateTimeWithTimezone"])))
|
|
71
71
|
}, t(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["Date and time with timezone"])))), /*#__PURE__*/React.createElement("option", {
|
|
72
72
|
value: t(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["dateTimeWithoutTimezone"])))
|
|
73
|
-
}, t(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["Date and time without timezone"])))))))
|
|
73
|
+
}, t(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["Date and time without timezone"]))))))), /*#__PURE__*/React.createElement(Cell, {
|
|
74
|
+
span: 6
|
|
75
|
+
}, /*#__PURE__*/React.createElement(Bind, {
|
|
76
|
+
name: "settings.defaultSetValue"
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
78
|
+
label: t(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["Default Admin UI value"]))),
|
|
79
|
+
description: "Affects the Admin UI only"
|
|
80
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
81
|
+
value: t(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["null"])))
|
|
82
|
+
}, t(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["Leave empty (null value)"])))), /*#__PURE__*/React.createElement("option", {
|
|
83
|
+
value: t(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["current"])))
|
|
84
|
+
}, t(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["Current date/time"])))))))));
|
|
74
85
|
}
|
|
75
86
|
}
|
|
76
87
|
};
|
|
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
4
|
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { ReactComponent as FileIcon } from "
|
|
6
|
+
import { ReactComponent as FileIcon } from "./icons/round_insert_drive_file-24px.svg";
|
|
7
7
|
import { i18n } from "@webiny/app/i18n";
|
|
8
8
|
import { Cell, Grid } from "@webiny/ui/Grid";
|
|
9
9
|
import { Radio } from "@webiny/ui/Radio";
|
|
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
4
4
|
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { ReactComponent as LongTextIcon } from "
|
|
6
|
+
import { ReactComponent as LongTextIcon } from "./icons/round-notes.svg";
|
|
7
7
|
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
8
8
|
import { Input } from "@webiny/ui/Input";
|
|
9
9
|
import { i18n } from "@webiny/app/i18n";
|
|
@@ -7,7 +7,7 @@ import { Grid, Cell } from "@webiny/ui/Grid";
|
|
|
7
7
|
import { i18n } from "@webiny/app/i18n";
|
|
8
8
|
import { Input } from "@webiny/ui/Input";
|
|
9
9
|
import PredefinedValuesDynamicFieldset from "./PredefinedValuesDynamicFieldset";
|
|
10
|
-
import { ReactComponent as FloatIcon } from "
|
|
10
|
+
import { ReactComponent as FloatIcon } from "./icons/round-looks_3-24px.svg";
|
|
11
11
|
var t = i18n.ns("app-headless-cms/admin/fields");
|
|
12
12
|
var plugin = {
|
|
13
13
|
type: "cms-editor-field-type",
|
|
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3;
|
|
4
4
|
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { ReactComponent as ObjectIcon } from "
|
|
6
|
+
import { ReactComponent as ObjectIcon } from "./icons/ballot_black_24dp.svg";
|
|
7
7
|
import { i18n } from "@webiny/app/i18n";
|
|
8
8
|
import { ObjectFields } from "./object/ObjectFields";
|
|
9
9
|
import { createFieldsList } from "../../graphql/createFieldsList";
|
|
@@ -13,7 +13,7 @@ import { Cell, Grid } from "@webiny/ui/Grid";
|
|
|
13
13
|
import { MultiAutoComplete } from "@webiny/ui/AutoComplete";
|
|
14
14
|
import { CircularProgress } from "@webiny/ui/Progress";
|
|
15
15
|
import { useSnackbar } from "@webiny/app-admin/hooks/useSnackbar";
|
|
16
|
-
import { ReactComponent as RefIcon } from "
|
|
16
|
+
import { ReactComponent as RefIcon } from "./icons/round-link-24px.svg";
|
|
17
17
|
import { i18n } from "@webiny/app/i18n";
|
|
18
18
|
var t = i18n.ns("app-headless-cms/admin/fields");
|
|
19
19
|
var plugin = {
|
|
@@ -5,7 +5,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { i18n } from "@webiny/app/i18n";
|
|
7
7
|
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
8
|
-
import { ReactComponent as NotesIcon } from "
|
|
8
|
+
import { ReactComponent as NotesIcon } from "./icons/round-text_fields-24px.svg";
|
|
9
9
|
import { Input } from "@webiny/ui/Input";
|
|
10
10
|
var t = i18n.ns("app-headless-cms/admin/fields");
|
|
11
11
|
var plugin = {
|
|
@@ -3,7 +3,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
4
4
|
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { ReactComponent as TextIcon } from "
|
|
6
|
+
import { ReactComponent as TextIcon } from "./icons/round-text_fields-24px.svg";
|
|
7
7
|
import { Grid, Cell } from "@webiny/ui/Grid";
|
|
8
8
|
import { i18n } from "@webiny/app/i18n";
|
|
9
9
|
import { Input } from "@webiny/ui/Input";
|
|
@@ -14,7 +14,7 @@ var plugin = {
|
|
|
14
14
|
name: "cms-editor-field-type-text",
|
|
15
15
|
field: {
|
|
16
16
|
type: "text",
|
|
17
|
-
validators: ["required", "minLength", "maxLength", "pattern"],
|
|
17
|
+
validators: ["required", "minLength", "maxLength", "pattern", "unique"],
|
|
18
18
|
label: t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Text"]))),
|
|
19
19
|
description: t(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["Titles, names, single line values."]))),
|
|
20
20
|
icon: /*#__PURE__*/React.createElement(TextIcon, null),
|
package/admin/plugins/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default: () => (import("../../types").CmsEditorFormSettingsPlugin | import("../../types").CmsIconsPlugin | import("../../types").CmsFieldValueTransformer[] | import("@webiny/app/types").CacheGetObjectIdPlugin | import("@webiny/app/types").RoutePlugin[] | import("@webiny/app-admin/types").AdminInstallationPlugin | import("@webiny/app-admin/types").AdminAppPermissionRendererPlugin | import("
|
|
3
|
-
type: "graphql-playground-tab";
|
|
4
|
-
tab(params: {
|
|
5
|
-
locale: string;
|
|
6
|
-
identity: import("@webiny/app-security/types").SecurityIdentity;
|
|
7
|
-
}): import("@webiny/app-graphql-playground/types").GraphQLPlaygroundTab;
|
|
8
|
-
}>[] | import("../../types").CmsContentDetailsPlugin[] | {
|
|
2
|
+
declare const _default: () => (import("../../types").CmsEditorFormSettingsPlugin | import("../../types").CmsIconsPlugin | import("../../types").CmsFieldValueTransformer[] | import("@webiny/app/types").CacheGetObjectIdPlugin | import("@webiny/app/types").RoutePlugin[] | import("@webiny/app-admin/types").AdminInstallationPlugin | import("@webiny/app-admin/types").AdminAppPermissionRendererPlugin | import("../../types").CmsContentDetailsPlugin[] | {
|
|
9
3
|
name: string;
|
|
10
4
|
type: string;
|
|
11
5
|
render(): JSX.Element;
|
package/admin/plugins/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import routes from "./routes";
|
|
2
|
-
import menus from "./menus";
|
|
3
2
|
import icons from "./icons";
|
|
4
3
|
import install from "./install";
|
|
5
4
|
import contentFormTransformers from "./transformers";
|
|
6
5
|
import defaultBar from "./editor/defaultBar";
|
|
7
6
|
import formSettings from "./editor/formSettings";
|
|
8
|
-
import apiInformation from "./apiInformation";
|
|
9
7
|
import permissionRenderer from "./permissionRenderer";
|
|
10
8
|
import getObjectId from "./getObjectId";
|
|
11
9
|
import contentEntryHeader from "../views/contentEntries/ContentEntry/header";
|
|
12
10
|
export default (function () {
|
|
13
|
-
return [install, routes,
|
|
11
|
+
return [install, routes, icons, contentFormTransformers(), defaultBar, formSettings, permissionRenderer, getObjectId, contentEntryHeader];
|
|
14
12
|
});
|