@webiny/app-headless-cms 5.38.5 → 5.38.6
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/admin/components/ContentEntries/BulkActions/ActionDelete.js +17 -11
- package/admin/components/ContentEntries/BulkActions/ActionDelete.js.map +1 -1
- package/admin/components/ContentEntryForm/Header/RevisionSelector/RevisionSelector.styles.d.ts +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.d.ts +32 -1
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js +60 -20
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.d.ts +13 -1
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js +30 -13
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/dynamicZone/index.js +39 -0
- package/admin/plugins/fieldRenderers/dynamicZone/index.js.map +1 -0
- package/admin/plugins/index.d.ts +2 -2
- package/allPlugins.d.ts +3 -3
- package/components.d.ts +12 -0
- package/components.js +27 -0
- package/components.js.map +1 -0
- package/index.d.ts +2 -1
- package/index.js +16 -4
- package/index.js.map +1 -1
- package/package.json +26 -26
|
@@ -15,6 +15,7 @@ var _mobxReactLite = require("mobx-react-lite");
|
|
|
15
15
|
var _contentEntries = require("../../../config/contentEntries");
|
|
16
16
|
var _hooks = require("../../../hooks");
|
|
17
17
|
var _BulkActions = require("./BulkActions");
|
|
18
|
+
var _parseIdentifier2 = require("@webiny/utils/parseIdentifier");
|
|
18
19
|
var ActionDelete = (0, _mobxReactLite.observer)(function () {
|
|
19
20
|
var _useCms = (0, _hooks.useCms)(),
|
|
20
21
|
deleteEntry = _useCms.deleteEntry;
|
|
@@ -48,46 +49,51 @@ var ActionDelete = (0, _mobxReactLite.observer)(function () {
|
|
|
48
49
|
_context2.next = 2;
|
|
49
50
|
return worker.processInSeries( /*#__PURE__*/function () {
|
|
50
51
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(_ref) {
|
|
51
|
-
var item, report, response, error;
|
|
52
|
+
var item, report, _parseIdentifier, id, response, error;
|
|
52
53
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
53
54
|
while (1) switch (_context.prev = _context.next) {
|
|
54
55
|
case 0:
|
|
55
56
|
item = _ref.item, report = _ref.report;
|
|
56
57
|
_context.prev = 1;
|
|
57
|
-
|
|
58
|
+
/**
|
|
59
|
+
* We need an entryId because we want to delete all revisions of the entry.
|
|
60
|
+
* By sending an entryId (id without #version), we are telling to the API to delete all revisions.
|
|
61
|
+
*/
|
|
62
|
+
_parseIdentifier = (0, _parseIdentifier2.parseIdentifier)(item.id), id = _parseIdentifier.id;
|
|
63
|
+
_context.next = 5;
|
|
58
64
|
return deleteEntry({
|
|
59
65
|
model: contentModel,
|
|
60
66
|
entry: item,
|
|
61
|
-
id:
|
|
67
|
+
id: id
|
|
62
68
|
});
|
|
63
|
-
case
|
|
69
|
+
case 5:
|
|
64
70
|
response = _context.sent;
|
|
65
71
|
error = response.error;
|
|
66
72
|
if (!error) {
|
|
67
|
-
_context.next =
|
|
73
|
+
_context.next = 9;
|
|
68
74
|
break;
|
|
69
75
|
}
|
|
70
76
|
throw new Error(error.message || "Unknown error while deleting the entry");
|
|
71
|
-
case
|
|
77
|
+
case 9:
|
|
72
78
|
removeRecordFromCache(item.id);
|
|
73
79
|
report.success({
|
|
74
80
|
title: "".concat(item.meta.title),
|
|
75
81
|
message: "Entry successfully deleted."
|
|
76
82
|
});
|
|
77
|
-
_context.next =
|
|
83
|
+
_context.next = 16;
|
|
78
84
|
break;
|
|
79
|
-
case
|
|
80
|
-
_context.prev =
|
|
85
|
+
case 13:
|
|
86
|
+
_context.prev = 13;
|
|
81
87
|
_context.t0 = _context["catch"](1);
|
|
82
88
|
report.error({
|
|
83
89
|
title: "".concat(item.meta.title),
|
|
84
90
|
message: _context.t0.message
|
|
85
91
|
});
|
|
86
|
-
case
|
|
92
|
+
case 16:
|
|
87
93
|
case "end":
|
|
88
94
|
return _context.stop();
|
|
89
95
|
}
|
|
90
|
-
}, _callee, null, [[1,
|
|
96
|
+
}, _callee, null, [[1, 13]]);
|
|
91
97
|
}));
|
|
92
98
|
return function (_x) {
|
|
93
99
|
return _ref2.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_delete","_appAco","_mobxReactLite","_contentEntries","_hooks","_BulkActions","ActionDelete","observer","_useCms","useCms","deleteEntry","_useContentEntry","useContentEntry","contentModel","_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","_execute","_asyncToGenerator2","default","_regeneratorRuntime2","mark","_callee2","wrap","_callee2$","_context2","prev","next","processInSeries","_ref2","_callee","_ref","item","report","response","error","_callee$","_context","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_delete","_appAco","_mobxReactLite","_contentEntries","_hooks","_BulkActions","_parseIdentifier2","ActionDelete","observer","_useCms","useCms","deleteEntry","_useContentEntry","useContentEntry","contentModel","_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","_execute","_asyncToGenerator2","default","_regeneratorRuntime2","mark","_callee2","wrap","_callee2$","_context2","prev","next","processInSeries","_ref2","_callee","_ref","item","report","_parseIdentifier","id","response","error","_callee$","_context","parseIdentifier","model","entry","sent","Error","success","meta","t0","stop","_x","apply","arguments","resetItems","results","createElement","icon","ReactComponent","onAction","label","tooltipPlacement","exports"],"sources":["ActionDelete.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { ReactComponent as DeleteIcon } from \"@material-design-icons/svg/outlined/delete.svg\";\nimport { useRecords } from \"@webiny/app-aco\";\nimport { observer } from \"mobx-react-lite\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { useCms, useContentEntry } from \"~/admin/hooks\";\nimport { getEntriesLabel } from \"~/admin/components/ContentEntries/BulkActions/BulkActions\";\nimport { parseIdentifier } from \"@webiny/utils/parseIdentifier\";\n\nexport const ActionDelete = observer(() => {\n const { deleteEntry } = useCms();\n const { contentModel } = useContentEntry();\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: \"Delete entries\",\n message: `You are about to delete ${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 /**\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({\n model: contentModel,\n entry: item,\n id\n });\n\n const { error } = response;\n\n if (error) {\n throw new Error(\n error.message || \"Unknown error while deleting the entry\"\n );\n }\n\n removeRecordFromCache(item.id);\n\n report.success({\n title: `${item.meta.title}`,\n message: \"Entry successfully deleted.\"\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: \"Delete entries\",\n message: \"Finished deleting entries! See full report below:\"\n });\n }\n });\n\n return (\n <IconButton\n icon={<DeleteIcon />}\n onAction={openDeleteEntriesDialog}\n label={`Delete ${entriesLabel}`}\n tooltipPlacement={\"bottom\"}\n />\n );\n});\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AAEO,IAAMQ,YAAY,GAAG,IAAAC,uBAAQ,EAAC,YAAM;EACvC,IAAAC,OAAA,GAAwB,IAAAC,aAAM,EAAC,CAAC;IAAxBC,WAAW,GAAAF,OAAA,CAAXE,WAAW;EACnB,IAAAC,gBAAA,GAAyB,IAAAC,sBAAe,EAAC,CAAC;IAAlCC,YAAY,GAAAF,gBAAA,CAAZE,YAAY;EACpB,IAAAC,WAAA,GAAkC,IAAAC,kBAAU,EAAC,CAAC;IAAtCC,qBAAqB,GAAAF,WAAA,CAArBE,qBAAqB;EAE7B,IAAAC,qBAAA,GAA6CC,sCAAsB,CAACC,OAAO,CAACC,UAAU;IAA9EC,SAAS,GAAAJ,qBAAA,CAATI,SAAS;IAAEC,UAAU,GAAAL,qBAAA,CAAVK,UAAU;IAAEC,SAAS,GAAAN,qBAAA,CAATM,SAAS;EACxC,IAAAC,WAAA,GAAuBF,UAAU,CAAC,CAAC;IAA3BG,UAAU,GAAAD,WAAA,CAAVC,UAAU;EAClB,IAAMC,MAAM,GAAGL,SAAS,CAAC,CAAC;EAC1B,IAAAM,UAAA,GAAsDJ,SAAS,CAAC,CAAC;IAAzD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,CAACkD,UAAU,CAAC,CAAC;gBAEnB/C,iBAAiB,CAAC;kBACdgD,OAAO,EAAEnD,MAAM,CAACmD,OAAO;kBACvBzC,KAAK,EAAE,gBAAgB;kBACvBC,OAAO,EAAE;gBACb,CAAC,CAAC;cAAC;cAAA;gBAAA,OAAAY,SAAA,CAAAuB,IAAA;YAAA;UAAA,GAAA1B,QAAA;QAAA,CACN;QAAA,SAAAN,QAAA;UAAA,OAAAC,QAAA,CAAAiC,KAAA,OAAAC,SAAA;QAAA;QAAA,OAAAnC,OAAA;MAAA;IACL,CAAC,CAAC;EAAA;EAEN,oBACI5C,MAAA,CAAA+C,OAAA,CAAAmC,aAAA,CAACrD,UAAU;IACPsD,IAAI,eAAEnF,MAAA,CAAA+C,OAAA,CAAAmC,aAAA,CAAC/E,OAAA,CAAAiF,cAAU,MAAE,CAAE;IACrBC,QAAQ,EAAE9C,uBAAwB;IAClC+C,KAAK,YAAA5C,MAAA,CAAYR,YAAY,CAAG;IAChCqD,gBAAgB,EAAE;EAAS,CAC9B,CAAC;AAEV,CAAC,CAAC;AAACC,OAAA,CAAA9E,YAAA,GAAAA,YAAA"}
|
package/admin/components/ContentEntryForm/Header/RevisionSelector/RevisionSelector.styles.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare const Menu: import("@emotion/styled").StyledComponent<Pick<import
|
|
|
23
23
|
onOpen?: (() => void) | undefined;
|
|
24
24
|
onClose?: (() => void) | undefined;
|
|
25
25
|
"data-testid"?: string | undefined;
|
|
26
|
-
}, "anchor" | "disabled" | "data-testid" | "
|
|
26
|
+
}, "anchor" | "className" | "disabled" | "data-testid" | "handle" | keyof import("@rmwc/menu").MenuProps>> & Partial<Pick<Partial<import("@rmwc/menu").MenuProps & {
|
|
27
27
|
children: import("react").ReactNode;
|
|
28
28
|
handle?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
29
29
|
anchor?: "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "bottomEnd" | "bottomStart" | "topEnd" | "topStart" | undefined;
|
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { BindComponentRenderProp, CmsModelFieldRendererProps, CmsModel, CmsModelField } from "../../../../types";
|
|
2
|
+
import { BindComponent, BindComponentRenderProp, CmsDynamicZoneTemplate, CmsModelFieldRendererProps, CmsModel, CmsModelField } from "../../../../types";
|
|
3
3
|
declare type GetBind = CmsModelFieldRendererProps["getBind"];
|
|
4
|
+
export interface MultiValueItemContainerProps {
|
|
5
|
+
value: TemplateValue;
|
|
6
|
+
contentModel: CmsModel;
|
|
7
|
+
isFirst: boolean;
|
|
8
|
+
isLast: boolean;
|
|
9
|
+
onMoveUp: () => void;
|
|
10
|
+
onMoveDown: () => void;
|
|
11
|
+
onDelete: () => void;
|
|
12
|
+
onClone: () => void;
|
|
13
|
+
title: React.ReactNode;
|
|
14
|
+
description: string;
|
|
15
|
+
icon: JSX.Element;
|
|
16
|
+
actions: JSX.Element;
|
|
17
|
+
template: CmsDynamicZoneTemplate;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const MultiValueItemContainer: import("@webiny/react-composition").ComposableFC<MultiValueItemContainerProps>;
|
|
21
|
+
export interface MultiValueItemItemProps {
|
|
22
|
+
template: CmsDynamicZoneTemplate;
|
|
23
|
+
contentModel: CmsModel;
|
|
24
|
+
Bind: BindComponent;
|
|
25
|
+
}
|
|
26
|
+
export declare const MultiValueItem: import("@webiny/react-composition").ComposableFC<MultiValueItemItemProps>;
|
|
27
|
+
interface TemplateValue {
|
|
28
|
+
_templateId: string;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
export interface MultiValueContainerProps extends MultiValueDynamicZoneProps {
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare const MultiValueContainer: import("@webiny/react-composition").ComposableFC<MultiValueContainerProps>;
|
|
4
35
|
interface MultiValueDynamicZoneProps {
|
|
5
36
|
field: CmsModelField;
|
|
6
37
|
bind: BindComponentRenderProp;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.MultiValueDynamicZone = void 0;
|
|
7
|
+
exports.MultiValueItemContainer = exports.MultiValueItem = exports.MultiValueDynamicZone = exports.MultiValueContainer = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
@@ -17,21 +17,48 @@ var _AddTemplate = require("./AddTemplate");
|
|
|
17
17
|
var _TemplateIcon = require("./TemplateIcon");
|
|
18
18
|
var _hooks = require("../../../hooks");
|
|
19
19
|
var _Fields = require("../../../components/ContentEntryForm/Fields");
|
|
20
|
+
var _reactComposition = require("@webiny/react-composition");
|
|
20
21
|
var BottomMargin = /*#__PURE__*/(0, _styled.default)("div", {
|
|
21
22
|
label: "BottomMargin",
|
|
22
23
|
target: "e1mhu37c0"
|
|
23
24
|
})("margin-bottom:20px;");
|
|
24
|
-
var
|
|
25
|
+
var MultiValueItemContainer = (0, _reactComposition.makeComposable)("MultiValueItemContainer", function (_ref) {
|
|
26
|
+
var title = _ref.title,
|
|
27
|
+
description = _ref.description,
|
|
28
|
+
icon = _ref.icon,
|
|
29
|
+
actions = _ref.actions,
|
|
30
|
+
children = _ref.children;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_Accordion.AccordionItem, {
|
|
32
|
+
title: title,
|
|
33
|
+
description: description,
|
|
34
|
+
icon: icon,
|
|
35
|
+
actions: actions
|
|
36
|
+
}, children);
|
|
37
|
+
});
|
|
38
|
+
exports.MultiValueItemContainer = MultiValueItemContainer;
|
|
39
|
+
var MultiValueItem = (0, _reactComposition.makeComposable)("MultiValueItem", function (props) {
|
|
40
|
+
var template = props.template,
|
|
41
|
+
Bind = props.Bind,
|
|
42
|
+
contentModel = props.contentModel;
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_Fields.Fields, {
|
|
44
|
+
fields: template.fields,
|
|
45
|
+
layout: template.layout || [],
|
|
46
|
+
contentModel: contentModel,
|
|
47
|
+
Bind: Bind
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
exports.MultiValueItem = MultiValueItem;
|
|
51
|
+
var TemplateValueForm = function TemplateValueForm(_ref2) {
|
|
25
52
|
var _field$settings;
|
|
26
|
-
var value =
|
|
27
|
-
contentModel =
|
|
28
|
-
Bind =
|
|
29
|
-
isLast =
|
|
30
|
-
isFirst =
|
|
31
|
-
onMoveUp =
|
|
32
|
-
onMoveDown =
|
|
33
|
-
onDelete =
|
|
34
|
-
onClone =
|
|
53
|
+
var value = _ref2.value,
|
|
54
|
+
contentModel = _ref2.contentModel,
|
|
55
|
+
Bind = _ref2.Bind,
|
|
56
|
+
isLast = _ref2.isLast,
|
|
57
|
+
isFirst = _ref2.isFirst,
|
|
58
|
+
onMoveUp = _ref2.onMoveUp,
|
|
59
|
+
onMoveDown = _ref2.onMoveDown,
|
|
60
|
+
onDelete = _ref2.onDelete,
|
|
61
|
+
onClone = _ref2.onClone;
|
|
35
62
|
var _useModelField = (0, _hooks.useModelField)(),
|
|
36
63
|
field = _useModelField.field;
|
|
37
64
|
var templates = ((_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.templates) || [];
|
|
@@ -41,12 +68,21 @@ var TemplateValueForm = function TemplateValueForm(_ref) {
|
|
|
41
68
|
if (!template) {
|
|
42
69
|
return null;
|
|
43
70
|
}
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(MultiValueItemContainer, {
|
|
72
|
+
value: value,
|
|
73
|
+
contentModel: contentModel,
|
|
74
|
+
onClone: onClone,
|
|
75
|
+
isFirst: isFirst,
|
|
76
|
+
isLast: isLast,
|
|
77
|
+
onDelete: onDelete,
|
|
78
|
+
onMoveUp: onMoveUp,
|
|
79
|
+
onMoveDown: onMoveDown,
|
|
45
80
|
title: template.name,
|
|
46
81
|
description: template.description,
|
|
47
82
|
icon: /*#__PURE__*/_react.default.createElement(_TemplateIcon.TemplateIcon, {
|
|
48
83
|
icon: template.icon
|
|
49
84
|
}),
|
|
85
|
+
template: template,
|
|
50
86
|
actions: /*#__PURE__*/_react.default.createElement(_Accordion.AccordionItem.Actions, null, /*#__PURE__*/_react.default.createElement(_Accordion.AccordionItem.Action, {
|
|
51
87
|
icon: /*#__PURE__*/_react.default.createElement(_expand_less.ReactComponent, null),
|
|
52
88
|
onClick: onMoveUp,
|
|
@@ -62,17 +98,21 @@ var TemplateValueForm = function TemplateValueForm(_ref) {
|
|
|
62
98
|
icon: /*#__PURE__*/_react.default.createElement(_delete_outline.ReactComponent, null),
|
|
63
99
|
onClick: onDelete
|
|
64
100
|
}))
|
|
65
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
66
|
-
|
|
67
|
-
layout: template.layout || [],
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(MultiValueItem, {
|
|
102
|
+
template: template,
|
|
68
103
|
contentModel: contentModel,
|
|
69
104
|
Bind: Bind
|
|
70
105
|
}));
|
|
71
106
|
};
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
107
|
+
var MultiValueContainer = (0, _reactComposition.makeComposable)("MultiValueContainer", function (_ref3) {
|
|
108
|
+
var children = _ref3.children;
|
|
109
|
+
return /*#__PURE__*/_react.default.createElement(_Accordion.Accordion, null, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children));
|
|
110
|
+
});
|
|
111
|
+
exports.MultiValueContainer = MultiValueContainer;
|
|
112
|
+
var MultiValueDynamicZone = function MultiValueDynamicZone(props) {
|
|
113
|
+
var bind = props.bind,
|
|
114
|
+
getBind = props.getBind,
|
|
115
|
+
contentModel = props.contentModel;
|
|
76
116
|
var onTemplate = function onTemplate(template) {
|
|
77
117
|
bind.appendValue({
|
|
78
118
|
_templateId: template.id
|
|
@@ -84,7 +124,7 @@ var MultiValueDynamicZone = function MultiValueDynamicZone(_ref2) {
|
|
|
84
124
|
};
|
|
85
125
|
var values = bind.value || [];
|
|
86
126
|
var hasValues = values.length > 0;
|
|
87
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, hasValues ? /*#__PURE__*/_react.default.createElement(
|
|
127
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, hasValues ? /*#__PURE__*/_react.default.createElement(MultiValueContainer, props, values.map(function (value, index) {
|
|
88
128
|
return /*#__PURE__*/_react.default.createElement(TemplateValueForm, {
|
|
89
129
|
key: index,
|
|
90
130
|
value: value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_styled","_cloneDeep","_Accordion","_delete_outline","_library_add","_expand_less","_expand_more","_AddTemplate","_TemplateIcon","_hooks","_Fields","BottomMargin","styled","label","target","TemplateValueForm","_ref","_field$settings","value","contentModel","Bind","isLast","isFirst","onMoveUp","onMoveDown","onDelete","onClone","_useModelField","useModelField","field","templates","settings","template","find","tpl","id","_templateId","default","createElement","AccordionItem","title","name","description","icon","TemplateIcon","actions","Actions","Action","ReactComponent","onClick","disabled","Divider","Fields","fields","layout","MultiValueDynamicZone","_ref2","bind","getBind","onTemplate","appendValue","cloneValue","index","newValue","cloneDeep","values","hasValues","length","Fragment","Accordion","map","key","moveValueUp","moveValueDown","removeValue","AddTemplateIcon","AddTemplateButton","exports"],"sources":["MultiValueDynamicZone.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { Accordion, AccordionItem } from \"@webiny/ui/Accordion\";\nimport { ReactComponent as DeleteIcon } from \"@material-design-icons/svg/outlined/delete_outline.svg\";\nimport { ReactComponent as CloneIcon } from \"@material-design-icons/svg/outlined/library_add.svg\";\nimport { ReactComponent as ArrowUpIcon } from \"@material-design-icons/svg/round/expand_less.svg\";\nimport { ReactComponent as ArrowDownIcon } from \"@material-design-icons/svg/round/expand_more.svg\";\nimport { AddTemplateButton, AddTemplateIcon } from \"./AddTemplate\";\nimport { TemplateIcon } from \"./TemplateIcon\";\nimport { useModelField } from \"~/admin/hooks\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\nimport {\n BindComponent,\n BindComponentRenderProp,\n CmsDynamicZoneTemplate,\n CmsModelFieldRendererProps,\n CmsModel,\n CmsModelField\n} from \"~/types\";\n\nconst BottomMargin = styled.div`\n margin-bottom: 20px;\n`;\n\ntype GetBind = CmsModelFieldRendererProps[\"getBind\"];\n\ninterface TemplateValue {\n _templateId: string;\n [key: string]: any;\n}\n\ninterface TemplateValueFormProps {\n value: TemplateValue;\n contentModel: CmsModel;\n Bind: BindComponent;\n isFirst: boolean;\n isLast: boolean;\n onMoveUp: () => void;\n onMoveDown: () => void;\n onDelete: () => void;\n onClone: () => void;\n}\n\nconst TemplateValueForm: React.VFC<TemplateValueFormProps> = ({\n value,\n contentModel,\n Bind,\n isLast,\n isFirst,\n onMoveUp,\n onMoveDown,\n onDelete,\n onClone\n}) => {\n const { field } = useModelField();\n const templates = field.settings?.templates || [];\n\n const template: CmsDynamicZoneTemplate | undefined = templates.find(\n tpl => tpl.id === value._templateId\n );\n\n if (!template) {\n return null;\n }\n\n return (\n <AccordionItem\n title={template.name}\n description={template.description}\n icon={<TemplateIcon icon={template.icon} />}\n actions={\n <AccordionItem.Actions>\n <AccordionItem.Action\n icon={<ArrowUpIcon />}\n onClick={onMoveUp}\n disabled={isFirst}\n />\n <AccordionItem.Action\n icon={<ArrowDownIcon />}\n onClick={onMoveDown}\n disabled={isLast}\n />\n <AccordionItem.Divider />\n <AccordionItem.Action icon={<CloneIcon />} onClick={onClone} />\n <AccordionItem.Action icon={<DeleteIcon />} onClick={onDelete} />\n </AccordionItem.Actions>\n }\n >\n <Fields\n fields={template.fields}\n layout={template.layout || []}\n contentModel={contentModel}\n Bind={Bind}\n />\n </AccordionItem>\n );\n};\n\ninterface MultiValueDynamicZoneProps {\n field: CmsModelField;\n bind: BindComponentRenderProp;\n contentModel: CmsModel;\n getBind: GetBind;\n}\n\nexport const MultiValueDynamicZone: React.VFC<MultiValueDynamicZoneProps> = ({\n bind,\n getBind,\n contentModel\n}) => {\n const onTemplate = (template: CmsDynamicZoneTemplate) => {\n bind.appendValue({ _templateId: template.id });\n };\n\n const cloneValue = (index: number) => {\n const newValue = cloneDeep(bind.value[index]);\n bind.appendValue(newValue, index + 1);\n };\n\n const values: TemplateValue[] = bind.value || [];\n const hasValues = values.length > 0;\n\n return (\n <>\n {hasValues ? (\n <Accordion>\n {values.map((value, index) => (\n <TemplateValueForm\n key={index}\n value={value}\n contentModel={contentModel}\n Bind={getBind(index)}\n isFirst={index === 0}\n isLast={index === values.length - 1}\n onMoveUp={() => bind.moveValueUp(index)}\n onMoveDown={() => bind.moveValueDown(index)}\n onDelete={() => bind.removeValue(index)}\n onClone={() => cloneValue(index)}\n />\n ))}\n </Accordion>\n ) : null}\n {hasValues ? (\n <AddTemplateIcon onTemplate={onTemplate} />\n ) : (\n <BottomMargin>\n <AddTemplateButton onTemplate={onTemplate} />\n </BottomMargin>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAA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,YAAY,EAAEA,YAAa;MAC3BC,IAAI,EAAEsC,OAAO,CAACI,KAAK,CAAE;MACrBxC,OAAO,EAAEwC,KAAK,KAAK,CAAE;MACrBzC,MAAM,EAAEyC,KAAK,KAAKG,MAAM,CAACE,MAAM,GAAG,CAAE;MACpC5C,QAAQ,EAAE,SAAAA,SAAA;QAAA,OAAMkC,IAAI,CAACe,WAAW,CAACV,KAAK,CAAC;MAAA,CAAC;MACxCtC,UAAU,EAAE,SAAAA,WAAA;QAAA,OAAMiC,IAAI,CAACgB,aAAa,CAACX,KAAK,CAAC;MAAA,CAAC;MAC5CrC,QAAQ,EAAE,SAAAA,SAAA;QAAA,OAAMgC,IAAI,CAACiB,WAAW,CAACZ,KAAK,CAAC;MAAA,CAAC;MACxCpC,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAMmC,UAAU,CAACC,KAAK,CAAC;MAAA;IAAC,CACpC,CAAC;EAAA,CACL,CACM,CAAC,GACZ,IAAI,EACPI,SAAS,gBACNrE,MAAA,CAAAwC,OAAA,CAAAC,aAAA,CAAC/B,YAAA,CAAAoE,eAAe;IAAChB,UAAU,EAAEA;EAAW,CAAE,CAAC,gBAE3C9D,MAAA,CAAAwC,OAAA,CAAAC,aAAA,CAAC3B,YAAY,qBACTd,MAAA,CAAAwC,OAAA,CAAAC,aAAA,CAAC/B,YAAA,CAAAqE,iBAAiB;IAACjB,UAAU,EAAEA;EAAW,CAAE,CAClC,CAEpB,CAAC;AAEX,CAAC;AAACkB,OAAA,CAAAtB,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_styled","_cloneDeep","_Accordion","_delete_outline","_library_add","_expand_less","_expand_more","_AddTemplate","_TemplateIcon","_hooks","_Fields","_reactComposition","BottomMargin","styled","label","target","MultiValueItemContainer","makeComposable","_ref","title","description","icon","actions","children","default","createElement","AccordionItem","exports","MultiValueItem","props","template","Bind","contentModel","Fields","fields","layout","TemplateValueForm","_ref2","_field$settings","value","isLast","isFirst","onMoveUp","onMoveDown","onDelete","onClone","_useModelField","useModelField","field","templates","settings","find","tpl","id","_templateId","name","TemplateIcon","Actions","Action","ReactComponent","onClick","disabled","Divider","MultiValueContainer","_ref3","Accordion","Fragment","MultiValueDynamicZone","bind","getBind","onTemplate","appendValue","cloneValue","index","newValue","cloneDeep","values","hasValues","length","map","key","moveValueUp","moveValueDown","removeValue","AddTemplateIcon","AddTemplateButton"],"sources":["MultiValueDynamicZone.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { Accordion, AccordionItem } from \"@webiny/ui/Accordion\";\nimport { ReactComponent as DeleteIcon } from \"@material-design-icons/svg/outlined/delete_outline.svg\";\nimport { ReactComponent as CloneIcon } from \"@material-design-icons/svg/outlined/library_add.svg\";\nimport { ReactComponent as ArrowUpIcon } from \"@material-design-icons/svg/round/expand_less.svg\";\nimport { ReactComponent as ArrowDownIcon } from \"@material-design-icons/svg/round/expand_more.svg\";\nimport { AddTemplateButton, AddTemplateIcon } from \"./AddTemplate\";\nimport { TemplateIcon } from \"./TemplateIcon\";\nimport { useModelField } from \"~/admin/hooks\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\nimport {\n BindComponent,\n BindComponentRenderProp,\n CmsDynamicZoneTemplate,\n CmsModelFieldRendererProps,\n CmsModel,\n CmsModelField\n} from \"~/types\";\nimport { makeComposable } from \"@webiny/react-composition\";\n\nconst BottomMargin = styled.div`\n margin-bottom: 20px;\n`;\n\ntype GetBind = CmsModelFieldRendererProps[\"getBind\"];\n\nexport interface MultiValueItemContainerProps {\n value: TemplateValue;\n contentModel: CmsModel;\n isFirst: boolean;\n isLast: boolean;\n onMoveUp: () => void;\n onMoveDown: () => void;\n onDelete: () => void;\n onClone: () => void;\n title: React.ReactNode;\n description: string;\n icon: JSX.Element;\n actions: JSX.Element;\n template: CmsDynamicZoneTemplate;\n children: React.ReactNode;\n}\n\nexport const MultiValueItemContainer = makeComposable(\n \"MultiValueItemContainer\",\n ({ title, description, icon, actions, children }: MultiValueItemContainerProps) => {\n return (\n <AccordionItem title={title} description={description} icon={icon} actions={actions}>\n {children}\n </AccordionItem>\n );\n }\n);\n\nexport interface MultiValueItemItemProps {\n template: CmsDynamicZoneTemplate;\n contentModel: CmsModel;\n Bind: BindComponent;\n}\n\nexport const MultiValueItem = makeComposable(\"MultiValueItem\", (props: MultiValueItemItemProps) => {\n const { template, Bind, contentModel } = props;\n\n return (\n <Fields\n fields={template.fields}\n layout={template.layout || []}\n contentModel={contentModel}\n Bind={Bind}\n />\n );\n});\n\ninterface TemplateValue {\n _templateId: string;\n [key: string]: any;\n}\n\ninterface TemplateValueFormProps {\n value: TemplateValue;\n contentModel: CmsModel;\n Bind: BindComponent;\n isFirst: boolean;\n isLast: boolean;\n onMoveUp: () => void;\n onMoveDown: () => void;\n onDelete: () => void;\n onClone: () => void;\n}\n\nconst TemplateValueForm: React.VFC<TemplateValueFormProps> = ({\n value,\n contentModel,\n Bind,\n isLast,\n isFirst,\n onMoveUp,\n onMoveDown,\n onDelete,\n onClone\n}) => {\n const { field } = useModelField();\n const templates = field.settings?.templates || [];\n\n const template: CmsDynamicZoneTemplate | undefined = templates.find(\n tpl => tpl.id === value._templateId\n );\n\n if (!template) {\n return null;\n }\n\n return (\n <MultiValueItemContainer\n value={value}\n contentModel={contentModel}\n onClone={onClone}\n isFirst={isFirst}\n isLast={isLast}\n onDelete={onDelete}\n onMoveUp={onMoveUp}\n onMoveDown={onMoveDown}\n title={template.name}\n description={template.description}\n icon={<TemplateIcon icon={template.icon} />}\n template={template}\n actions={\n <AccordionItem.Actions>\n <AccordionItem.Action\n icon={<ArrowUpIcon />}\n onClick={onMoveUp}\n disabled={isFirst}\n />\n <AccordionItem.Action\n icon={<ArrowDownIcon />}\n onClick={onMoveDown}\n disabled={isLast}\n />\n <AccordionItem.Divider />\n <AccordionItem.Action icon={<CloneIcon />} onClick={onClone} />\n <AccordionItem.Action icon={<DeleteIcon />} onClick={onDelete} />\n </AccordionItem.Actions>\n }\n >\n <MultiValueItem template={template} contentModel={contentModel} Bind={Bind} />\n </MultiValueItemContainer>\n );\n};\n\nexport interface MultiValueContainerProps extends MultiValueDynamicZoneProps {\n children: React.ReactNode;\n}\n\nexport const MultiValueContainer = makeComposable<MultiValueContainerProps>(\n \"MultiValueContainer\",\n ({ children }) => {\n return (\n <Accordion>\n <>{children}</>\n </Accordion>\n );\n }\n);\n\ninterface MultiValueDynamicZoneProps {\n // TODO: this prop might be useless, because we now have a `useModelField` hook.\n field: CmsModelField;\n bind: BindComponentRenderProp;\n contentModel: CmsModel;\n getBind: GetBind;\n}\n\nexport const MultiValueDynamicZone: React.VFC<MultiValueDynamicZoneProps> = props => {\n const { bind, getBind, contentModel } = props;\n const onTemplate = (template: CmsDynamicZoneTemplate) => {\n bind.appendValue({ _templateId: template.id });\n };\n\n const cloneValue = (index: number) => {\n const newValue = cloneDeep(bind.value[index]);\n bind.appendValue(newValue, index + 1);\n };\n\n const values: TemplateValue[] = bind.value || [];\n const hasValues = values.length > 0;\n\n return (\n <>\n {hasValues ? (\n <MultiValueContainer {...props}>\n {values.map((value, index) => (\n <TemplateValueForm\n key={index}\n value={value}\n contentModel={contentModel}\n Bind={getBind(index)}\n isFirst={index === 0}\n isLast={index === values.length - 1}\n onMoveUp={() => bind.moveValueUp(index)}\n onMoveDown={() => bind.moveValueDown(index)}\n onDelete={() => bind.removeValue(index)}\n onClone={() => cloneValue(index)}\n />\n ))}\n </MultiValueContainer>\n ) : null}\n {hasValues ? (\n <AddTemplateIcon onTemplate={onTemplate} />\n ) : (\n <BottomMargin>\n <AddTemplateButton onTemplate={onTemplate} />\n </BottomMargin>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,C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AC,GACtB,IAAI,EACPI,SAAS,gBACNhF,MAAA,CAAA2B,OAAA,CAAAC,aAAA,CAAClB,YAAA,CAAA6E,eAAe;IAACd,UAAU,EAAEA;EAAW,CAAE,CAAC,gBAE3CzE,MAAA,CAAA2B,OAAA,CAAAC,aAAA,CAACb,YAAY,qBACTf,MAAA,CAAA2B,OAAA,CAAAC,aAAA,CAAClB,YAAA,CAAA8E,iBAAiB;IAACf,UAAU,EAAEA;EAAW,CAAE,CAClC,CAEpB,CAAC;AAEX,CAAC;AAAC3C,OAAA,CAAAwC,qBAAA,GAAAA,qBAAA"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BindComponent, BindComponentRenderProp, CmsModel, CmsModelField, CmsModelFieldRendererPlugin } from "../../../../types";
|
|
3
|
+
export declare type DynamicZoneContainerProps = {
|
|
4
|
+
field: CmsModelField;
|
|
5
|
+
getBind: (index?: number, key?: string) => BindComponent;
|
|
6
|
+
contentModel: CmsModel;
|
|
7
|
+
bind: BindComponentRenderProp;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const DynamicZoneContainer: import("@webiny/react-composition").ComposableFC<DynamicZoneContainerProps>;
|
|
2
14
|
export declare const dynamicZoneFieldRenderer: CmsModelFieldRendererPlugin;
|
|
@@ -4,14 +4,36 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.dynamicZoneFieldRenderer = void 0;
|
|
7
|
+
exports.dynamicZoneFieldRenderer = exports.DynamicZoneContainer = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _emotion = require("emotion");
|
|
10
10
|
var _Accordion = require("@webiny/ui/Accordion");
|
|
11
11
|
var _SingleValueDynamicZone = require("./SingleValueDynamicZone");
|
|
12
12
|
var _MultiValueDynamicZone = require("./MultiValueDynamicZone");
|
|
13
13
|
var _FormElementMessage = require("@webiny/ui/FormElementMessage");
|
|
14
|
+
var _reactComposition = require("@webiny/react-composition");
|
|
14
15
|
var noBottomPadding = /*#__PURE__*/(0, _emotion.css)("> .webiny-ui-accordion-item__content{padding-bottom:0 !important;}label:noBottomPadding;");
|
|
16
|
+
var DynamicZoneContainer = (0, _reactComposition.makeComposable)("DynamicZoneContainer", function (props) {
|
|
17
|
+
var field = props.field,
|
|
18
|
+
_props$bind$validatio = props.bind.validation,
|
|
19
|
+
isValid = _props$bind$validatio.isValid,
|
|
20
|
+
message = _props$bind$validatio.message,
|
|
21
|
+
_props$title = props.title,
|
|
22
|
+
title = _props$title === void 0 ? field.label : _props$title,
|
|
23
|
+
_props$description = props.description,
|
|
24
|
+
description = _props$description === void 0 ? field.helpText : _props$description,
|
|
25
|
+
className = props.className,
|
|
26
|
+
children = props.children;
|
|
27
|
+
var defaultClassName = field.multipleValues ? noBottomPadding : undefined;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Accordion.Accordion, null, /*#__PURE__*/_react.default.createElement(_Accordion.AccordionItem, {
|
|
29
|
+
title: title,
|
|
30
|
+
description: description,
|
|
31
|
+
className: className || defaultClassName
|
|
32
|
+
}, children)), isValid === false && /*#__PURE__*/_react.default.createElement(_FormElementMessage.FormElementMessage, {
|
|
33
|
+
error: true
|
|
34
|
+
}, message));
|
|
35
|
+
});
|
|
36
|
+
exports.DynamicZoneContainer = DynamicZoneContainer;
|
|
15
37
|
var DynamicZoneContent = function DynamicZoneContent(_ref) {
|
|
16
38
|
var _field$settings;
|
|
17
39
|
var field = _ref.field,
|
|
@@ -22,25 +44,20 @@ var DynamicZoneContent = function DynamicZoneContent(_ref) {
|
|
|
22
44
|
console.info("Skipping \"".concat(field.fieldId, "\" field. There are no templates defined for this dynamic zone."));
|
|
23
45
|
return null;
|
|
24
46
|
}
|
|
25
|
-
var isMultipleValues = field.multipleValues === true;
|
|
26
47
|
var Bind = getBind();
|
|
27
|
-
var Component =
|
|
48
|
+
var Component = field.multipleValues ? _MultiValueDynamicZone.MultiValueDynamicZone : _SingleValueDynamicZone.SingleValueDynamicZone;
|
|
28
49
|
return /*#__PURE__*/_react.default.createElement(Bind, null, function (bind) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
description: field.helpText,
|
|
35
|
-
className: isMultipleValues ? noBottomPadding : undefined
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(DynamicZoneContainer, {
|
|
51
|
+
field: field,
|
|
52
|
+
bind: bind,
|
|
53
|
+
getBind: getBind,
|
|
54
|
+
contentModel: contentModel
|
|
36
55
|
}, /*#__PURE__*/_react.default.createElement(Component, {
|
|
37
56
|
bind: bind,
|
|
38
57
|
field: field,
|
|
39
58
|
getBind: getBind,
|
|
40
59
|
contentModel: contentModel
|
|
41
|
-
}))
|
|
42
|
-
error: true
|
|
43
|
-
}, message));
|
|
60
|
+
}));
|
|
44
61
|
});
|
|
45
62
|
};
|
|
46
63
|
var dynamicZoneFieldRenderer = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_emotion","_Accordion","_SingleValueDynamicZone","_MultiValueDynamicZone","_FormElementMessage","noBottomPadding","css","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_emotion","_Accordion","_SingleValueDynamicZone","_MultiValueDynamicZone","_FormElementMessage","_reactComposition","noBottomPadding","css","DynamicZoneContainer","makeComposable","props","field","_props$bind$validatio","bind","validation","isValid","message","_props$title","title","label","_props$description","description","helpText","className","children","defaultClassName","multipleValues","undefined","default","createElement","Fragment","Accordion","AccordionItem","FormElementMessage","error","exports","DynamicZoneContent","_ref","_field$settings","getBind","contentModel","templates","settings","length","console","info","concat","fieldId","Bind","Component","MultiValueDynamicZone","SingleValueDynamicZone","dynamicZoneFieldRenderer","type","name","renderer","rendererName","canUse","_ref2","render"],"sources":["dynamicZoneRenderer.tsx"],"sourcesContent":["import React from \"react\";\nimport { css } from \"emotion\";\nimport { Accordion, AccordionItem } from \"@webiny/ui/Accordion\";\nimport {\n BindComponent,\n BindComponentRenderProp,\n CmsModel,\n CmsModelField,\n CmsModelFieldRendererPlugin,\n CmsModelFieldRendererProps\n} from \"~/types\";\nimport { SingleValueDynamicZone } from \"./SingleValueDynamicZone\";\nimport { MultiValueDynamicZone } from \"./MultiValueDynamicZone\";\nimport { FormElementMessage } from \"@webiny/ui/FormElementMessage\";\nimport { makeComposable } from \"@webiny/react-composition\";\n\nconst noBottomPadding = css`\n > .webiny-ui-accordion-item__content {\n padding-bottom: 0 !important;\n }\n`;\n\nexport type DynamicZoneContainerProps = {\n field: CmsModelField;\n getBind: (index?: number, key?: string) => BindComponent;\n contentModel: CmsModel;\n bind: BindComponentRenderProp;\n children: React.ReactNode;\n title?: string;\n description?: string;\n className?: string;\n};\n\nexport const DynamicZoneContainer = makeComposable<DynamicZoneContainerProps>(\n \"DynamicZoneContainer\",\n props => {\n const {\n field,\n bind: {\n validation: { isValid, message }\n },\n title = field.label,\n description = field.helpText,\n className,\n children\n } = props;\n\n const defaultClassName = field.multipleValues ? noBottomPadding : undefined;\n\n return (\n <>\n <Accordion>\n <AccordionItem\n title={title}\n description={description}\n className={className || defaultClassName}\n >\n {children}\n </AccordionItem>\n </Accordion>\n {isValid === false && (\n <FormElementMessage error={true}>{message}</FormElementMessage>\n )}\n </>\n );\n }\n);\n\nconst DynamicZoneContent: React.VFC<CmsModelFieldRendererProps> = ({\n field,\n getBind,\n contentModel\n}) => {\n const templates = field.settings?.templates || [];\n if (!templates.length) {\n console.info(\n `Skipping \"${field.fieldId}\" field. There are no templates defined for this dynamic zone.`\n );\n return null;\n }\n\n const Bind = getBind();\n\n const Component = field.multipleValues ? MultiValueDynamicZone : SingleValueDynamicZone;\n\n return (\n <Bind>\n {bind => {\n return (\n <DynamicZoneContainer\n field={field}\n bind={bind}\n getBind={getBind}\n contentModel={contentModel}\n >\n <Component\n bind={bind}\n field={field}\n getBind={getBind}\n contentModel={contentModel}\n />\n </DynamicZoneContainer>\n );\n }}\n </Bind>\n );\n};\n\nexport const dynamicZoneFieldRenderer: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-dynamic-zone\",\n renderer: {\n rendererName: \"dynamicZone\",\n name: \"Dynamic Zone\",\n description: \"Renders a dynamic zone.\",\n canUse({ field }) {\n return field.type === \"dynamicZone\";\n },\n render(props) {\n return <DynamicZoneContent {...props} />;\n }\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AASA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAEA,IAAMO,eAAe,oBAAGC,YAAG,6FAI1B;AAaM,IAAMC,oBAAoB,GAAG,IAAAC,gCAAc,EAC9C,sBAAsB,EACtB,UAAAC,KAAK,EAAI;EACL,IACIC,KAAK,GAQLD,KAAK,CARLC,KAAK;IAAAC,qBAAA,GAQLF,KAAK,CAPLG,IAAI,CACAC,UAAU;IAAIC,OAAO,GAAAH,qBAAA,CAAPG,OAAO;IAAEC,OAAO,GAAAJ,qBAAA,CAAPI,OAAO;IAAAC,YAAA,GAMlCP,KAAK,CAJLQ,KAAK;IAALA,KAAK,GAAAD,YAAA,cAAGN,KAAK,CAACQ,KAAK,GAAAF,YAAA;IAAAG,kBAAA,GAInBV,KAAK,CAHLW,WAAW;IAAXA,WAAW,GAAAD,kBAAA,cAAGT,KAAK,CAACW,QAAQ,GAAAF,k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(exports, "DynamicZoneContainer", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _dynamicZoneRenderer.DynamicZoneContainer;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DynamicZoneContainerProps", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _dynamicZoneRenderer.DynamicZoneContainerProps;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "MultiValueContainer", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _MultiValueDynamicZone.MultiValueContainer;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "MultiValueItem", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _MultiValueDynamicZone.MultiValueItem;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "MultiValueItemContainer", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _MultiValueDynamicZone.MultiValueItemContainer;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _dynamicZoneRenderer = require("./dynamicZoneRenderer");
|
|
37
|
+
var _MultiValueDynamicZone = require("./MultiValueDynamicZone");
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dynamicZoneRenderer","require","_MultiValueDynamicZone"],"sources":["index.tsx"],"sourcesContent":["export { DynamicZoneContainerProps, DynamicZoneContainer } from \"./dynamicZoneRenderer\";\nexport {\n MultiValueItemContainer,\n MultiValueContainer,\n MultiValueItem\n} from \"./MultiValueDynamicZone\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA"}
|
package/admin/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default: () => (import("@webiny/app-headless-cms-common/types").
|
|
2
|
+
declare const _default: () => (import("@webiny/app-headless-cms-common/types").CmsEditorFormSettingsPlugin | import("@webiny/app-headless-cms-common/types").CmsIconsPlugin | import("@webiny/app-admin/types").AdminInstallationPlugin | import("@webiny/app-admin/types").AdminAppPermissionRendererPlugin | import("@webiny/app/types").RoutePlugin[] | import("@webiny/app-headless-cms-common/types").CmsFieldValueTransformer<{
|
|
3
3
|
id: string;
|
|
4
4
|
type: string;
|
|
5
5
|
fieldId: string;
|
|
@@ -16,7 +16,7 @@ declare const _default: () => (import("@webiny/app-headless-cms-common/types").C
|
|
|
16
16
|
name: string;
|
|
17
17
|
} | ((props: import("@webiny/app-headless-cms-common/types").CmsModelFieldRendererProps) => import("react").ReactNode);
|
|
18
18
|
tags?: string[] | undefined;
|
|
19
|
-
}>[] | import("@webiny/app
|
|
19
|
+
}>[] | import("@webiny/app").ApolloCacheObjectIdPlugin<import("@webiny/app/plugins/ApolloCacheObjectIdPlugin").ApolloCacheObject> | {
|
|
20
20
|
name: string;
|
|
21
21
|
type: string;
|
|
22
22
|
render(): JSX.Element;
|
package/allPlugins.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const _default: (import("@webiny/app-headless-cms-common/types").CmsModelFieldRendererPlugin | import("@webiny/app-headless-cms-common/types").CmsModelFieldTypePlugin | import("@webiny/app-headless-cms-common/types").CmsModelFieldRendererPlugin[] | import("@webiny/app-headless-cms-common/types").CmsModelFieldValidatorPlugin<any> | (import("@webiny/app-headless-cms-common/types").
|
|
2
|
+
declare const _default: (import("@webiny/app-headless-cms-common/types").CmsModelFieldRegexValidatorExpressionPlugin | import("@webiny/app-headless-cms-common/types").CmsModelFieldRendererPlugin | import("@webiny/app-headless-cms-common/types").CmsModelFieldTypePlugin | import("@webiny/app-headless-cms-common/types").CmsModelFieldRendererPlugin[] | import("@webiny/app-headless-cms-common/types").CmsModelFieldValidatorPlugin<any> | (import("@webiny/app-headless-cms-common/types").CmsEditorFormSettingsPlugin | import("@webiny/app-headless-cms-common/types").CmsIconsPlugin | import("@webiny/app-admin/types").AdminInstallationPlugin | import("@webiny/app-admin/types").AdminAppPermissionRendererPlugin | import("@webiny/app/types").RoutePlugin[] | import("@webiny/app-headless-cms-common/types").CmsFieldValueTransformer<{
|
|
3
3
|
id: string;
|
|
4
4
|
type: string;
|
|
5
5
|
fieldId: string;
|
|
@@ -16,9 +16,9 @@ declare const _default: (import("@webiny/app-headless-cms-common/types").CmsMode
|
|
|
16
16
|
name: string;
|
|
17
17
|
} | ((props: import("@webiny/app-headless-cms-common/types").CmsModelFieldRendererProps) => import("react").ReactNode);
|
|
18
18
|
tags?: string[] | undefined;
|
|
19
|
-
}>[] | import("@webiny/app
|
|
19
|
+
}>[] | import("@webiny/app").ApolloCacheObjectIdPlugin<import("@webiny/app/plugins/ApolloCacheObjectIdPlugin").ApolloCacheObject> | {
|
|
20
20
|
name: string;
|
|
21
21
|
type: string;
|
|
22
22
|
render(): JSX.Element;
|
|
23
|
-
}[])[] | import("@webiny/app-
|
|
23
|
+
}[])[] | import("@webiny/app-plugin-admin-welcome-screen/types").AdminWelcomeScreenWidgetPlugin)[];
|
|
24
24
|
export default _default;
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const Components: {
|
|
2
|
+
FieldRenderers: {
|
|
3
|
+
DynamicZone: {
|
|
4
|
+
Container: import("@webiny/react-composition").ComposableFC<import("~/admin/plugins/fieldRenderers/dynamicZone").DynamicZoneContainerProps>;
|
|
5
|
+
MultiValue: {
|
|
6
|
+
Container: import("@webiny/react-composition").ComposableFC<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueContainerProps>;
|
|
7
|
+
ItemContainer: import("@webiny/react-composition").ComposableFC<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemContainerProps>;
|
|
8
|
+
Item: import("@webiny/react-composition").ComposableFC<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemItemProps>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
package/components.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Components = void 0;
|
|
7
|
+
var _dynamicZone = require("./admin/plugins/fieldRenderers/dynamicZone");
|
|
8
|
+
var Components = {
|
|
9
|
+
FieldRenderers: {
|
|
10
|
+
DynamicZone: {
|
|
11
|
+
Container: _dynamicZone.DynamicZoneContainer,
|
|
12
|
+
// SingleValue: {
|
|
13
|
+
// Container: null,
|
|
14
|
+
// ItemContainer: null,
|
|
15
|
+
// Item: null
|
|
16
|
+
// },
|
|
17
|
+
MultiValue: {
|
|
18
|
+
Container: _dynamicZone.MultiValueContainer,
|
|
19
|
+
ItemContainer: _dynamicZone.MultiValueItemContainer,
|
|
20
|
+
Item: _dynamicZone.MultiValueItem
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.Components = Components;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dynamicZone","require","Components","FieldRenderers","DynamicZone","Container","DynamicZoneContainer","MultiValue","MultiValueContainer","ItemContainer","MultiValueItemContainer","Item","MultiValueItem","exports"],"sources":["components.ts"],"sourcesContent":["import {\n DynamicZoneContainer,\n MultiValueContainer,\n MultiValueItemContainer,\n MultiValueItem\n} from \"~/admin/plugins/fieldRenderers/dynamicZone\";\n\nexport const Components = {\n FieldRenderers: {\n DynamicZone: {\n Container: DynamicZoneContainer,\n // SingleValue: {\n // Container: null,\n // ItemContainer: null,\n // Item: null\n // },\n MultiValue: {\n Container: MultiValueContainer,\n ItemContainer: MultiValueItemContainer,\n Item: MultiValueItem\n }\n }\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOO,IAAMC,UAAU,GAAG;EACtBC,cAAc,EAAE;IACZC,WAAW,EAAE;MACTC,SAAS,EAAEC,iCAAoB;MAC/B;MACA;MACA;MACA;MACA;MACAC,UAAU,EAAE;QACRF,SAAS,EAAEG,gCAAmB;QAC9BC,aAAa,EAAEC,oCAAuB;QACtCC,IAAI,EAAEC;MACV;IACJ;EACJ;AACJ,CAAC;AAACC,OAAA,CAAAX,UAAA,GAAAA,UAAA"}
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { ContentEntryEditorConfig, ContentEntryListConfig } from "./admin/config/contentEntries";
|
|
2
3
|
export * from "./HeadlessCMS";
|
|
3
4
|
export * from "./admin/hooks";
|
|
4
5
|
export { LexicalEditorConfig } from "./admin/lexicalConfig/LexicalEditorConfig";
|
|
5
6
|
export { RenderFieldElement } from "./admin/components/ContentEntryForm/RenderFieldElement";
|
|
6
7
|
export { ModelProvider } from "./admin/components/ModelProvider";
|
|
7
|
-
import { ContentEntryEditorConfig, ContentEntryListConfig } from "./admin/config/contentEntries";
|
|
8
8
|
export { ContentEntryEditorConfig, ContentEntryListConfig };
|
|
9
9
|
/**
|
|
10
10
|
* @deprecated Use ContentEntryListConfig instead
|
|
@@ -15,3 +15,4 @@ export declare const ContentEntriesViewConfig: React.FC<{}> & {
|
|
|
15
15
|
};
|
|
16
16
|
Sorter: (props: any) => null;
|
|
17
17
|
};
|
|
18
|
+
export * from "./components";
|
package/index.js
CHANGED
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
var _exportNames = {
|
|
8
8
|
ContentEntriesViewConfig: true,
|
|
9
|
+
ContentEntryEditorConfig: true,
|
|
10
|
+
ContentEntryListConfig: true,
|
|
9
11
|
LexicalEditorConfig: true,
|
|
10
12
|
RenderFieldElement: true,
|
|
11
|
-
ModelProvider: true
|
|
12
|
-
ContentEntryEditorConfig: true,
|
|
13
|
-
ContentEntryListConfig: true
|
|
13
|
+
ModelProvider: true
|
|
14
14
|
};
|
|
15
15
|
exports.ContentEntriesViewConfig = void 0;
|
|
16
16
|
Object.defineProperty(exports, "ContentEntryEditorConfig", {
|
|
@@ -44,6 +44,7 @@ Object.defineProperty(exports, "RenderFieldElement", {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
var _react = _interopRequireDefault(require("react"));
|
|
47
|
+
var _contentEntries = require("./admin/config/contentEntries");
|
|
47
48
|
var _HeadlessCMS = require("./HeadlessCMS");
|
|
48
49
|
Object.keys(_HeadlessCMS).forEach(function (key) {
|
|
49
50
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -71,7 +72,18 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
71
72
|
var _LexicalEditorConfig = require("./admin/lexicalConfig/LexicalEditorConfig");
|
|
72
73
|
var _RenderFieldElement = require("./admin/components/ContentEntryForm/RenderFieldElement");
|
|
73
74
|
var _ModelProvider = require("./admin/components/ModelProvider");
|
|
74
|
-
var
|
|
75
|
+
var _components = require("./components");
|
|
76
|
+
Object.keys(_components).forEach(function (key) {
|
|
77
|
+
if (key === "default" || key === "__esModule") return;
|
|
78
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
79
|
+
if (key in exports && exports[key] === _components[key]) return;
|
|
80
|
+
Object.defineProperty(exports, key, {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function get() {
|
|
83
|
+
return _components[key];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
75
87
|
/**
|
|
76
88
|
* DANGER!
|
|
77
89
|
* The following components are created to support the old experimental API:
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_HeadlessCMS","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_hooks","_LexicalEditorConfig","_RenderFieldElement","_ModelProvider","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_contentEntries","_HeadlessCMS","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_hooks","_LexicalEditorConfig","_RenderFieldElement","_ModelProvider","_components","LegacyContentEntriesViewConfig","_ref","children","default","createElement","ContentEntryListConfig","LegacySorter","props","ContentEntriesViewConfig","assign","Filter","Browser","Sorter"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport { ContentEntryEditorConfig, ContentEntryListConfig } from \"./admin/config/contentEntries\";\n\nexport * from \"./HeadlessCMS\";\nexport * from \"./admin/hooks\";\nexport { LexicalEditorConfig } from \"~/admin/lexicalConfig/LexicalEditorConfig\";\nexport { RenderFieldElement } from \"~/admin/components/ContentEntryForm/RenderFieldElement\";\nexport { ModelProvider } from \"~/admin/components/ModelProvider\";\nexport { ContentEntryEditorConfig, ContentEntryListConfig };\n\n/**\n * DANGER!\n * The following components are created to support the old experimental API:\n * - `Filter` has been mapped to the new `ContentEntryListConfig.Browser`namespace;\n * - `Sorter` has been deprecated.\n *\n * Check out 5.37.0 changelog and discover the new `ContentEntryListConfig` API.\n */\nconst LegacyContentEntriesViewConfig: React.FC = ({ children }) => {\n return <ContentEntryListConfig>{children}</ContentEntryListConfig>;\n};\n\n// eslint-disable-next-line\nconst LegacySorter = (props: any) => null;\n\n/**\n * @deprecated Use ContentEntryListConfig instead\n */\nexport const ContentEntriesViewConfig = Object.assign(LegacyContentEntriesViewConfig, {\n Filter: ContentEntryListConfig.Browser.Filter,\n Sorter: LegacySorter\n});\n\nexport * from \"./components\";\n"],"mappings":";;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AAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAa,WAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAK,WAAA,CAAAb,GAAA;IAAA;EAAA;AAAA;AAvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMc,8BAAwC,GAAG,SAA3CA,8BAAwCA,CAAAC,IAAA,EAAqB;EAAA,IAAfC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACxD,oBAAOxB,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACvB,eAAA,CAAAwB,sBAAsB,QAAEH,QAAiC,CAAC;AACtE,CAAC;;AAED;AACA,IAAMI,YAAY,GAAG,SAAfA,YAAYA,CAAIC,KAAU;EAAA,OAAK,IAAI;AAAA;;AAEzC;AACA;AACA;AACO,IAAMC,wBAAwB,GAAGzB,MAAM,CAAC0B,MAAM,CAACT,8BAA8B,EAAE;EAClFU,MAAM,EAAEL,sCAAsB,CAACM,OAAO,CAACD,MAAM;EAC7CE,MAAM,EAAEN;AACZ,CAAC,CAAC;AAACf,OAAA,CAAAiB,wBAAA,GAAAA,wBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-headless-cms",
|
|
3
|
-
"version": "5.38.
|
|
3
|
+
"version": "5.38.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,28 +28,28 @@
|
|
|
28
28
|
"@material-design-icons/svg": "0.14.2",
|
|
29
29
|
"@svgr/webpack": "6.5.1",
|
|
30
30
|
"@types/react": "17.0.39",
|
|
31
|
-
"@webiny/app": "5.38.
|
|
32
|
-
"@webiny/app-aco": "5.38.
|
|
33
|
-
"@webiny/app-admin": "5.38.
|
|
34
|
-
"@webiny/app-graphql-playground": "5.38.
|
|
35
|
-
"@webiny/app-headless-cms-common": "5.38.
|
|
36
|
-
"@webiny/app-i18n": "5.38.
|
|
37
|
-
"@webiny/app-plugin-admin-welcome-screen": "5.38.
|
|
38
|
-
"@webiny/app-security": "5.38.
|
|
39
|
-
"@webiny/error": "5.38.
|
|
40
|
-
"@webiny/feature-flags": "5.38.
|
|
41
|
-
"@webiny/form": "5.38.
|
|
42
|
-
"@webiny/lexical-editor": "5.38.
|
|
43
|
-
"@webiny/lexical-nodes": "5.38.
|
|
44
|
-
"@webiny/lexical-theme": "5.38.
|
|
45
|
-
"@webiny/plugins": "5.38.
|
|
46
|
-
"@webiny/react-composition": "5.38.
|
|
47
|
-
"@webiny/react-properties": "5.38.
|
|
48
|
-
"@webiny/react-router": "5.38.
|
|
49
|
-
"@webiny/theme": "5.38.
|
|
50
|
-
"@webiny/ui": "5.38.
|
|
51
|
-
"@webiny/utils": "5.38.
|
|
52
|
-
"@webiny/validation": "5.38.
|
|
31
|
+
"@webiny/app": "5.38.6",
|
|
32
|
+
"@webiny/app-aco": "5.38.6",
|
|
33
|
+
"@webiny/app-admin": "5.38.6",
|
|
34
|
+
"@webiny/app-graphql-playground": "5.38.6",
|
|
35
|
+
"@webiny/app-headless-cms-common": "5.38.6",
|
|
36
|
+
"@webiny/app-i18n": "5.38.6",
|
|
37
|
+
"@webiny/app-plugin-admin-welcome-screen": "5.38.6",
|
|
38
|
+
"@webiny/app-security": "5.38.6",
|
|
39
|
+
"@webiny/error": "5.38.6",
|
|
40
|
+
"@webiny/feature-flags": "5.38.6",
|
|
41
|
+
"@webiny/form": "5.38.6",
|
|
42
|
+
"@webiny/lexical-editor": "5.38.6",
|
|
43
|
+
"@webiny/lexical-nodes": "5.38.6",
|
|
44
|
+
"@webiny/lexical-theme": "5.38.6",
|
|
45
|
+
"@webiny/plugins": "5.38.6",
|
|
46
|
+
"@webiny/react-composition": "5.38.6",
|
|
47
|
+
"@webiny/react-properties": "5.38.6",
|
|
48
|
+
"@webiny/react-router": "5.38.6",
|
|
49
|
+
"@webiny/theme": "5.38.6",
|
|
50
|
+
"@webiny/ui": "5.38.6",
|
|
51
|
+
"@webiny/utils": "5.38.6",
|
|
52
|
+
"@webiny/validation": "5.38.6",
|
|
53
53
|
"apollo-cache": "1.3.5",
|
|
54
54
|
"apollo-client": "2.6.10",
|
|
55
55
|
"apollo-link": "1.2.14",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"@babel/preset-env": "7.22.7",
|
|
81
81
|
"@babel/preset-react": "7.22.5",
|
|
82
82
|
"@babel/preset-typescript": "7.22.5",
|
|
83
|
-
"@webiny/cli": "5.38.
|
|
84
|
-
"@webiny/project-utils": "5.38.
|
|
83
|
+
"@webiny/cli": "5.38.6",
|
|
84
|
+
"@webiny/project-utils": "5.38.6",
|
|
85
85
|
"babel-plugin-emotion": "9.2.11",
|
|
86
86
|
"babel-plugin-module-resolver": "4.1.0",
|
|
87
87
|
"rimraf": "3.0.2",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
]
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "65d8c4beef7ebcd3115c97eb1e23d93e8e357d55"
|
|
115
115
|
}
|