@webiny/app-headless-cms 5.39.3 → 5.40.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/components/ContentEntries/Table/Cells/Cells.styled.d.ts +2 -0
- package/admin/components/ContentEntryForm/ContentEntryForm.js +2 -2
- package/admin/components/ContentEntryForm/ContentEntryForm.js.map +1 -1
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js +7 -4
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js.map +1 -1
- package/admin/components/ContentEntryForm/FieldElement.d.ts +26 -0
- package/admin/components/ContentEntryForm/{RenderFieldElement.js → FieldElement.js} +13 -3
- package/admin/components/ContentEntryForm/FieldElement.js.map +1 -0
- package/admin/components/ContentEntryForm/Fields.js +2 -2
- package/admin/components/ContentEntryForm/Fields.js.map +1 -1
- package/admin/components/ContentEntryForm/Header/RevisionSelector/RevisionSelector.styles.d.ts +1 -1
- package/admin/components/ContentEntryForm/Header/SaveAndPublishContent/SaveAndPublishContent.d.ts +6 -1
- package/admin/components/ContentEntryForm/ParentValue.d.ts +25 -0
- package/admin/components/ContentEntryForm/ParentValue.js +67 -0
- package/admin/components/ContentEntryForm/ParentValue.js.map +1 -0
- package/admin/components/ContentEntryForm/useBind.d.ts +1 -1
- package/admin/components/ContentEntryForm/useBind.js +6 -8
- package/admin/components/ContentEntryForm/useBind.js.map +1 -1
- package/admin/components/ContentModelEditor/Editor.js +3 -2
- package/admin/components/ContentModelEditor/Editor.js.map +1 -1
- package/admin/config/contentEntries/editor/ContentEntryEditorConfig.d.ts +6 -3
- package/admin/config/contentEntries/editor/ContentEntryEditorConfig.js +3 -1
- package/admin/config/contentEntries/editor/ContentEntryEditorConfig.js.map +1 -1
- package/admin/config/contentEntries/editor/FieldElement.d.ts +6 -0
- package/admin/config/contentEntries/editor/FieldElement.js +23 -0
- package/admin/config/contentEntries/editor/FieldElement.js.map +1 -0
- package/admin/config/contentEntries/list/Browser/Filter.d.ts +5 -3
- package/admin/config/contentEntries/list/Browser/index.d.ts +5 -3
- package/admin/config/contentEntries/list/ContentEntryListConfig.d.ts +6 -6
- package/admin/hooks/index.d.ts +1 -0
- package/admin/hooks/index.js +15 -0
- package/admin/hooks/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/DynamicSection.js +25 -17
- package/admin/plugins/fieldRenderers/DynamicSection.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.d.ts +18 -3
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js +18 -7
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js +10 -3
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.d.ts +70 -4
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js +45 -18
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateItem.d.ts +12 -0
- package/admin/plugins/fieldRenderers/dynamicZone/{TemplateCard.js → TemplateItem.js} +12 -11
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateItem.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateProvider.d.ts +11 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateProvider.js +28 -0
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateProvider.js.map +1 -0
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.d.ts +6 -1
- package/admin/plugins/fieldRenderers/dynamicZone/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/dynamicZone/index.js +27 -0
- package/admin/plugins/fieldRenderers/dynamicZone/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +3 -4
- package/admin/plugins/fieldRenderers/object/multipleObjects.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.js +6 -3
- package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/singleObjectAccordion.js +16 -10
- package/admin/plugins/fieldRenderers/object/singleObjectAccordion.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/singleObjectInline.js +19 -13
- package/admin/plugins/fieldRenderers/object/singleObjectInline.js.map +1 -1
- package/admin/plugins/fields/dynamicZone/TemplateDialog.js +8 -0
- package/admin/plugins/fields/dynamicZone/TemplateDialog.js.map +1 -1
- package/admin/plugins/index.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/PublishEntryRevisionListItem.d.ts +6 -1
- package/admin/views/contentModels/OptionsMenu.d.ts +6 -1
- package/allPlugins.d.ts +3 -3
- package/components.d.ts +79 -4
- package/components.js +5 -1
- package/components.js.map +1 -1
- package/index.d.ts +198 -8
- package/index.js +16 -21
- package/index.js.map +1 -1
- package/package.json +26 -26
- package/admin/components/ContentEntryForm/RenderFieldElement.d.ts +0 -7
- package/admin/components/ContentEntryForm/RenderFieldElement.js.map +0 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.d.ts +0 -8
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.js.map +0 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const ContentEntryEditorConfig: (({ children }: {
|
|
3
|
-
children: import("react").ReactNode;
|
|
4
|
-
}) => JSX.Element) & {
|
|
2
|
+
export declare const ContentEntryEditorConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => JSX.Element) & {
|
|
5
3
|
Actions: {
|
|
6
4
|
ButtonAction: ((props: import("./Actions/ButtonAction").ButtonActionProps) => JSX.Element) & {
|
|
7
5
|
useButtons: () => import("@webiny/app-admin/components/Buttons/useButtons").ButtonsProviderContext;
|
|
@@ -10,6 +8,11 @@ export declare const ContentEntryEditorConfig: (({ children }: {
|
|
|
10
8
|
useOptionsMenuItem: () => import("@webiny/app-admin/components/OptionsMenu/useOptionsMenuItem").OptionsMenuItemProviderContext;
|
|
11
9
|
};
|
|
12
10
|
};
|
|
11
|
+
FieldElement: {
|
|
12
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("../../../..").FieldElementProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: {
|
|
13
|
+
modelIds?: string[] | undefined;
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
};
|
|
13
16
|
};
|
|
14
17
|
export declare const ContentEntryEditorWithConfig: ({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => JSX.Element;
|
|
15
18
|
export declare function useContentEntryEditorConfig(): {
|
|
@@ -10,9 +10,11 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _reactProperties = require("@webiny/react-properties");
|
|
12
12
|
var _Actions = require("./Actions");
|
|
13
|
+
var _FieldElement = require("./FieldElement");
|
|
13
14
|
var base = (0, _reactProperties.createConfigurableComponent)("ContentEntryEditorConfig");
|
|
14
15
|
var ContentEntryEditorConfig = Object.assign(base.Config, {
|
|
15
|
-
Actions: _Actions.Actions
|
|
16
|
+
Actions: _Actions.Actions,
|
|
17
|
+
FieldElement: _FieldElement.FieldElement
|
|
16
18
|
});
|
|
17
19
|
exports.ContentEntryEditorConfig = ContentEntryEditorConfig;
|
|
18
20
|
var ContentEntryEditorWithConfig = base.WithConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactProperties","_Actions","base","createConfigurableComponent","ContentEntryEditorConfig","Object","assign","Config","Actions","exports","ContentEntryEditorWithConfig","WithConfig","useContentEntryEditorConfig","config","useConfig","actions","useMemo","buttonActions","_toConsumableArray2","default","filter","action","$type","menuItemActions"],"sources":["ContentEntryEditorConfig.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { createConfigurableComponent } from \"@webiny/react-properties\";\nimport { Actions, ActionsConfig } from \"./Actions\";\n\nconst base = createConfigurableComponent<ContentEntryEditorConfig>(\"ContentEntryEditorConfig\");\n\nexport const ContentEntryEditorConfig = Object.assign(base.Config, { Actions });\n\nexport const ContentEntryEditorWithConfig = base.WithConfig;\n\ninterface ContentEntryEditorConfig {\n actions: ActionsConfig;\n}\n\nexport function useContentEntryEditorConfig() {\n const config = base.useConfig();\n\n const actions = config.actions || [];\n\n return useMemo(\n () => ({\n buttonActions: [...(actions.filter(action => action.$type === \"button-action\") || [])],\n menuItemActions: [\n ...(actions.filter(action => action.$type === \"menu-item-action\") || [])\n ]\n }),\n [config]\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEA,
|
|
1
|
+
{"version":3,"names":["_react","require","_reactProperties","_Actions","_FieldElement","base","createConfigurableComponent","ContentEntryEditorConfig","Object","assign","Config","Actions","FieldElement","exports","ContentEntryEditorWithConfig","WithConfig","useContentEntryEditorConfig","config","useConfig","actions","useMemo","buttonActions","_toConsumableArray2","default","filter","action","$type","menuItemActions"],"sources":["ContentEntryEditorConfig.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { createConfigurableComponent } from \"@webiny/react-properties\";\nimport { Actions, ActionsConfig } from \"./Actions\";\nimport { FieldElement } from \"./FieldElement\";\n\nconst base = createConfigurableComponent<ContentEntryEditorConfig>(\"ContentEntryEditorConfig\");\n\nexport const ContentEntryEditorConfig = Object.assign(base.Config, { Actions, FieldElement });\n\nexport const ContentEntryEditorWithConfig = base.WithConfig;\n\ninterface ContentEntryEditorConfig {\n actions: ActionsConfig;\n}\n\nexport function useContentEntryEditorConfig() {\n const config = base.useConfig();\n\n const actions = config.actions || [];\n\n return useMemo(\n () => ({\n buttonActions: [...(actions.filter(action => action.$type === \"button-action\") || [])],\n menuItemActions: [\n ...(actions.filter(action => action.$type === \"menu-item-action\") || [])\n ]\n }),\n [config]\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAEA,IAAMI,IAAI,GAAG,IAAAC,4CAA2B,EAA2B,0BAA0B,CAAC;AAEvF,IAAMC,wBAAwB,GAAGC,MAAM,CAACC,MAAM,CAACJ,IAAI,CAACK,MAAM,EAAE;EAAEC,OAAO,EAAPA,gBAAO;EAAEC,YAAY,EAAZA;AAAa,CAAC,CAAC;AAACC,OAAA,CAAAN,wBAAA,GAAAA,wBAAA;AAEvF,IAAMO,4BAA4B,GAAGT,IAAI,CAACU,UAAU;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA;AAMrD,SAASE,2BAA2BA,CAAA,EAAG;EAC1C,IAAMC,MAAM,GAAGZ,IAAI,CAACa,SAAS,CAAC,CAAC;EAE/B,IAAMC,OAAO,GAAGF,MAAM,CAACE,OAAO,IAAI,EAAE;EAEpC,OAAO,IAAAC,cAAO,EACV;IAAA,OAAO;MACHC,aAAa,MAAAC,mBAAA,CAAAC,OAAA,EAAOJ,OAAO,CAACK,MAAM,CAAC,UAAAC,MAAM;QAAA,OAAIA,MAAM,CAACC,KAAK,KAAK,eAAe;MAAA,EAAC,IAAI,EAAE,CAAE;MACtFC,eAAe,MAAAL,mBAAA,CAAAC,OAAA,EACPJ,OAAO,CAACK,MAAM,CAAC,UAAAC,MAAM;QAAA,OAAIA,MAAM,CAACC,KAAK,KAAK,kBAAkB;MAAA,EAAC,IAAI,EAAE;IAE/E,CAAC;EAAA,CAAC,EACF,CAACT,MAAM,CACX,CAAC;AACL"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const FieldElement: {
|
|
3
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("../../../components/ContentEntryForm/FieldElement").FieldElementProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: {
|
|
4
|
+
modelIds?: string[] | undefined;
|
|
5
|
+
}) => JSX.Element;
|
|
6
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FieldElement = void 0;
|
|
7
|
+
var _reactComposition = require("@webiny/react-composition");
|
|
8
|
+
var _FieldElement = require("../../../components/ContentEntryForm/FieldElement");
|
|
9
|
+
var _ModelProvider = require("../../../components/ModelProvider");
|
|
10
|
+
var createDecorator = (0, _reactComposition.createDecoratorFactory)()(_FieldElement.FieldElement, function (decoratorProps) {
|
|
11
|
+
var _useModel = (0, _ModelProvider.useModel)(),
|
|
12
|
+
model = _useModel.model;
|
|
13
|
+
if (decoratorProps?.modelIds?.length && !decoratorProps.modelIds.includes(model.modelId)) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
});
|
|
18
|
+
var FieldElement = {
|
|
19
|
+
createDecorator: createDecorator
|
|
20
|
+
};
|
|
21
|
+
exports.FieldElement = FieldElement;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=FieldElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactComposition","require","_FieldElement","_ModelProvider","createDecorator","createDecoratorFactory","FieldElementComponent","decoratorProps","_useModel","useModel","model","modelIds","length","includes","modelId","FieldElement","exports"],"sources":["FieldElement.tsx"],"sourcesContent":["import { createDecoratorFactory } from \"@webiny/react-composition\";\nimport { FieldElement as FieldElementComponent } from \"~/admin/components/ContentEntryForm/FieldElement\";\nimport { useModel } from \"~/admin/components/ModelProvider\";\n\nconst createDecorator = createDecoratorFactory<{ modelIds?: string[] }>()(\n FieldElementComponent,\n decoratorProps => {\n const { model } = useModel();\n\n if (decoratorProps?.modelIds?.length && !decoratorProps.modelIds.includes(model.modelId)) {\n return false;\n }\n\n return true;\n }\n);\n\nexport const FieldElement = {\n createDecorator\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA,IAAMG,eAAe,GAAG,IAAAC,wCAAsB,EAA0B,CAAC,CACrEC,0BAAqB,EACrB,UAAAC,cAAc,EAAI;EACd,IAAAC,SAAA,GAAkB,IAAAC,uBAAQ,EAAC,CAAC;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK;EAEb,IAAIH,cAAc,EAAEI,QAAQ,EAAEC,MAAM,IAAI,CAACL,cAAc,CAACI,QAAQ,CAACE,QAAQ,CAACH,KAAK,CAACI,OAAO,CAAC,EAAE;IACtF,OAAO,KAAK;EAChB;EAEA,OAAO,IAAI;AACf,CACJ,CAAC;AAEM,IAAMC,YAAY,GAAG;EACxBX,eAAe,EAAfA;AACJ,CAAC;AAACY,OAAA,CAAAD,YAAA,GAAAA,YAAA"}
|
|
@@ -15,9 +15,11 @@ export interface CreateDecoratorParams {
|
|
|
15
15
|
name: string;
|
|
16
16
|
modelIds?: string[];
|
|
17
17
|
}
|
|
18
|
-
export declare const Filter: (
|
|
19
|
-
original: (
|
|
18
|
+
export declare const Filter: import("@webiny/react-composition").GenericComponent<FilterProps> & {
|
|
19
|
+
original: import("@webiny/react-composition").GenericComponent<FilterProps>;
|
|
20
20
|
originalName: string;
|
|
21
21
|
} & {
|
|
22
|
-
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(args_0: FilterProps) => JSX.Element | null>) => (props:
|
|
22
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(args_0: FilterProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
23
|
+
} & {
|
|
24
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: React.PropsWithChildren<FilterProps>, context?: any) => React.ReactElement<any, any> | null>) => (props: CreateDecoratorParams) => JSX.Element;
|
|
23
25
|
};
|
|
@@ -29,11 +29,13 @@ export declare const Browser: {
|
|
|
29
29
|
OptionsMenuItem: (props: import("@webiny/app-admin").OptionsMenuItemProps) => JSX.Element;
|
|
30
30
|
OptionsMenuLink: (props: import("@webiny/app-admin").OptionsMenuLinkProps) => JSX.Element;
|
|
31
31
|
};
|
|
32
|
-
Filter: (
|
|
33
|
-
original: (
|
|
32
|
+
Filter: import("@webiny/react-composition").GenericComponent<import("./Filter").FilterProps> & {
|
|
33
|
+
original: import("@webiny/react-composition").GenericComponent<import("./Filter").FilterProps>;
|
|
34
34
|
originalName: string;
|
|
35
35
|
} & {
|
|
36
|
-
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(args_0: import("./Filter").FilterProps) => JSX.Element | null>) => (props:
|
|
36
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(args_0: import("./Filter").FilterProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
37
|
+
} & {
|
|
38
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("./Filter").FilterProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: import("./Filter").CreateDecoratorParams) => JSX.Element;
|
|
37
39
|
};
|
|
38
40
|
FiltersToWhere: ({ converter, modelIds }: import("./FiltersToWhere").FiltersToWhereProps) => JSX.Element | null;
|
|
39
41
|
FolderAction: (({ modelIds, ...props }: import("./FolderAction").FolderActionProps) => JSX.Element | null) & {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const ContentEntryListConfig: (({ children }: {
|
|
3
|
-
children: import("react").ReactNode;
|
|
4
|
-
}) => JSX.Element) & {
|
|
2
|
+
export declare const ContentEntryListConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => JSX.Element) & {
|
|
5
3
|
Browser: {
|
|
6
4
|
BulkAction: (({ name, after, before, remove, modelIds, element }: import("./Browser/BulkAction").BulkActionProps) => JSX.Element | null) & {
|
|
7
5
|
useButtons: () => import("@webiny/app-admin/components/Buttons/useButtons").ButtonsProviderContext;
|
|
@@ -18,11 +16,13 @@ export declare const ContentEntryListConfig: (({ children }: {
|
|
|
18
16
|
OptionsMenuItem: (props: import("@webiny/app-admin").OptionsMenuItemProps) => JSX.Element;
|
|
19
17
|
OptionsMenuLink: (props: import("@webiny/app-admin").OptionsMenuLinkProps) => JSX.Element;
|
|
20
18
|
};
|
|
21
|
-
Filter: (
|
|
22
|
-
original: (
|
|
19
|
+
Filter: import("@webiny/react-composition").GenericComponent<import("./Browser/Filter").FilterProps> & {
|
|
20
|
+
original: import("@webiny/react-composition").GenericComponent<import("./Browser/Filter").FilterProps>;
|
|
23
21
|
originalName: string;
|
|
24
22
|
} & {
|
|
25
|
-
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(args_0: import("./Browser/Filter").FilterProps) => JSX.Element | null>) => (props:
|
|
23
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(args_0: import("./Browser/Filter").FilterProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
24
|
+
} & {
|
|
25
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("./Browser/Filter").FilterProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: import("./Browser/Filter").CreateDecoratorParams) => JSX.Element;
|
|
26
26
|
};
|
|
27
27
|
FiltersToWhere: ({ converter, modelIds }: import("./Browser/FiltersToWhere").FiltersToWhereProps) => JSX.Element | null;
|
|
28
28
|
FolderAction: (({ modelIds, ...props }: import("./Browser/FolderAction").FolderActionProps) => JSX.Element | null) & {
|
package/admin/hooks/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { default as useApolloClient } from "./useApolloClient";
|
|
|
7
7
|
export { default as usePermission } from "./usePermission";
|
|
8
8
|
export { useModel } from "../components/ModelProvider";
|
|
9
9
|
export { useModelEditor } from "../components/ContentModelEditor";
|
|
10
|
+
export { useParentField, ParentFieldProvider } from "../components/ContentEntryForm/ParentValue";
|
|
10
11
|
export { useModelField } from "../components/ModelFieldProvider";
|
|
11
12
|
export { useModelFieldEditor } from "../components/FieldEditor";
|
|
12
13
|
export { useChangeEntryStatus } from "./useChangeEntryStatus";
|
package/admin/hooks/index.js
CHANGED
|
@@ -13,12 +13,20 @@ var _exportNames = {
|
|
|
13
13
|
usePermission: true,
|
|
14
14
|
useModel: true,
|
|
15
15
|
useModelEditor: true,
|
|
16
|
+
useParentField: true,
|
|
17
|
+
ParentFieldProvider: true,
|
|
16
18
|
useModelField: true,
|
|
17
19
|
useModelFieldEditor: true,
|
|
18
20
|
useChangeEntryStatus: true,
|
|
19
21
|
useDeleteEntry: true,
|
|
20
22
|
useEntry: true
|
|
21
23
|
};
|
|
24
|
+
Object.defineProperty(exports, "ParentFieldProvider", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _ParentValue.ParentFieldProvider;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
22
30
|
Object.defineProperty(exports, "useApolloClient", {
|
|
23
31
|
enumerable: true,
|
|
24
32
|
get: function get() {
|
|
@@ -85,6 +93,12 @@ Object.defineProperty(exports, "useMutation", {
|
|
|
85
93
|
return _useMutation.default;
|
|
86
94
|
}
|
|
87
95
|
});
|
|
96
|
+
Object.defineProperty(exports, "useParentField", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
return _ParentValue.useParentField;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
88
102
|
Object.defineProperty(exports, "usePermission", {
|
|
89
103
|
enumerable: true,
|
|
90
104
|
get: function get() {
|
|
@@ -117,6 +131,7 @@ var _useApolloClient = _interopRequireDefault(require("./useApolloClient"));
|
|
|
117
131
|
var _usePermission = _interopRequireDefault(require("./usePermission"));
|
|
118
132
|
var _ModelProvider = require("../components/ModelProvider");
|
|
119
133
|
var _ContentModelEditor = require("../components/ContentModelEditor");
|
|
134
|
+
var _ParentValue = require("../components/ContentEntryForm/ParentValue");
|
|
120
135
|
var _ModelFieldProvider = require("../components/ModelFieldProvider");
|
|
121
136
|
var _FieldEditor = require("../components/FieldEditor");
|
|
122
137
|
var _useChangeEntryStatus = require("./useChangeEntryStatus");
|
package/admin/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useCms","_interopRequireDefault","require","_useQuery","_useQueryLocale","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_useLazyQuery","_useMutation","_useApolloClient","_usePermission","_ModelProvider","_ContentModelEditor","_ModelFieldProvider","_FieldEditor","_useChangeEntryStatus","_useDeleteEntry","_useEntry","_useContentModels","_hooks","_useModelFieldGraphqlContext"],"sources":["index.ts"],"sourcesContent":["export { default as useCms } from \"./useCms\";\nexport { default as useQuery } from \"./useQuery\";\nexport * from \"./useQueryLocale\";\nexport { default as useLazyQuery } from \"./useLazyQuery\";\nexport { default as useMutation } from \"./useMutation\";\nexport { default as useApolloClient } from \"./useApolloClient\";\nexport { default as usePermission } from \"./usePermission\";\nexport { useModel } from \"../components/ModelProvider\";\nexport { useModelEditor } from \"../components/ContentModelEditor\";\nexport { useModelField } from \"../components/ModelFieldProvider\";\nexport { useModelFieldEditor } from \"../components/FieldEditor\";\nexport { useChangeEntryStatus } from \"~/admin/hooks/useChangeEntryStatus\";\nexport { useDeleteEntry } from \"~/admin/hooks/useDeleteEntry\";\nexport { useEntry } from \"~/admin/hooks/useEntry\";\nexport * from \"./useContentModels\";\nexport * from \"~/admin/views/contentEntries/hooks\";\nexport * from \"./useModelFieldGraphqlContext\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_useCms","_interopRequireDefault","require","_useQuery","_useQueryLocale","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_useLazyQuery","_useMutation","_useApolloClient","_usePermission","_ModelProvider","_ContentModelEditor","_ParentValue","_ModelFieldProvider","_FieldEditor","_useChangeEntryStatus","_useDeleteEntry","_useEntry","_useContentModels","_hooks","_useModelFieldGraphqlContext"],"sources":["index.ts"],"sourcesContent":["export { default as useCms } from \"./useCms\";\nexport { default as useQuery } from \"./useQuery\";\nexport * from \"./useQueryLocale\";\nexport { default as useLazyQuery } from \"./useLazyQuery\";\nexport { default as useMutation } from \"./useMutation\";\nexport { default as useApolloClient } from \"./useApolloClient\";\nexport { default as usePermission } from \"./usePermission\";\nexport { useModel } from \"../components/ModelProvider\";\nexport { useModelEditor } from \"../components/ContentModelEditor\";\nexport { useParentField, ParentFieldProvider } from \"../components/ContentEntryForm/ParentValue\";\nexport { useModelField } from \"../components/ModelFieldProvider\";\nexport { useModelFieldEditor } from \"../components/FieldEditor\";\nexport { useChangeEntryStatus } from \"~/admin/hooks/useChangeEntryStatus\";\nexport { useDeleteEntry } from \"~/admin/hooks/useDeleteEntry\";\nexport { useEntry } from \"~/admin/hooks/useEntry\";\nexport * from \"./useContentModels\";\nexport * from \"~/admin/views/contentEntries/hooks\";\nexport * from \"./useModelFieldGraphqlContext\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,eAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAA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A;AACA,IAAAsB,MAAA,GAAA5B,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAwB,MAAA,EAAAvB,OAAA,WAAAC,GAAA;EAAA,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,MAAAsB,MAAA,CAAAtB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAc,MAAA,CAAAtB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAuB,4BAAA,GAAA7B,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAyB,4BAAA,EAAAxB,OAAA,WAAAC,GAAA;EAAA,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,MAAAuB,4BAAA,CAAAvB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAe,4BAAA,CAAAvB,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -13,6 +13,7 @@ var _Grid = require("@webiny/ui/Grid");
|
|
|
13
13
|
var _Button = require("@webiny/ui/Button");
|
|
14
14
|
var _FormElementMessage = require("@webiny/ui/FormElementMessage");
|
|
15
15
|
var _add18px = require("@webiny/app-admin/assets/icons/add-18px.svg");
|
|
16
|
+
var _hooks = require("../../hooks");
|
|
16
17
|
var _templateObject;
|
|
17
18
|
var t = _i18n.i18n.ns("app-headless-cms/admin/fields/text");
|
|
18
19
|
var style = {
|
|
@@ -46,24 +47,28 @@ var DynamicSection = function DynamicSection(_ref) {
|
|
|
46
47
|
var value = bindField.value,
|
|
47
48
|
appendValue = bindField.appendValue;
|
|
48
49
|
var bindFieldValue = value || [];
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_hooks.ParentFieldProvider, {
|
|
51
|
+
value: value,
|
|
52
|
+
path: Bind.parentName
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_Grid.Grid, {
|
|
50
54
|
className: gridClassName
|
|
51
55
|
}, typeof renderTitle === "function" && renderTitle(bindFieldValue), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
52
56
|
span: 12
|
|
53
57
|
}, showLabel && field.label && /*#__PURE__*/_react.default.createElement(Label, null, field.label), /*#__PURE__*/_react.default.createElement(FirstFieldBind, null, function (bindProps) {
|
|
54
|
-
return (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(_hooks.ParentFieldProvider, {
|
|
59
|
+
value: bindProps.value,
|
|
60
|
+
path: FirstFieldBind.parentName
|
|
61
|
+
}, children({
|
|
62
|
+
Bind: FirstFieldBind,
|
|
63
|
+
field: field,
|
|
64
|
+
// "index" contains Bind props for this particular item in the array
|
|
65
|
+
// "field" contains Bind props for the main (parent) field.
|
|
66
|
+
bind: {
|
|
67
|
+
index: bindProps,
|
|
68
|
+
field: bindField
|
|
69
|
+
},
|
|
70
|
+
index: 0 // Binds to "items.0" in the <Form>.
|
|
71
|
+
}));
|
|
67
72
|
})), bindFieldValue.slice(1).map(function (_, index) {
|
|
68
73
|
/* We simply increase index, and as you type, the appropriate indexes in the parent array will be updated. */
|
|
69
74
|
var realIndex = index + 1;
|
|
@@ -72,7 +77,10 @@ var DynamicSection = function DynamicSection(_ref) {
|
|
|
72
77
|
span: 12,
|
|
73
78
|
key: realIndex
|
|
74
79
|
}, /*#__PURE__*/_react.default.createElement(BindField, null, function (bindProps) {
|
|
75
|
-
return
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_hooks.ParentFieldProvider, {
|
|
81
|
+
value: bindProps.value,
|
|
82
|
+
path: BindField.parentName
|
|
83
|
+
}, children({
|
|
76
84
|
Bind: BindField,
|
|
77
85
|
field: field,
|
|
78
86
|
bind: {
|
|
@@ -80,7 +88,7 @@ var DynamicSection = function DynamicSection(_ref) {
|
|
|
80
88
|
field: bindField
|
|
81
89
|
},
|
|
82
90
|
index: realIndex
|
|
83
|
-
});
|
|
91
|
+
}));
|
|
84
92
|
}));
|
|
85
93
|
}), bindField.validation.isValid === false && /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
86
94
|
span: 12
|
|
@@ -96,7 +104,7 @@ var DynamicSection = function DynamicSection(_ref) {
|
|
|
96
104
|
}
|
|
97
105
|
}, /*#__PURE__*/_react.default.createElement(_Button.ButtonIcon, {
|
|
98
106
|
icon: /*#__PURE__*/_react.default.createElement(_add18px.ReactComponent, null)
|
|
99
|
-
}), t(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["Add value"]))))));
|
|
107
|
+
}), t(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["Add value"])))))));
|
|
100
108
|
})
|
|
101
109
|
);
|
|
102
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_emotion","_i18n","_Grid","_Button","_FormElementMessage","_add18px","_templateObject","t","i18n","ns","style","addButton","css","width","borderTop","paddingTop","DynamicSection","_ref","field","getBind","Label","children","_ref$showLabel","showLabel","_ref$emptyValue","emptyValue","renderTitle","gridClassName","Bind","FirstFieldBind","default","createElement","bindField","value","appendValue","bindFieldValue","Grid","className","Cell","span","label","bindProps","bind","index","slice","map","_","realIndex","BindField","key","validation","isValid","FormElementMessage","error","message","ButtonDefault","disabled","undefined","onClick","ButtonIcon","icon","ReactComponent","_taggedTemplateLiteral2","_default","exports"],"sources":["DynamicSection.tsx"],"sourcesContent":["import React from \"react\";\nimport { css } from \"emotion\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { ButtonDefault, ButtonIcon } from \"@webiny/ui/Button\";\nimport { BindComponent, BindComponentRenderProp, CmsModelField } from \"~/types\";\nimport { FormElementMessage } from \"@webiny/ui/FormElementMessage\";\nimport { ReactComponent as AddIcon } from \"@webiny/app-admin/assets/icons/add-18px.svg\";\nimport { GetBindCallable } from \"~/admin/components/ContentEntryForm/useBind\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/text\");\n\nconst style = {\n addButton: css({\n width: \"100%\",\n borderTop: \"1px solid var(--mdc-theme-background)\",\n paddingTop: 8\n })\n};\n\nexport interface DynamicSectionPropsChildrenParams {\n Bind: BindComponent;\n field: CmsModelField;\n bind: {\n index: BindComponentRenderProp;\n field: BindComponentRenderProp;\n };\n index: number;\n}\n\nexport interface DynamicSectionProps {\n field: CmsModelField;\n getBind: GetBindCallable;\n showLabel?: boolean;\n Label: React.ComponentType<any>;\n children: (params: DynamicSectionPropsChildrenParams) => JSX.Element;\n emptyValue?: any;\n renderTitle?: (value: any[]) => React.ReactElement;\n gridClassName?: string;\n}\n\nconst DynamicSection = ({\n field,\n getBind,\n Label,\n children,\n showLabel = true,\n emptyValue = \"\",\n renderTitle,\n gridClassName\n}: DynamicSectionProps) => {\n const Bind = getBind();\n const FirstFieldBind = getBind(0);\n\n return (\n /* First we mount the top level field, for example: \"items\" */\n <Bind>\n {bindField => {\n /**\n * \"value\" -> an array of items\n * \"appendValue\" -> a callback to add a new value to the top level \"items\" array\n */\n const { value, appendValue } = bindField;\n\n const bindFieldValue: string[] = value || [];\n return (\n <Grid className={gridClassName}>\n {typeof renderTitle === \"function\" && renderTitle(bindFieldValue)}\n <Cell span={12}>\n {/* We always render the first item, for better UX */}\n {showLabel && field.label && <Label>{field.label}</Label>}\n <FirstFieldBind>\n {bindProps =>\n /* We bind it to index \"0\", so when you start typing, that index in parent array will be populated */\n children({\n Bind: FirstFieldBind,\n field,\n // \"index\" contains Bind props for this particular item in the array\n // \"field\" contains Bind props for the main (parent) field.\n bind: {\n index: bindProps,\n field: bindField\n },\n index: 0 // Binds to \"items.0\" in the <Form>.\n })\n }\n </FirstFieldBind>\n </Cell>\n\n {/* Now we skip the first item, because we already rendered it above, and proceed with all other items. */}\n {bindFieldValue.slice(1).map((_, index) => {\n /* We simply increase index, and as you type, the appropriate indexes in the parent array will be updated. */\n const realIndex = index + 1;\n const BindField = getBind(realIndex);\n return (\n <Cell span={12} key={realIndex}>\n <BindField>\n {bindProps =>\n children({\n Bind: BindField,\n field,\n bind: {\n index: bindProps,\n field: bindField\n },\n index: realIndex\n })\n }\n </BindField>\n </Cell>\n );\n })}\n\n {bindField.validation.isValid === false && (\n <Cell span={12}>\n <FormElementMessage error>\n {bindField.validation.message}\n </FormElementMessage>\n </Cell>\n )}\n <Cell span={12} className={style.addButton}>\n <ButtonDefault\n disabled={bindFieldValue[0] === undefined}\n onClick={() => appendValue(emptyValue)}\n >\n <ButtonIcon icon={<AddIcon />} />\n {t`Add value`}\n </ButtonDefault>\n </Cell>\n </Grid>\n );\n }}\n </Bind>\n );\n};\n\nexport default DynamicSection;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAwF,IAAAO,eAAA;AAGxF,IAAMC,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,oCAAoC,CAAC;AAEvD,IA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AA,CAAAiC,OAAA,CAAAC,aAAA,CAAC3B,mBAAA,CAAAgD,kBAAkB;QAACC,KAAK;MAAA,GACpBrB,SAAS,CAACkB,UAAU,CAACI,OACN,CAClB,CACT,eACDzD,MAAA,CAAAiC,OAAA,CAAAC,aAAA,CAAC7B,KAAA,CAAAoC,IAAI;QAACC,IAAI,EAAE,EAAG;QAACF,SAAS,EAAE3B,KAAK,CAACC;MAAU,gBACvCd,MAAA,CAAAiC,OAAA,CAAAC,aAAA,CAAC5B,OAAA,CAAAoD,aAAa;QACVC,QAAQ,EAAErB,cAAc,CAAC,CAAC,CAAC,KAAKsB,SAAU;QAC1CC,OAAO,EAAE,SAAAA,QAAA;UAAA,OAAMxB,WAAW,CAACT,UAAU,CAAC;QAAA;MAAC,gBAEvC5B,MAAA,CAAAiC,OAAA,CAAAC,aAAA,CAAC5B,OAAA,CAAAwD,UAAU;QAACC,IAAI,eAAE/D,MAAA,CAAAiC,OAAA,CAAAC,aAAA,CAAC1B,QAAA,CAAAwD,cAAO,MAAE;MAAE,CAAE,CAAC,EAChCtD,CAAC,CAAAD,eAAA,KAAAA,eAAA,OAAAwD,uBAAA,CAAAhC,OAAA,kBACS,CACb,CACJ,CAAC;IAEf,CACE;EAAC;AAEf,CAAC;AAAC,IAAAiC,QAAA,GAEa/C,cAAc;AAAAgD,OAAA,CAAAlC,OAAA,GAAAiC,QAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_emotion","_i18n","_Grid","_Button","_FormElementMessage","_add18px","_hooks","_templateObject","t","i18n","ns","style","addButton","css","width","borderTop","paddingTop","DynamicSection","_ref","field","getBind","Label","children","_ref$showLabel","showLabel","_ref$emptyValue","emptyValue","renderTitle","gridClassName","Bind","FirstFieldBind","default","createElement","bindField","value","appendValue","bindFieldValue","ParentFieldProvider","path","parentName","Grid","className","Cell","span","label","bindProps","bind","index","slice","map","_","realIndex","BindField","key","validation","isValid","FormElementMessage","error","message","ButtonDefault","disabled","undefined","onClick","ButtonIcon","icon","ReactComponent","_taggedTemplateLiteral2","_default","exports"],"sources":["DynamicSection.tsx"],"sourcesContent":["import React from \"react\";\nimport { css } from \"emotion\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { ButtonDefault, ButtonIcon } from \"@webiny/ui/Button\";\nimport { BindComponent, BindComponentRenderProp, CmsModelField } from \"~/types\";\nimport { FormElementMessage } from \"@webiny/ui/FormElementMessage\";\nimport { ReactComponent as AddIcon } from \"@webiny/app-admin/assets/icons/add-18px.svg\";\nimport { GetBindCallable } from \"~/admin/components/ContentEntryForm/useBind\";\nimport { ParentFieldProvider } from \"~/admin/hooks\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/text\");\n\nconst style = {\n addButton: css({\n width: \"100%\",\n borderTop: \"1px solid var(--mdc-theme-background)\",\n paddingTop: 8\n })\n};\n\nexport interface DynamicSectionPropsChildrenParams {\n Bind: BindComponent;\n field: CmsModelField;\n bind: {\n index: BindComponentRenderProp;\n field: BindComponentRenderProp;\n };\n index: number;\n}\n\nexport interface DynamicSectionProps {\n field: CmsModelField;\n getBind: GetBindCallable;\n showLabel?: boolean;\n Label: React.ComponentType<any>;\n children: (params: DynamicSectionPropsChildrenParams) => JSX.Element;\n emptyValue?: any;\n renderTitle?: (value: any[]) => React.ReactElement;\n gridClassName?: string;\n}\n\nconst DynamicSection = ({\n field,\n getBind,\n Label,\n children,\n showLabel = true,\n emptyValue = \"\",\n renderTitle,\n gridClassName\n}: DynamicSectionProps) => {\n const Bind = getBind();\n const FirstFieldBind = getBind(0);\n\n return (\n /* First we mount the top level field, for example: \"items\" */\n <Bind>\n {bindField => {\n /**\n * \"value\" -> an array of items\n * \"appendValue\" -> a callback to add a new value to the top level \"items\" array\n */\n const { value, appendValue } = bindField;\n\n const bindFieldValue: string[] = value || [];\n return (\n <ParentFieldProvider value={value} path={Bind.parentName}>\n <Grid className={gridClassName}>\n {typeof renderTitle === \"function\" && renderTitle(bindFieldValue)}\n <Cell span={12}>\n {/* We always render the first item, for better UX */}\n {showLabel && field.label && <Label>{field.label}</Label>}\n\n <FirstFieldBind>\n {bindProps => (\n <ParentFieldProvider\n value={bindProps.value}\n path={FirstFieldBind.parentName}\n >\n {/* We bind it to index \"0\", so when you start typing, that index in parent array will be populated */}\n {children({\n Bind: FirstFieldBind,\n field,\n // \"index\" contains Bind props for this particular item in the array\n // \"field\" contains Bind props for the main (parent) field.\n bind: {\n index: bindProps,\n field: bindField\n },\n index: 0 // Binds to \"items.0\" in the <Form>.\n })}\n </ParentFieldProvider>\n )}\n </FirstFieldBind>\n </Cell>\n\n {/* Now we skip the first item, because we already rendered it above, and proceed with all other items. */}\n {bindFieldValue.slice(1).map((_, index) => {\n /* We simply increase index, and as you type, the appropriate indexes in the parent array will be updated. */\n const realIndex = index + 1;\n const BindField = getBind(realIndex);\n return (\n <Cell span={12} key={realIndex}>\n <BindField>\n {bindProps => (\n <ParentFieldProvider\n value={bindProps.value}\n path={BindField.parentName}\n >\n {children({\n Bind: BindField,\n field,\n bind: {\n index: bindProps,\n field: bindField\n },\n index: realIndex\n })}\n </ParentFieldProvider>\n )}\n </BindField>\n </Cell>\n );\n })}\n\n {bindField.validation.isValid === false && (\n <Cell span={12}>\n <FormElementMessage error>\n {bindField.validation.message}\n </FormElementMessage>\n </Cell>\n )}\n <Cell span={12} className={style.addButton}>\n <ButtonDefault\n disabled={bindFieldValue[0] === undefined}\n onClick={() => appendValue(emptyValue)}\n >\n <ButtonIcon icon={<AddIcon />} />\n {t`Add value`}\n </ButtonDefault>\n </Cell>\n </Grid>\n </ParentFieldProvider>\n );\n }}\n </Bind>\n );\n};\n\nexport default DynamicSection;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA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,MAAA,CAAAkC,OAAA,CAAAC,aAAA,CAAC3B,QAAA,CAAA4D,cAAO,MAAE;MAAE,CAAE,CAAC,EAChCzD,CAAC,CAAAD,eAAA,KAAAA,eAAA,OAAA2D,uBAAA,CAAAnC,OAAA,kBACS,CACb,CACJ,CACW,CAAC;IAE9B,CACE;EAAC;AAEf,CAAC;AAAC,IAAAoC,QAAA,GAEalD,cAAc;AAAAmD,OAAA,CAAArC,OAAA,GAAAoC,QAAA"}
|
|
@@ -63,7 +63,7 @@ var AddTemplateButton = function AddTemplateButton(props) {
|
|
|
63
63
|
onClick: browseTemplates
|
|
64
64
|
}, "+ Add a template"), /*#__PURE__*/_react.default.createElement(Info, null, /*#__PURE__*/_react.default.createElement(_info.ReactComponent, null), /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
|
|
65
65
|
use: "caption"
|
|
66
|
-
}, "Click here to learn how templates and dynamic zones work"))));
|
|
66
|
+
}, "Click here to learn how templates and dynamic zones work."))));
|
|
67
67
|
};
|
|
68
68
|
exports.AddTemplateButton = AddTemplateButton;
|
|
69
69
|
var AddTemplateIcon = function AddTemplateIcon(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_styled","_interopRequireDefault","_info","_add_circle_outline","_Typography","_TemplateGallery","_Button","AddIconContainer","styled","label","target","AddButtonContainer","Info","useAddTemplate","params","_useState","useState","_useState2","_slicedToArray2","default","showGallery","setShowGallery","browseTemplates","onTemplate","template","onGalleryClose","AddTemplateButton","props","_useAddTemplate","createElement","TemplateGallery","onClose","Fragment","ButtonSecondary","onClick","ReactComponent","Typography","use","exports","AddTemplateIcon","_useAddTemplate2","IconButton","icon"],"sources":["AddTemplate.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport styled from \"@emotion/styled\";\nimport { ReactComponent as InfoIcon } from \"@material-design-icons/svg/outlined/info.svg\";\nimport { ReactComponent as AddIcon } from \"@material-design-icons/svg/round/add_circle_outline.svg\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { CmsDynamicZoneTemplate } from \"~/types\";\nimport { TemplateGallery } from \"./TemplateGallery\";\nimport { IconButton, ButtonSecondary } from \"@webiny/ui/Button\";\n\nconst AddIconContainer = styled.div`\n text-align: center;\n padding-top: 3px;\n`;\n\nconst AddButtonContainer = styled.div`\n text-align: center;\n margin-top: 20px;\n\n :first-of-type {\n margin-top: 0;\n }\n`;\n\nconst Info = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n margin-top: 5px;\n\n > svg {\n width: 20px;\n margin-right: 5px;\n }\n`;\n\ninterface UseAddTemplateParams {\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n}\n\nfunction useAddTemplate(params: UseAddTemplateParams) {\n const [showGallery, setShowGallery] = useState(false);\n\n const browseTemplates = () => {\n setShowGallery(true);\n };\n\n const onTemplate = (template: CmsDynamicZoneTemplate) => {\n params.onTemplate(template);\n onGalleryClose();\n };\n\n const onGalleryClose = () => {\n setShowGallery(false);\n };\n\n return {\n showGallery,\n browseTemplates,\n onTemplate,\n onGalleryClose\n };\n}\n\ninterface AddTemplateProps {\n label?: string;\n onTemplate: UseAddTemplateParams[\"onTemplate\"];\n}\n\nexport const AddTemplateButton = (props: AddTemplateProps) => {\n const { showGallery, onTemplate, browseTemplates, onGalleryClose } = useAddTemplate({\n onTemplate: props.onTemplate\n });\n\n return (\n <AddButtonContainer>\n {showGallery ? (\n <TemplateGallery onTemplate={onTemplate} onClose={onGalleryClose} />\n ) : (\n <>\n <ButtonSecondary onClick={browseTemplates}>+ Add a template</ButtonSecondary>\n <Info>\n <InfoIcon />\n <Typography use={\"caption\"}>\n Click here to learn how templates and dynamic zones work
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_styled","_interopRequireDefault","_info","_add_circle_outline","_Typography","_TemplateGallery","_Button","AddIconContainer","styled","label","target","AddButtonContainer","Info","useAddTemplate","params","_useState","useState","_useState2","_slicedToArray2","default","showGallery","setShowGallery","browseTemplates","onTemplate","template","onGalleryClose","AddTemplateButton","props","_useAddTemplate","createElement","TemplateGallery","onClose","Fragment","ButtonSecondary","onClick","ReactComponent","Typography","use","exports","AddTemplateIcon","_useAddTemplate2","IconButton","icon"],"sources":["AddTemplate.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport styled from \"@emotion/styled\";\nimport { ReactComponent as InfoIcon } from \"@material-design-icons/svg/outlined/info.svg\";\nimport { ReactComponent as AddIcon } from \"@material-design-icons/svg/round/add_circle_outline.svg\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { CmsDynamicZoneTemplate } from \"~/types\";\nimport { TemplateGallery } from \"./TemplateGallery\";\nimport { IconButton, ButtonSecondary } from \"@webiny/ui/Button\";\n\nconst AddIconContainer = styled.div`\n text-align: center;\n padding-top: 3px;\n`;\n\nconst AddButtonContainer = styled.div`\n text-align: center;\n margin-top: 20px;\n\n :first-of-type {\n margin-top: 0;\n }\n`;\n\nconst Info = styled.div`\n display: flex;\n justify-content: center;\n align-items: center;\n margin-top: 5px;\n\n > svg {\n width: 20px;\n margin-right: 5px;\n }\n`;\n\ninterface UseAddTemplateParams {\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n}\n\nfunction useAddTemplate(params: UseAddTemplateParams) {\n const [showGallery, setShowGallery] = useState(false);\n\n const browseTemplates = () => {\n setShowGallery(true);\n };\n\n const onTemplate = (template: CmsDynamicZoneTemplate) => {\n params.onTemplate(template);\n onGalleryClose();\n };\n\n const onGalleryClose = () => {\n setShowGallery(false);\n };\n\n return {\n showGallery,\n browseTemplates,\n onTemplate,\n onGalleryClose\n };\n}\n\ninterface AddTemplateProps {\n label?: string;\n onTemplate: UseAddTemplateParams[\"onTemplate\"];\n}\n\nexport const AddTemplateButton = (props: AddTemplateProps) => {\n const { showGallery, onTemplate, browseTemplates, onGalleryClose } = useAddTemplate({\n onTemplate: props.onTemplate\n });\n\n return (\n <AddButtonContainer>\n {showGallery ? (\n <TemplateGallery onTemplate={onTemplate} onClose={onGalleryClose} />\n ) : (\n <>\n <ButtonSecondary onClick={browseTemplates}>+ Add a template</ButtonSecondary>\n <Info>\n <InfoIcon />\n <Typography use={\"caption\"}>\n Click here to learn how templates and dynamic zones work.\n </Typography>\n </Info>\n </>\n )}\n </AddButtonContainer>\n );\n};\n\nexport const AddTemplateIcon = (props: AddTemplateProps) => {\n const { showGallery, onTemplate, browseTemplates, onGalleryClose } = useAddTemplate({\n onTemplate: props.onTemplate\n });\n\n return (\n <AddIconContainer>\n {showGallery ? (\n <TemplateGallery onTemplate={onTemplate} onClose={onGalleryClose} />\n ) : (\n <IconButton onClick={browseTemplates} icon={<AddIcon />} />\n )}\n </AddIconContainer>\n );\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAMQ,gBAAgB,oBAAGC,eAAM;EAAAC,KAAA;EAAAC,MAAA;AAAA,wCAG9B;AAED,IAAMC,kBAAkB,oBAAGH,eAAM;EAAAC,KAAA;EAAAC,MAAA;AAAA,qEAOhC;AAED,IAAME,IAAI,oBAAGJ,eAAM;EAAAC,KAAA;EAAAC,MAAA;AAAA,+GAUlB;AAMD,SAASG,cAAcA,CAACC,MAA4B,EAAE;EAClD,IAAAC,SAAA,GAAsC,IAAAC,eAAQ,EAAC,KAAK,CAAC;IAAAC,UAAA,OAAAC,eAAA,CAAAC,OAAA,EAAAJ,SAAA;IAA9CK,WAAW,GAAAH,UAAA;IAAEI,cAAc,GAAAJ,UAAA;EAElC,IAAMK,eAAe,GAAG,SAAlBA,eAAeA,CAAA,EAAS;IAC1BD,cAAc,CAAC,IAAI,CAAC;EACxB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CAAC,eACZtC,MAAA,CAAAsB,OAAA,CAAAU,aAAA,CAACzB,WAAA,CAAAgC,UAAU;IAACC,GAAG,EAAE;EAAU,GAAC,2DAEhB,CACV,CACR,CAEU,CAAC;AAE7B,CAAC;AAACC,OAAA,CAAAZ,iBAAA,GAAAA,iBAAA;AAEK,IAAMa,eAAe,GAAG,SAAlBA,eAAeA,CAAIZ,KAAuB,EAAK;EACxD,IAAAa,gBAAA,GAAqE3B,cAAc,CAAC;MAChFU,UAAU,EAAEI,KAAK,CAACJ;IACtB,CAAC,CAAC;IAFMH,WAAW,GAAAoB,gBAAA,CAAXpB,WAAW;IAAEG,UAAU,GAAAiB,gBAAA,CAAVjB,UAAU;IAAED,eAAe,GAAAkB,gBAAA,CAAflB,eAAe;IAAEG,cAAc,GAAAe,gBAAA,CAAdf,cAAc;EAIhE,oBACI5B,MAAA,CAAAsB,OAAA,CAAAU,aAAA,CAACtB,gBAAgB,QACZa,WAAW,gBACRvB,MAAA,CAAAsB,OAAA,CAAAU,aAAA,CAACxB,gBAAA,CAAAyB,eAAe;IAACP,UAAU,EAAEA,UAAW;IAACQ,OAAO,EAAEN;EAAe,CAAE,CAAC,gBAEpE5B,MAAA,CAAAsB,OAAA,CAAAU,aAAA,CAACvB,OAAA,CAAAmC,UAAU;IAACP,OAAO,EAAEZ,eAAgB;IAACoB,IAAI,eAAE7C,MAAA,CAAAsB,OAAA,CAAAU,aAAA,CAAC1B,mBAAA,CAAAgC,cAAO,MAAE;EAAE,CAAE,CAEhD,CAAC;AAE3B,CAAC;AAACG,OAAA,CAAAC,eAAA,GAAAA,eAAA"}
|
|
@@ -17,13 +17,23 @@ export interface MultiValueItemContainerProps {
|
|
|
17
17
|
template: CmsDynamicZoneTemplate;
|
|
18
18
|
children: React.ReactNode;
|
|
19
19
|
}
|
|
20
|
-
export declare const MultiValueItemContainer: import("@webiny/react-composition").
|
|
20
|
+
export declare const MultiValueItemContainer: import("@webiny/react-composition").GenericComponent<MultiValueItemContainerProps> & {
|
|
21
|
+
original: import("@webiny/react-composition").GenericComponent<MultiValueItemContainerProps>;
|
|
22
|
+
originalName: string;
|
|
23
|
+
} & {
|
|
24
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: MultiValueItemContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
25
|
+
};
|
|
21
26
|
export interface MultiValueItemItemProps {
|
|
22
27
|
template: CmsDynamicZoneTemplate;
|
|
23
28
|
contentModel: CmsModel;
|
|
24
29
|
Bind: BindComponent;
|
|
25
30
|
}
|
|
26
|
-
export declare const MultiValueItem: import("@webiny/react-composition").
|
|
31
|
+
export declare const MultiValueItem: import("@webiny/react-composition").GenericComponent<MultiValueItemItemProps> & {
|
|
32
|
+
original: import("@webiny/react-composition").GenericComponent<MultiValueItemItemProps>;
|
|
33
|
+
originalName: string;
|
|
34
|
+
} & {
|
|
35
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: MultiValueItemItemProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
36
|
+
};
|
|
27
37
|
interface TemplateValue {
|
|
28
38
|
_templateId: string;
|
|
29
39
|
[key: string]: any;
|
|
@@ -31,7 +41,12 @@ interface TemplateValue {
|
|
|
31
41
|
export interface MultiValueContainerProps extends MultiValueDynamicZoneProps {
|
|
32
42
|
children: React.ReactNode;
|
|
33
43
|
}
|
|
34
|
-
export declare const MultiValueContainer: import("@webiny/react-composition").
|
|
44
|
+
export declare const MultiValueContainer: import("@webiny/react-composition").GenericComponent<MultiValueContainerProps> & {
|
|
45
|
+
original: import("@webiny/react-composition").GenericComponent<MultiValueContainerProps>;
|
|
46
|
+
originalName: string;
|
|
47
|
+
} & {
|
|
48
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: MultiValueContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
49
|
+
};
|
|
35
50
|
interface MultiValueDynamicZoneProps {
|
|
36
51
|
field: CmsModelField;
|
|
37
52
|
bind: BindComponentRenderProp;
|
|
@@ -18,6 +18,7 @@ var _TemplateIcon = require("./TemplateIcon");
|
|
|
18
18
|
var _hooks = require("../../../hooks");
|
|
19
19
|
var _Fields = require("../../../components/ContentEntryForm/Fields");
|
|
20
20
|
var _reactComposition = require("@webiny/react-composition");
|
|
21
|
+
var _TemplateProvider = require("./TemplateProvider");
|
|
21
22
|
var BottomMargin = /*#__PURE__*/(0, _styled.default)("div", {
|
|
22
23
|
label: "BottomMargin",
|
|
23
24
|
target: "e1mhu37c0"
|
|
@@ -40,12 +41,14 @@ var MultiValueItem = (0, _reactComposition.makeDecoratable)("MultiValueItem", fu
|
|
|
40
41
|
var template = props.template,
|
|
41
42
|
Bind = props.Bind,
|
|
42
43
|
contentModel = props.contentModel;
|
|
43
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_TemplateProvider.TemplateProvider, {
|
|
45
|
+
template: template
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_Fields.Fields, {
|
|
44
47
|
fields: template.fields,
|
|
45
48
|
layout: template.layout || [],
|
|
46
49
|
contentModel: contentModel,
|
|
47
50
|
Bind: Bind
|
|
48
|
-
});
|
|
51
|
+
}));
|
|
49
52
|
});
|
|
50
53
|
exports.MultiValueItem = MultiValueItem;
|
|
51
54
|
var TemplateValueForm = function TemplateValueForm(_ref2) {
|
|
@@ -123,12 +126,20 @@ var MultiValueDynamicZone = function MultiValueDynamicZone(props) {
|
|
|
123
126
|
};
|
|
124
127
|
var values = bind.value || [];
|
|
125
128
|
var hasValues = values.length > 0;
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
var Bind = getBind();
|
|
130
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, hasValues ? /*#__PURE__*/_react.default.createElement(_hooks.ParentFieldProvider, {
|
|
131
|
+
value: bind.value,
|
|
132
|
+
path: Bind.parentName
|
|
133
|
+
}, /*#__PURE__*/_react.default.createElement(MultiValueContainer, props, values.map(function (value, index) {
|
|
134
|
+
var Bind = getBind(index);
|
|
135
|
+
return /*#__PURE__*/_react.default.createElement(_hooks.ParentFieldProvider, {
|
|
136
|
+
value: value,
|
|
128
137
|
key: index,
|
|
138
|
+
path: Bind.parentName
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement(TemplateValueForm, {
|
|
129
140
|
value: value,
|
|
130
141
|
contentModel: contentModel,
|
|
131
|
-
Bind:
|
|
142
|
+
Bind: Bind,
|
|
132
143
|
isFirst: index === 0,
|
|
133
144
|
isLast: index === values.length - 1,
|
|
134
145
|
onMoveUp: function onMoveUp() {
|
|
@@ -143,8 +154,8 @@ var MultiValueDynamicZone = function MultiValueDynamicZone(props) {
|
|
|
143
154
|
onClone: function onClone() {
|
|
144
155
|
return cloneValue(index);
|
|
145
156
|
}
|
|
146
|
-
});
|
|
147
|
-
})) : null, hasValues ? /*#__PURE__*/_react.default.createElement(_AddTemplate.AddTemplateIcon, {
|
|
157
|
+
}));
|
|
158
|
+
}))) : null, hasValues ? /*#__PURE__*/_react.default.createElement(_AddTemplate.AddTemplateIcon, {
|
|
148
159
|
onTemplate: onTemplate
|
|
149
160
|
}) : /*#__PURE__*/_react.default.createElement(BottomMargin, null, /*#__PURE__*/_react.default.createElement(_AddTemplate.AddTemplateButton, {
|
|
150
161
|
onTemplate: onTemplate
|
|
@@ -1 +1 @@
|
|
|
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","makeDecoratable","_ref","title","description","icon","actions","children","default","createElement","AccordionItem","exports","MultiValueItem","props","template","Bind","contentModel","Fields","fields","layout","TemplateValueForm","_ref2","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 { makeDecoratable } 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 = makeDecoratable(\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 = makeDecoratable(\n \"MultiValueItem\",\n (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);\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 = ({\n value,\n contentModel,\n Bind,\n isLast,\n isFirst,\n onMoveUp,\n onMoveDown,\n onDelete,\n onClone\n}: TemplateValueFormProps) => {\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 = makeDecoratable<\n React.FunctionComponent<MultiValueContainerProps>\n>(\"MultiValueContainer\", ({ children }) => {\n return (\n <Accordion>\n <>{children}</>\n </Accordion>\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 = (props: MultiValueDynamicZoneProps) => {\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,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,O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,CAAAC,aAAA,CAACb,YAAY,qBACTf,MAAA,CAAA2B,OAAA,CAAAC,aAAA,CAAClB,YAAA,CAAA6E,iBAAiB;IAACf,UAAU,EAAEA;EAAW,CAAE,CAClC,CAEpB,CAAC;AAEX,CAAC;AAAC1C,OAAA,CAAAuC,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","_TemplateProvider","BottomMargin","styled","label","target","MultiValueItemContainer","makeDecoratable","_ref","title","description","icon","actions","children","default","createElement","AccordionItem","exports","MultiValueItem","props","template","Bind","contentModel","TemplateProvider","Fields","fields","layout","TemplateValueForm","_ref2","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","ParentFieldProvider","path","parentName","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 { ParentFieldProvider, 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 { makeDecoratable } from \"@webiny/react-composition\";\nimport { TemplateProvider } from \"~/admin/plugins/fieldRenderers/dynamicZone/TemplateProvider\";\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 = makeDecoratable(\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 = makeDecoratable(\n \"MultiValueItem\",\n (props: MultiValueItemItemProps) => {\n const { template, Bind, contentModel } = props;\n\n return (\n <TemplateProvider template={template}>\n <Fields\n fields={template.fields}\n layout={template.layout || []}\n contentModel={contentModel}\n Bind={Bind}\n />\n </TemplateProvider>\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 = ({\n value,\n contentModel,\n Bind,\n isLast,\n isFirst,\n onMoveUp,\n onMoveDown,\n onDelete,\n onClone\n}: TemplateValueFormProps) => {\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 = makeDecoratable(\n \"MultiValueContainer\",\n ({ children }: MultiValueContainerProps) => {\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 = (props: MultiValueDynamicZoneProps) => {\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 const Bind = getBind();\n\n return (\n <>\n {hasValues ? (\n <ParentFieldProvider value={bind.value} path={Bind.parentName}>\n <MultiValueContainer {...props}>\n {values.map((value, index) => {\n const Bind = getBind(index);\n\n return (\n <ParentFieldProvider\n value={value}\n key={index}\n path={Bind.parentName}\n >\n <TemplateValueForm\n value={value}\n contentModel={contentModel}\n Bind={Bind}\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 </ParentFieldProvider>\n );\n })}\n </MultiValueContainer>\n </ParentFieldProvider>\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,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AASA,IAAAY,iBAAA,GAAAZ,OAAA;AACA,IAAAa,iBAAA,GAAAb,OAAA;AAEA,IAAMc,YAAY,oBAAGC,eAAM;EAAAC,KAAA;EAAAC,MAAA;AAAA,yBAE1B;AAqBM,IAAMC,uBAAuB,GAAG,IAAAC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