@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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_i18n","_Button","_Grid","_Accordion","_DynamicSection","_interopRequireDefault","_Fields","_close","_arrow_drop_up","_arrow_drop_down","_Accordion2","_StyledComponents","_utils","_FieldSettings","_templateObject","_templateObject2","t","i18n","ns","Actions","_ref","setHighlightIndex","bind","index","_bind$field","field","moveValueDown","moveValueUp","onDown","useCallback","e","stopPropagation","map","_objectSpread4","default","_defineProperty2","generateAlphaNumericLowerCaseId","onUp","createElement","Fragment","IconButton","icon","ReactComponent","onClick","removeValue","ObjectsRenderer","props","_useState","useState","_useState2","_slicedToArray2","highlightMap","contentModel","fieldSettings","FieldSettings","createFrom","hasFields","logMissingFields","settings","getSettings","Accordion","AccordionItem","title","label","description","helpText","Object","assign","emptyValue","showLabel","gridClassName","dynamicSectionGridStyle","_ref2","Bind","ObjectItem","ItemHighLight","key","concat","action","defaultValue","Cell","span","className","fieldsWrapperStyle","Fields","fields","layout","fieldsGridStyle","plugin","type","name","renderer","rendererName","_taggedTemplateLiteral2","canUse","_ref3","Boolean","multipleValues","render","_default","exports"],"sources":["multipleObjectsAccordion.tsx"],"sourcesContent":["import React, { Dispatch, SetStateAction, useState, useCallback } from \"react\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport { Cell } from \"@webiny/ui/Grid\";\nimport { Accordion as RootAccordion, AccordionItem } from \"@webiny/ui/Accordion\";\nimport {\n BindComponentRenderProp,\n CmsModelFieldRendererPlugin,\n CmsModelFieldRendererProps\n} from \"~/types\";\nimport DynamicSection from \"../DynamicSection\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\nimport { ReactComponent as DeleteIcon } from \"~/admin/icons/close.svg\";\nimport { ReactComponent as ArrowUp } from \"./arrow_drop_up.svg\";\nimport { ReactComponent as ArrowDown } from \"./arrow_drop_down.svg\";\nimport Accordion from \"~/admin/plugins/fieldRenderers/Accordion\";\nimport {\n fieldsWrapperStyle,\n dynamicSectionGridStyle,\n fieldsGridStyle,\n ItemHighLight,\n ObjectItem\n} from \"./StyledComponents\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\nimport { FieldSettings } from \"./FieldSettings\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/text\");\n\ninterface ActionsProps {\n setHighlightIndex: Dispatch<SetStateAction<{ [key: number]: string }>>;\n index: number;\n bind: {\n index: BindComponentRenderProp;\n field: BindComponentRenderProp;\n };\n}\n\nconst Actions = ({ setHighlightIndex, bind, index }: ActionsProps) => {\n const { moveValueDown, moveValueUp } = bind.field;\n\n const onDown = useCallback(\n e => {\n e.stopPropagation();\n moveValueDown(index);\n setHighlightIndex(map => ({\n ...map,\n [index + 1]: generateAlphaNumericLowerCaseId(12)\n }));\n },\n [moveValueDown, index]\n );\n\n const onUp = useCallback(\n e => {\n e.stopPropagation();\n moveValueUp(index);\n setHighlightIndex(map => ({\n ...map,\n [index - 1]: generateAlphaNumericLowerCaseId(12)\n }));\n },\n [moveValueUp, index]\n );\n\n return index > 0 ? (\n <>\n <IconButton icon={<ArrowDown />} onClick={onDown} />\n <IconButton icon={<ArrowUp />} onClick={onUp} />\n <IconButton icon={<DeleteIcon />} onClick={() => bind.field.removeValue(index)} />\n </>\n ) : null;\n};\n\nconst ObjectsRenderer = (props: CmsModelFieldRendererProps) => {\n const [highlightMap, setHighlightIndex] = useState<{ [key: number]: string }>({});\n const { field, contentModel } = props;\n\n const fieldSettings = FieldSettings.createFrom(field);\n\n if (!fieldSettings.hasFields()) {\n fieldSettings.logMissingFields();\n return null;\n }\n\n const settings = fieldSettings.getSettings();\n\n return (\n <RootAccordion>\n <AccordionItem title={field.label} description={field.helpText}>\n <DynamicSection\n {...props}\n emptyValue={{}}\n showLabel={false}\n gridClassName={dynamicSectionGridStyle}\n >\n {({ Bind, bind, index }) => (\n <ObjectItem>\n {highlightMap[index] ? (\n <ItemHighLight key={highlightMap[index]} />\n ) : null}\n <Accordion\n title={`${props.field.label} #${index + 1}`}\n action={\n <Actions\n setHighlightIndex={setHighlightIndex}\n index={index}\n bind={bind}\n />\n }\n // Open first Accordion by default\n defaultValue={index === 0}\n >\n <Cell span={12} className={fieldsWrapperStyle}>\n <Fields\n Bind={Bind}\n {...bind.index}\n contentModel={contentModel}\n fields={settings.fields}\n layout={settings.layout}\n gridClassName={fieldsGridStyle}\n />\n </Cell>\n </Accordion>\n </ObjectItem>\n )}\n </DynamicSection>\n </AccordionItem>\n </RootAccordion>\n );\n};\n\nconst plugin: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-objects-accordion\",\n renderer: {\n rendererName: \"objects-accordion\",\n name: t`Accordion`,\n description: t`Renders fields within an accordion.`,\n canUse({ field }) {\n return field.type === \"object\" && Boolean(field.multipleValues);\n },\n render(props) {\n return <ObjectsRenderer {...props} />;\n }\n }\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAMA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAL,sBAAA,CAAAN,OAAA;AACA,IAAAY,iBAAA,GAAAZ,OAAA;AAOA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,cAAA,GAAAd,OAAA;AAAgD,IAAAe,eAAA,EAAAC,gBAAA;AAEhD,IAAMC,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,oCAAoC,CAAC;AAWvD,IAAMC,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAAyD;EAAA,IAAnDC,iBAAiB,GAAAD,IAAA,CAAjBC,iBAAiB;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAEC,KAAK,GAAAH,IAAA,CAALG,KAAK;EAC7C,IAAAC,WAAA,GAAuCF,IAAI,CAACG,KAAK;IAAzCC,aAAa,GAAAF,WAAA,CAAbE,aAAa;IAAEC,WAAW,GAAAH,WAAA,CAAXG,WAAW;EAElC,IAAMC,MAAM,GAA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,YAAY,EAAEA,YAAa;MAC3BiC,MAAM,EAAE3B,QAAQ,CAAC2B,MAAO;MACxBC,MAAM,EAAE5B,QAAQ,CAAC4B,MAAO;MACxBhB,aAAa,EAAEiB;IAAgB,EAClC,CACC,CACC,CACH,CAAC;EAAA,CAEL,CACL,CACJ,CAAC;AAExB,CAAC;AAED,IAAMC,MAAmC,GAAG;EACxCC,IAAI,EAAE,2BAA2B;EACjCC,IAAI,EAAE,6CAA6C;EACnDC,QAAQ,EAAE;IACNC,YAAY,EAAE,mBAAmB;IACjCF,IAAI,EAAE1E,CAAC,CAAAF,eAAA,KAAAA,eAAA,OAAA+E,uBAAA,CAAA3D,OAAA,kBAAW;IAClB8B,WAAW,EAAEhD,CAAC,CAAAD,gBAAA,KAAAA,gBAAA,OAAA8E,uBAAA,CAAA3D,OAAA,4CAAqC;IACnD4D,MAAM,WAAAA,OAAAC,KAAA,EAAY;MAAA,IAATtE,KAAK,GAAAsE,KAAA,CAALtE,KAAK;MACV,OAAOA,KAAK,CAACgE,IAAI,KAAK,QAAQ,IAAIO,OAAO,CAACvE,KAAK,CAACwE,cAAc,CAAC;IACnE,CAAC;IACDC,MAAM,WAAAA,OAACpD,KAAK,EAAE;MACV,oBAAOjD,MAAA,CAAAqC,OAAA,CAAAI,aAAA,CAACO,eAAe,EAAKC,KAAQ,CAAC;IACzC;EACJ;AACJ,CAAC;AAAC,IAAAqD,QAAA,GAEaX,MAAM;AAAAY,OAAA,CAAAlE,OAAA,GAAAiE,QAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_i18n","_Button","_Grid","_Accordion","_DynamicSection","_interopRequireDefault","_Fields","_close","_arrow_drop_up","_arrow_drop_down","_Accordion2","_StyledComponents","_utils","_FieldSettings","_ParentValue","_templateObject","_templateObject2","t","i18n","ns","Actions","_ref","setHighlightIndex","bind","index","_bind$field","field","moveValueDown","moveValueUp","onDown","useCallback","e","stopPropagation","map","_objectSpread4","default","_defineProperty2","generateAlphaNumericLowerCaseId","onUp","createElement","Fragment","IconButton","icon","ReactComponent","onClick","removeValue","ObjectsRenderer","props","_useState","useState","_useState2","_slicedToArray2","highlightMap","contentModel","fieldSettings","FieldSettings","createFrom","hasFields","logMissingFields","settings","getSettings","Accordion","AccordionItem","title","label","description","helpText","Object","assign","emptyValue","showLabel","gridClassName","dynamicSectionGridStyle","_ref2","Bind","ObjectItem","ItemHighLight","key","concat","action","defaultValue","Cell","span","className","fieldsWrapperStyle","ParentFieldProvider","value","path","parentName","Fields","fields","layout","fieldsGridStyle","plugin","type","name","renderer","rendererName","_taggedTemplateLiteral2","canUse","_ref3","Boolean","multipleValues","render","_default","exports"],"sources":["multipleObjectsAccordion.tsx"],"sourcesContent":["import React, { Dispatch, SetStateAction, useState, useCallback } from \"react\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport { Cell } from \"@webiny/ui/Grid\";\nimport { Accordion as RootAccordion, AccordionItem } from \"@webiny/ui/Accordion\";\nimport {\n BindComponentRenderProp,\n CmsModelFieldRendererPlugin,\n CmsModelFieldRendererProps\n} from \"~/types\";\nimport DynamicSection from \"../DynamicSection\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\nimport { ReactComponent as DeleteIcon } from \"~/admin/icons/close.svg\";\nimport { ReactComponent as ArrowUp } from \"./arrow_drop_up.svg\";\nimport { ReactComponent as ArrowDown } from \"./arrow_drop_down.svg\";\nimport Accordion from \"~/admin/plugins/fieldRenderers/Accordion\";\nimport {\n fieldsWrapperStyle,\n dynamicSectionGridStyle,\n fieldsGridStyle,\n ItemHighLight,\n ObjectItem\n} from \"./StyledComponents\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\nimport { FieldSettings } from \"./FieldSettings\";\nimport { ParentFieldProvider } from \"~/admin/components/ContentEntryForm/ParentValue\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/text\");\n\ninterface ActionsProps {\n setHighlightIndex: Dispatch<SetStateAction<{ [key: number]: string }>>;\n index: number;\n bind: {\n index: BindComponentRenderProp;\n field: BindComponentRenderProp;\n };\n}\n\nconst Actions = ({ setHighlightIndex, bind, index }: ActionsProps) => {\n const { moveValueDown, moveValueUp } = bind.field;\n\n const onDown = useCallback(\n e => {\n e.stopPropagation();\n moveValueDown(index);\n setHighlightIndex(map => ({\n ...map,\n [index + 1]: generateAlphaNumericLowerCaseId(12)\n }));\n },\n [moveValueDown, index]\n );\n\n const onUp = useCallback(\n e => {\n e.stopPropagation();\n moveValueUp(index);\n setHighlightIndex(map => ({\n ...map,\n [index - 1]: generateAlphaNumericLowerCaseId(12)\n }));\n },\n [moveValueUp, index]\n );\n\n return index > 0 ? (\n <>\n <IconButton icon={<ArrowDown />} onClick={onDown} />\n <IconButton icon={<ArrowUp />} onClick={onUp} />\n <IconButton icon={<DeleteIcon />} onClick={() => bind.field.removeValue(index)} />\n </>\n ) : null;\n};\n\nconst ObjectsRenderer = (props: CmsModelFieldRendererProps) => {\n const [highlightMap, setHighlightIndex] = useState<{ [key: number]: string }>({});\n const { field, contentModel } = props;\n\n const fieldSettings = FieldSettings.createFrom(field);\n\n if (!fieldSettings.hasFields()) {\n fieldSettings.logMissingFields();\n return null;\n }\n\n const settings = fieldSettings.getSettings();\n\n return (\n <RootAccordion>\n <AccordionItem title={field.label} description={field.helpText}>\n <DynamicSection\n {...props}\n emptyValue={{}}\n showLabel={false}\n gridClassName={dynamicSectionGridStyle}\n >\n {({ Bind, bind, index }) => (\n <ObjectItem>\n {highlightMap[index] ? (\n <ItemHighLight key={highlightMap[index]} />\n ) : null}\n <Accordion\n title={`${props.field.label} #${index + 1}`}\n action={\n <Actions\n setHighlightIndex={setHighlightIndex}\n index={index}\n bind={bind}\n />\n }\n // Open first Accordion by default\n defaultValue={index === 0}\n >\n <Cell span={12} className={fieldsWrapperStyle}>\n <ParentFieldProvider\n value={bind.index.value}\n path={Bind.parentName}\n >\n <Fields\n Bind={Bind}\n contentModel={contentModel}\n fields={settings.fields}\n layout={settings.layout}\n gridClassName={fieldsGridStyle}\n />\n </ParentFieldProvider>\n </Cell>\n </Accordion>\n </ObjectItem>\n )}\n </DynamicSection>\n </AccordionItem>\n </RootAccordion>\n );\n};\n\nconst plugin: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-objects-accordion\",\n renderer: {\n rendererName: \"objects-accordion\",\n name: t`Accordion`,\n description: t`Renders fields within an accordion.`,\n canUse({ field }) {\n return field.type === \"object\" && Boolean(field.multipleValues);\n },\n render(props) {\n return <ObjectsRenderer {...props} />;\n }\n }\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAMA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAL,sBAAA,CAAAN,OAAA;AACA,IAAAY,iBAAA,GAAAZ,OAAA;AAOA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,cAAA,GAAAd,OAAA;AACA,IAAAe,YAAA,GAAAf,OAAA;AAAsF,IAAAgB,eAAA,EAAAC,gBAAA;AAEtF,IAAMC,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,oCAAoC,CAAC;AAWvD,IAAMC,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAAyD;EAAA,IAAnDC,iBAAiB,GAAAD,IAAA,CAAjBC,iBAAiB;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAEC,KAAK,GAAAH,IAAA,CAALG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,10 @@ exports.default = void 0;
|
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _i18n = require("@webiny/app/i18n");
|
|
11
|
-
var _Fields = require("../../../components/ContentEntryForm/Fields");
|
|
12
11
|
var _Accordion = require("@webiny/ui/Accordion");
|
|
12
|
+
var _Fields = require("../../../components/ContentEntryForm/Fields");
|
|
13
13
|
var _FieldSettings = require("./FieldSettings");
|
|
14
|
+
var _hooks = require("../../../hooks");
|
|
14
15
|
var _templateObject, _templateObject2;
|
|
15
16
|
var t = _i18n.i18n.ns("app-headless-cms/admin/fields/text");
|
|
16
17
|
var plugin = {
|
|
@@ -35,15 +36,20 @@ var plugin = {
|
|
|
35
36
|
return null;
|
|
36
37
|
}
|
|
37
38
|
var settings = fieldSettings.getSettings();
|
|
38
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(Bind, null, function (bindProps) {
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_hooks.ParentFieldProvider, {
|
|
41
|
+
value: bindProps.value,
|
|
42
|
+
path: Bind.parentName
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_Accordion.Accordion, null, /*#__PURE__*/_react.default.createElement(_Accordion.AccordionItem, {
|
|
44
|
+
title: field.label,
|
|
45
|
+
description: field.helpText
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_Fields.Fields, {
|
|
47
|
+
Bind: Bind,
|
|
48
|
+
contentModel: contentModel,
|
|
49
|
+
fields: settings.fields || [],
|
|
50
|
+
layout: settings.layout || []
|
|
51
|
+
}))));
|
|
52
|
+
});
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_i18n","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_i18n","_Accordion","_Fields","_FieldSettings","_hooks","_templateObject","_templateObject2","t","i18n","ns","plugin","type","name","renderer","rendererName","_taggedTemplateLiteral2","default","description","canUse","_ref","field","multipleValues","render","_ref2","getBind","contentModel","Bind","fieldSettings","FieldSettings","createFrom","hasFields","logMissingFields","settings","getSettings","createElement","bindProps","ParentFieldProvider","value","path","parentName","Accordion","AccordionItem","title","label","helpText","Fields","fields","layout","_default","exports"],"sources":["singleObjectAccordion.tsx"],"sourcesContent":["import React from \"react\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { Accordion, AccordionItem } from \"@webiny/ui/Accordion\";\nimport { CmsModelFieldRendererPlugin } from \"~/types\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\nimport { FieldSettings } from \"./FieldSettings\";\nimport { ParentFieldProvider } from \"~/admin/hooks\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/text\");\n\nconst plugin: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-object-accordion\",\n renderer: {\n rendererName: \"object-accordion\",\n name: t`Accordion`,\n description: t`Renders fields within an accordion.`,\n canUse({ field }) {\n return field.type === \"object\" && !field.multipleValues;\n },\n render({ field, getBind, contentModel }) {\n const Bind = getBind();\n\n const fieldSettings = FieldSettings.createFrom(field);\n\n if (!fieldSettings.hasFields()) {\n fieldSettings.logMissingFields();\n return null;\n }\n\n const settings = fieldSettings.getSettings();\n\n return (\n <Bind>\n {bindProps => (\n <ParentFieldProvider value={bindProps.value} path={Bind.parentName}>\n <Accordion>\n <AccordionItem title={field.label} description={field.helpText}>\n <Fields\n Bind={Bind}\n contentModel={contentModel}\n fields={settings.fields || []}\n layout={settings.layout || []}\n />\n </AccordionItem>\n </Accordion>\n </ParentFieldProvider>\n )}\n </Bind>\n );\n }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QAAQ,GAAGL,aAAa,CAACM,WAAW,CAAC,CAAC;MAE5C,oBACIpC,MAAA,CAAAmB,OAAA,CAAAkB,aAAA,CAACR,IAAI,QACA,UAAAS,SAAS;QAAA,oBACNtC,MAAA,CAAAmB,OAAA,CAAAkB,aAAA,CAAC9B,MAAA,CAAAgC,mBAAmB;UAACC,KAAK,EAAEF,SAAS,CAACE,KAAM;UAACC,IAAI,EAAEZ,IAAI,CAACa;QAAW,gBAC/D1C,MAAA,CAAAmB,OAAA,CAAAkB,aAAA,CAACjC,UAAA,CAAAuC,SAAS,qBACN3C,MAAA,CAAAmB,OAAA,CAAAkB,aAAA,CAACjC,UAAA,CAAAwC,aAAa;UAACC,KAAK,EAAEtB,KAAK,CAACuB,KAAM;UAAC1B,WAAW,EAAEG,KAAK,CAACwB;QAAS,gBAC3D/C,MAAA,CAAAmB,OAAA,CAAAkB,aAAA,CAAChC,OAAA,CAAA2C,MAAM;UACHnB,IAAI,EAAEA,IAAK;UACXD,YAAY,EAAEA,YAAa;UAC3BqB,MAAM,EAAEd,QAAQ,CAACc,MAAM,IAAI,EAAG;UAC9BC,MAAM,EAAEf,QAAQ,CAACe,MAAM,IAAI;QAAG,CACjC,CACU,CACR,CACM,CAAC;MAAA,CAExB,CAAC;IAEf;EACJ;AACJ,CAAC;AAAC,IAAAC,QAAA,GAEatC,MAAM;AAAAuC,OAAA,CAAAjC,OAAA,GAAAgC,QAAA"}
|
|
@@ -14,6 +14,7 @@ var _Grid = require("@webiny/ui/Grid");
|
|
|
14
14
|
var _FormElementMessage = require("@webiny/ui/FormElementMessage");
|
|
15
15
|
var _StyledComponents = require("./StyledComponents");
|
|
16
16
|
var _FieldSettings = require("./FieldSettings");
|
|
17
|
+
var _ParentValue = require("../../../components/ContentEntryForm/ParentValue");
|
|
17
18
|
var _templateObject, _templateObject2;
|
|
18
19
|
var t = _i18n.i18n.ns("app-headless-cms/admin/fields/text");
|
|
19
20
|
var plugin = {
|
|
@@ -38,19 +39,24 @@ var plugin = {
|
|
|
38
39
|
return null;
|
|
39
40
|
}
|
|
40
41
|
var settings = fieldSettings.getSettings();
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(Bind, null, function (bindProps) {
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_ParentValue.ParentFieldProvider, {
|
|
44
|
+
value: bindProps.value,
|
|
45
|
+
path: Bind.parentName
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_Grid.Grid, null, /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
47
|
+
span: 12
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement(_SimpleForm.SimpleFormHeader, {
|
|
49
|
+
title: field.label
|
|
50
|
+
}), field.helpText && /*#__PURE__*/_react.default.createElement(_FormElementMessage.FormElementMessage, null, field.helpText)), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
51
|
+
span: 12,
|
|
52
|
+
className: _StyledComponents.fieldsWrapperStyle
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_Fields.Fields, {
|
|
54
|
+
Bind: Bind,
|
|
55
|
+
contentModel: contentModel,
|
|
56
|
+
fields: settings.fields,
|
|
57
|
+
layout: settings.layout
|
|
58
|
+
}))));
|
|
59
|
+
});
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_i18n","_Fields","_SimpleForm","_Grid","_FormElementMessage","_StyledComponents","_FieldSettings","_templateObject","_templateObject2","t","i18n","ns","plugin","type","name","renderer","rendererName","_taggedTemplateLiteral2","default","description","canUse","_ref","field","multipleValues","render","_ref2","getBind","contentModel","Bind","fieldSettings","FieldSettings","createFrom","hasFields","logMissingFields","settings","getSettings","createElement","Grid","Cell","span","SimpleFormHeader","title","label","helpText","FormElementMessage","className","fieldsWrapperStyle","Fields","fields","layout","_default","exports"],"sources":["singleObjectInline.tsx"],"sourcesContent":["import React from \"react\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { CmsModelFieldRendererPlugin } from \"~/types\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\nimport { SimpleFormHeader } from \"@webiny/app-admin/components/SimpleForm\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { FormElementMessage } from \"@webiny/ui/FormElementMessage\";\nimport { fieldsWrapperStyle } from \"./StyledComponents\";\nimport { FieldSettings } from \"./FieldSettings\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/text\");\n\nconst plugin: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-object\",\n renderer: {\n rendererName: \"object\",\n name: t`Inline Form`,\n description: t`Renders a set of fields.`,\n canUse({ field }) {\n return field.type === \"object\" && !field.multipleValues;\n },\n render({ field, getBind, contentModel }) {\n const Bind = getBind();\n\n const fieldSettings = FieldSettings.createFrom(field);\n\n if (!fieldSettings.hasFields()) {\n fieldSettings.logMissingFields();\n return null;\n }\n\n const settings = fieldSettings.getSettings();\n\n return (\n <
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_i18n","_Fields","_SimpleForm","_Grid","_FormElementMessage","_StyledComponents","_FieldSettings","_ParentValue","_templateObject","_templateObject2","t","i18n","ns","plugin","type","name","renderer","rendererName","_taggedTemplateLiteral2","default","description","canUse","_ref","field","multipleValues","render","_ref2","getBind","contentModel","Bind","fieldSettings","FieldSettings","createFrom","hasFields","logMissingFields","settings","getSettings","createElement","bindProps","ParentFieldProvider","value","path","parentName","Grid","Cell","span","SimpleFormHeader","title","label","helpText","FormElementMessage","className","fieldsWrapperStyle","Fields","fields","layout","_default","exports"],"sources":["singleObjectInline.tsx"],"sourcesContent":["import React from \"react\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { CmsModelFieldRendererPlugin } from \"~/types\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\nimport { SimpleFormHeader } from \"@webiny/app-admin/components/SimpleForm\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { FormElementMessage } from \"@webiny/ui/FormElementMessage\";\nimport { fieldsWrapperStyle } from \"./StyledComponents\";\nimport { FieldSettings } from \"./FieldSettings\";\nimport { ParentFieldProvider } from \"~/admin/components/ContentEntryForm/ParentValue\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/fields/text\");\n\nconst plugin: CmsModelFieldRendererPlugin = {\n type: \"cms-editor-field-renderer\",\n name: \"cms-editor-field-renderer-object\",\n renderer: {\n rendererName: \"object\",\n name: t`Inline Form`,\n description: t`Renders a set of fields.`,\n canUse({ field }) {\n return field.type === \"object\" && !field.multipleValues;\n },\n render({ field, getBind, contentModel }) {\n const Bind = getBind();\n\n const fieldSettings = FieldSettings.createFrom(field);\n\n if (!fieldSettings.hasFields()) {\n fieldSettings.logMissingFields();\n return null;\n }\n\n const settings = fieldSettings.getSettings();\n\n return (\n <Bind>\n {bindProps => (\n <ParentFieldProvider value={bindProps.value} path={Bind.parentName}>\n <Grid>\n <Cell span={12}>\n <SimpleFormHeader title={field.label} />\n {field.helpText && (\n <FormElementMessage>{field.helpText}</FormElementMessage>\n )}\n </Cell>\n <Cell span={12} className={fieldsWrapperStyle}>\n <Fields\n Bind={Bind}\n contentModel={contentModel}\n fields={settings.fields}\n layout={settings.layout}\n />\n </Cell>\n </Grid>\n </ParentFieldProvider>\n )}\n </Bind>\n );\n }\n }\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,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AA,CAACR,IAAI,QACA,UAAAS,SAAS;QAAA,oBACNzC,MAAA,CAAAsB,OAAA,CAAAkB,aAAA,CAAC9B,YAAA,CAAAgC,mBAAmB;UAACC,KAAK,EAAEF,SAAS,CAACE,KAAM;UAACC,IAAI,EAAEZ,IAAI,CAACa;QAAW,gBAC/D7C,MAAA,CAAAsB,OAAA,CAAAkB,aAAA,CAAClC,KAAA,CAAAwC,IAAI,qBACD9C,MAAA,CAAAsB,OAAA,CAAAkB,aAAA,CAAClC,KAAA,CAAAyC,IAAI;UAACC,IAAI,EAAE;QAAG,gBACXhD,MAAA,CAAAsB,OAAA,CAAAkB,aAAA,CAACnC,WAAA,CAAA4C,gBAAgB;UAACC,KAAK,EAAExB,KAAK,CAACyB;QAAM,CAAE,CAAC,EACvCzB,KAAK,CAAC0B,QAAQ,iBACXpD,MAAA,CAAAsB,OAAA,CAAAkB,aAAA,CAACjC,mBAAA,CAAA8C,kBAAkB,QAAE3B,KAAK,CAAC0B,QAA6B,CAE1D,CAAC,eACPpD,MAAA,CAAAsB,OAAA,CAAAkB,aAAA,CAAClC,KAAA,CAAAyC,IAAI;UAACC,IAAI,EAAE,EAAG;UAACM,SAAS,EAAEC;QAAmB,gBAC1CvD,MAAA,CAAAsB,OAAA,CAAAkB,aAAA,CAACpC,OAAA,CAAAoD,MAAM;UACHxB,IAAI,EAAEA,IAAK;UACXD,YAAY,EAAEA,YAAa;UAC3B0B,MAAM,EAAEnB,QAAQ,CAACmB,MAAO;UACxBC,MAAM,EAAEpB,QAAQ,CAACoB;QAAO,CAC3B,CACC,CACJ,CACW,CAAC;MAAA,CAExB,CAAC;IAEf;EACJ;AACJ,CAAC;AAAC,IAAAC,QAAA,GAEa3C,MAAM;AAAA4C,OAAA,CAAAtC,OAAA,GAAAqC,QAAA"}
|
|
@@ -18,6 +18,7 @@ var _utils = require("@webiny/utils");
|
|
|
18
18
|
var _IconPicker = require("../../../components/IconPicker");
|
|
19
19
|
var _Dialog = require("../../../components/Dialog");
|
|
20
20
|
var _Alert = require("@webiny/ui/Alert");
|
|
21
|
+
var _Tags = require("@webiny/ui/Tags");
|
|
21
22
|
var typeNameValidator = function typeNameValidator(value) {
|
|
22
23
|
var regex = new RegExp("^[A-Z]+[_0-9A-Za-z]+$");
|
|
23
24
|
if (regex.test(value)) {
|
|
@@ -130,6 +131,13 @@ var TemplateDialog = function TemplateDialog(props) {
|
|
|
130
131
|
}, /*#__PURE__*/_react.default.createElement(_Input.Input, {
|
|
131
132
|
rows: 3,
|
|
132
133
|
label: "Description"
|
|
134
|
+
}))), /*#__PURE__*/_react.default.createElement(_Grid.Cell, {
|
|
135
|
+
span: 12
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement(Bind, {
|
|
137
|
+
name: "tags",
|
|
138
|
+
defaultValue: []
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement(_Tags.Tags, {
|
|
140
|
+
label: "Tags"
|
|
133
141
|
}))))), /*#__PURE__*/_react.default.createElement(_Dialog.DialogActions, null, /*#__PURE__*/_react.default.createElement(_Button.ButtonDefault, {
|
|
134
142
|
onClick: props.onClose
|
|
135
143
|
}, "Cancel"), /*#__PURE__*/_react.default.createElement(_Button.ButtonPrimary, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_Button","_Grid","_Input","_form","_validation","_utils","_IconPicker","_Dialog","_Alert","typeNameValidator","value","regex","RegExp","test","Error","getGraphQLTypeName","titleCase","charAt","toUpperCase","slice","replace","TemplateDialog","props","_useState","useState","_useState2","_slicedToArray2","default","showWarning","setWarning","newTemplate","Boolean","template","dialogTitle","submitLabel","onSubmit","id","onTemplate","_objectSpread2","generateAlphaNumericLowerCaseId","fields","layout","onClose","showGqlTypeNameWarning","hideGqlTypeNameWarning","checkGqlType","data","gqlTypeName","nameOnBlur","form","name","setValue","onFormChange","createElement","Dialog","open","Form","onChange","_ref","Bind","submit","Fragment","DialogTitle","DialogContent","Grid","Cell","span","Alert","title","type","validators","validation","create","Input","label","onBlur","autoFocus","description","IconPicker","rows","DialogActions","ButtonDefault","onClick","ButtonPrimary","exports"],"sources":["TemplateDialog.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { ButtonPrimary, ButtonDefault } from \"@webiny/ui/Button\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Form, FormAPI, FormOnSubmit } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { CmsDynamicZoneTemplate } from \"~/types\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\nimport { IconPicker } from \"~/admin/components/IconPicker\";\nimport { Dialog, DialogTitle, DialogContent, DialogActions } from \"~/admin/components/Dialog\";\nimport { Alert } from \"@webiny/ui/Alert\";\n\nconst typeNameValidator = (value: string) => {\n const regex = new RegExp(\"^[A-Z]+[_0-9A-Za-z]+$\");\n if (regex.test(value)) {\n return true;\n }\n\n throw Error(\n `Must start with a capital letter, may contain numbers, and must not contain spaces.`\n );\n};\n\nconst getGraphQLTypeName = (value: string) => {\n const titleCase = value.charAt(0).toUpperCase() + value.slice(1);\n return titleCase.replace(/[^a-zA-Z0-9]/g, \"\");\n};\n\ninterface TemplateDialogProps {\n onClose: () => void;\n template?: CmsDynamicZoneTemplate;\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n}\n\nexport const TemplateDialog = (props: TemplateDialogProps) => {\n const [showWarning, setWarning] = useState(false);\n const newTemplate = !Boolean(props.template);\n const dialogTitle = newTemplate ? \"Add Template\" : \"Edit Template\";\n const submitLabel = newTemplate ? \"Add Template\" : \"Update Template\";\n\n const onSubmit: FormOnSubmit<CmsDynamicZoneTemplate> = template => {\n if (template.id) {\n props.onTemplate(template);\n } else {\n props.onTemplate({\n ...template,\n id: generateAlphaNumericLowerCaseId(),\n fields: [],\n layout: []\n });\n }\n props.onClose();\n };\n\n const showGqlTypeNameWarning = () => {\n setWarning(true);\n };\n\n const hideGqlTypeNameWarning = () => {\n setWarning(false);\n };\n\n const checkGqlType: FormOnSubmit<CmsDynamicZoneTemplate> = data => {\n if (newTemplate) {\n return;\n }\n\n if (data.gqlTypeName !== props.template?.gqlTypeName) {\n showGqlTypeNameWarning();\n } else {\n hideGqlTypeNameWarning();\n }\n };\n\n const nameOnBlur = (form: FormAPI<CmsDynamicZoneTemplate>) => () => {\n if (!form.data.gqlTypeName) {\n /**\n * There is a possibility that name is undefined, so let's check for it.\n */\n const name = form.data.name;\n if (!name) {\n return;\n }\n form.setValue(\"gqlTypeName\", getGraphQLTypeName(name));\n }\n };\n\n const onFormChange: FormOnSubmit<CmsDynamicZoneTemplate> = (data, form) => {\n checkGqlType(data, form);\n };\n\n return (\n <Dialog open={true} onClose={props.onClose}>\n <Form<CmsDynamicZoneTemplate>\n onSubmit={onSubmit}\n data={props.template}\n onChange={onFormChange}\n >\n {({ Bind, submit, form }) => (\n <>\n <DialogTitle>{dialogTitle}</DialogTitle>\n <DialogContent>\n <Grid>\n {showWarning ? (\n <Cell span={12}>\n <Alert title={\"GraphQL Schema Change\"} type={\"danger\"}>\n You've changed the GraphQL schema type name! If\n your API is being queried by a 3rd party application,\n this will affect the GraphQL queries in those\n applications. Make sure your consumers are informed\n about this change!\n </Alert>\n </Cell>\n ) : null}\n <Cell span={12}>\n <Bind\n name={\"name\"}\n validators={[validation.create(\"required\")]}\n >\n <Input label={\"Name\"} onBlur={nameOnBlur(form)} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"gqlTypeName\"}\n validators={[\n validation.create(\"required\"),\n typeNameValidator\n ]}\n >\n <Input\n autoFocus={false}\n label={\"GraphQL Type Name\"}\n description={\n \"This string will be used to generate the GraphQL schema. \"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"icon\"}\n validators={[validation.create(\"required\")]}\n >\n <IconPicker label={\"Icon\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"description\"}\n validators={[validation.create(\"required\")]}\n >\n <Input rows={3} label={\"Description\"} />\n </Bind>\n </Cell>\n </Grid>\n </DialogContent>\n <DialogActions>\n <ButtonDefault onClick={props.onClose}>Cancel</ButtonDefault>\n <ButtonPrimary onClick={submit}>{submitLabel}</ButtonPrimary>\n </DialogActions>\n </>\n )}\n </Form>\n </Dialog>\n );\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAEA,IAAMU,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,KAAa,EAAK;EACzC,IAAMC,KAAK,GAAG,IAAIC,MAAM,CAAC,uBAAuB,CAAC;EACjD,IAAID,KAAK,CAACE,IAAI,CAACH,KAAK,CAAC,EAAE;IACnB,OAAO,IAAI;EACf;EAEA,MAAMI,KAAK,sFAEX,CAAC;AACL,CAAC;AAED,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIL,KAAa,EAAK;EAC1C,IAAMM,SAAS,GAAGN,KAAK,CAACO,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGR,KAAK,CAACS,KAAK,CAAC,CAAC,CAAC;EAChE,OAAOH,SAAS,CAACI,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;AACjD,CAAC;AAQM,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAA0B,EAAK;EAC1D,IAAAC,SAAA,GAAkC,IAAAC,eAAQ,EAAC,KAAK,CAAC;IAAAC,UAAA,OAAAC,eAAA,CAAAC,OAAA,E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,EAAE,CAACC,sBAAU,CAACC,MAAM,CAAC,UAAU,CAAC;IAAE,gBAE5C3E,MAAA,CAAA8B,OAAA,CAAA0B,aAAA,CAAC/C,WAAA,CAAAwE,UAAU;MAACJ,KAAK,EAAE;IAAO,CAAE,CAC1B,CACJ,CAAC,eACP7E,MAAA,CAAA8B,OAAA,CAAA0B,aAAA,CAACpD,KAAA,CAAAgE,IAAI;MAACC,IAAI,EAAE;IAAG,gBACXrE,MAAA,CAAA8B,OAAA,CAAA0B,aAAA,CAACM,IAAI;MACDT,IAAI,EAAE,aAAc;MACpBoB,UAAU,EAAE,CAACC,sBAAU,CAACC,MAAM,CAAC,UAAU,CAAC;IAAE,gBAE5C3E,MAAA,CAAA8B,OAAA,CAAA0B,aAAA,CAACnD,MAAA,CAAAuE,KAAK;MAACM,IAAI,EAAE,CAAE;MAACL,KAAK,EAAE;IAAc,CAAE,CACrC,CACJ,CACJ,CACK,CAAC,eAChB7E,MAAA,CAAA8B,OAAA,CAAA0B,aAAA,CAAC9C,OAAA,CAAAyE,aAAa,qBACVnF,MAAA,CAAA8B,OAAA,CAAA0B,aAAA,CAACrD,OAAA,CAAAiF,aAAa;MAACC,OAAO,EAAE5D,KAAK,CAACoB;IAAQ,GAAC,QAAqB,CAAC,eAC7D7C,MAAA,CAAA8B,OAAA,CAAA0B,aAAA,CAACrD,OAAA,CAAAmF,aAAa;MAACD,OAAO,EAAEtB;IAAO,GAAE1B,WAA2B,CACjD,CACjB,CAAC;EAAA,CAEL,CACF,CAAC;AAEjB,CAAC;AAACkD,OAAA,CAAA/D,cAAA,GAAAA,cAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_Button","_Grid","_Input","_form","_validation","_utils","_IconPicker","_Dialog","_Alert","_Tags","typeNameValidator","value","regex","RegExp","test","Error","getGraphQLTypeName","titleCase","charAt","toUpperCase","slice","replace","TemplateDialog","props","_useState","useState","_useState2","_slicedToArray2","default","showWarning","setWarning","newTemplate","Boolean","template","dialogTitle","submitLabel","onSubmit","id","onTemplate","_objectSpread2","generateAlphaNumericLowerCaseId","fields","layout","onClose","showGqlTypeNameWarning","hideGqlTypeNameWarning","checkGqlType","data","gqlTypeName","nameOnBlur","form","name","setValue","onFormChange","createElement","Dialog","open","Form","onChange","_ref","Bind","submit","Fragment","DialogTitle","DialogContent","Grid","Cell","span","Alert","title","type","validators","validation","create","Input","label","onBlur","autoFocus","description","IconPicker","rows","defaultValue","Tags","DialogActions","ButtonDefault","onClick","ButtonPrimary","exports"],"sources":["TemplateDialog.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { ButtonPrimary, ButtonDefault } from \"@webiny/ui/Button\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Form, FormAPI, FormOnSubmit } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { CmsDynamicZoneTemplate } from \"~/types\";\nimport { generateAlphaNumericLowerCaseId } from \"@webiny/utils\";\nimport { IconPicker } from \"~/admin/components/IconPicker\";\nimport { Dialog, DialogTitle, DialogContent, DialogActions } from \"~/admin/components/Dialog\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { Tags } from \"@webiny/ui/Tags\";\n\nconst typeNameValidator = (value: string) => {\n const regex = new RegExp(\"^[A-Z]+[_0-9A-Za-z]+$\");\n if (regex.test(value)) {\n return true;\n }\n\n throw Error(\n `Must start with a capital letter, may contain numbers, and must not contain spaces.`\n );\n};\n\nconst getGraphQLTypeName = (value: string) => {\n const titleCase = value.charAt(0).toUpperCase() + value.slice(1);\n return titleCase.replace(/[^a-zA-Z0-9]/g, \"\");\n};\n\ninterface TemplateDialogProps {\n onClose: () => void;\n template?: CmsDynamicZoneTemplate;\n onTemplate: (template: CmsDynamicZoneTemplate) => void;\n}\n\nexport const TemplateDialog = (props: TemplateDialogProps) => {\n const [showWarning, setWarning] = useState(false);\n const newTemplate = !Boolean(props.template);\n const dialogTitle = newTemplate ? \"Add Template\" : \"Edit Template\";\n const submitLabel = newTemplate ? \"Add Template\" : \"Update Template\";\n\n const onSubmit: FormOnSubmit<CmsDynamicZoneTemplate> = template => {\n if (template.id) {\n props.onTemplate(template);\n } else {\n props.onTemplate({\n ...template,\n id: generateAlphaNumericLowerCaseId(),\n fields: [],\n layout: []\n });\n }\n props.onClose();\n };\n\n const showGqlTypeNameWarning = () => {\n setWarning(true);\n };\n\n const hideGqlTypeNameWarning = () => {\n setWarning(false);\n };\n\n const checkGqlType: FormOnSubmit<CmsDynamicZoneTemplate> = data => {\n if (newTemplate) {\n return;\n }\n\n if (data.gqlTypeName !== props.template?.gqlTypeName) {\n showGqlTypeNameWarning();\n } else {\n hideGqlTypeNameWarning();\n }\n };\n\n const nameOnBlur = (form: FormAPI<CmsDynamicZoneTemplate>) => () => {\n if (!form.data.gqlTypeName) {\n /**\n * There is a possibility that name is undefined, so let's check for it.\n */\n const name = form.data.name;\n if (!name) {\n return;\n }\n form.setValue(\"gqlTypeName\", getGraphQLTypeName(name));\n }\n };\n\n const onFormChange: FormOnSubmit<CmsDynamicZoneTemplate> = (data, form) => {\n checkGqlType(data, form);\n };\n\n return (\n <Dialog open={true} onClose={props.onClose}>\n <Form<CmsDynamicZoneTemplate>\n onSubmit={onSubmit}\n data={props.template}\n onChange={onFormChange}\n >\n {({ Bind, submit, form }) => (\n <>\n <DialogTitle>{dialogTitle}</DialogTitle>\n <DialogContent>\n <Grid>\n {showWarning ? (\n <Cell span={12}>\n <Alert title={\"GraphQL Schema Change\"} type={\"danger\"}>\n You've changed the GraphQL schema type name! If\n your API is being queried by a 3rd party application,\n this will affect the GraphQL queries in those\n applications. Make sure your consumers are informed\n about this change!\n </Alert>\n </Cell>\n ) : null}\n <Cell span={12}>\n <Bind\n name={\"name\"}\n validators={[validation.create(\"required\")]}\n >\n <Input label={\"Name\"} onBlur={nameOnBlur(form)} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"gqlTypeName\"}\n validators={[\n validation.create(\"required\"),\n typeNameValidator\n ]}\n >\n <Input\n autoFocus={false}\n label={\"GraphQL Type Name\"}\n description={\n \"This string will be used to generate the GraphQL schema. \"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"icon\"}\n validators={[validation.create(\"required\")]}\n >\n <IconPicker label={\"Icon\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name={\"description\"}\n validators={[validation.create(\"required\")]}\n >\n <Input rows={3} label={\"Description\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind name={\"tags\"} defaultValue={[]}>\n <Tags label={\"Tags\"} />\n </Bind>\n </Cell>\n </Grid>\n </DialogContent>\n <DialogActions>\n <ButtonDefault onClick={props.onClose}>Cancel</ButtonDefault>\n <ButtonPrimary onClick={submit}>{submitLabel}</ButtonPrimary>\n </DialogActions>\n </>\n )}\n </Form>\n </Dialog>\n );\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AAEA,IAAMW,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,KAAa,EAAK;EACzC,IAAMC,KAAK,GAAG,IAAIC,MAAM,CAAC,uBAAuB,CAAC;EACjD,IAAID,KAAK,CAACE,IAAI,CAACH,KAAK,CAAC,EAAE;IACnB,OAAO,IAAI;EACf;EAEA,MAAMI,KAAK,sFAEX,CAAC;AACL,CAAC;AAED,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,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,KAAK,EAAE;IAAO,CAAE,CACpB,CACJ,CACJ,CACK,CAAC,eAChB9E,MAAA,CAAA+B,OAAA,CAAA0B,aAAA,CAAC/C,OAAA,CAAA4E,aAAa,qBACVtF,MAAA,CAAA+B,OAAA,CAAA0B,aAAA,CAACtD,OAAA,CAAAoF,aAAa;MAACC,OAAO,EAAE9D,KAAK,CAACoB;IAAQ,GAAC,QAAqB,CAAC,eAC7D9C,MAAA,CAAA+B,OAAA,CAAA0B,aAAA,CAACtD,OAAA,CAAAsF,aAAa;MAACD,OAAO,EAAExB;IAAO,GAAE1B,WAA2B,CACjD,CACjB,CAAC;EAAA,CAEL,CACF,CAAC;AAEjB,CAAC;AAACoD,OAAA,CAAAjE,cAAA,GAAAA,cAAA"}
|
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;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const PublishEntryRevisionListItem: import("@webiny/react-composition").
|
|
2
|
+
export declare const PublishEntryRevisionListItem: import("@webiny/react-composition").GenericComponent<any> & {
|
|
3
|
+
original: import("@webiny/react-composition").GenericComponent<any>;
|
|
4
|
+
originalName: string;
|
|
5
|
+
} & {
|
|
6
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: any) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
7
|
+
};
|
|
@@ -10,4 +10,9 @@ export interface OptionsMenuProps {
|
|
|
10
10
|
items: OptionsMenuItem[];
|
|
11
11
|
"data-testid"?: string;
|
|
12
12
|
}
|
|
13
|
-
export declare const OptionsMenu: import("@webiny/app-admin").
|
|
13
|
+
export declare const OptionsMenu: import("@webiny/app-admin").GenericComponent<OptionsMenuProps> & {
|
|
14
|
+
original: import("@webiny/app-admin").GenericComponent<OptionsMenuProps>;
|
|
15
|
+
originalName: string;
|
|
16
|
+
} & {
|
|
17
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(args_0: OptionsMenuProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
18
|
+
};
|
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
CHANGED
|
@@ -1,12 +1,87 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { useTemplate } from "./admin/plugins/fieldRenderers/dynamicZone";
|
|
2
3
|
export declare const Components: {
|
|
3
4
|
FieldRenderers: {
|
|
4
5
|
DynamicZone: {
|
|
5
|
-
|
|
6
|
+
Template: {
|
|
7
|
+
useTemplate: typeof useTemplate;
|
|
8
|
+
};
|
|
9
|
+
Container: import("@webiny/react-composition").GenericComponent<any> & {
|
|
10
|
+
original: import("@webiny/react-composition").GenericComponent<any>;
|
|
11
|
+
originalName: string;
|
|
12
|
+
} & {
|
|
13
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: any) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
14
|
+
};
|
|
6
15
|
MultiValue: {
|
|
7
|
-
Container: import("@webiny/react-composition").
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
Container: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueContainerProps> & {
|
|
17
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueContainerProps>;
|
|
18
|
+
originalName: string;
|
|
19
|
+
} & {
|
|
20
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
ItemContainer: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemContainerProps> & {
|
|
23
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemContainerProps>;
|
|
24
|
+
originalName: string;
|
|
25
|
+
} & {
|
|
26
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
27
|
+
};
|
|
28
|
+
Item: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemItemProps> & {
|
|
29
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemItemProps>;
|
|
30
|
+
originalName: string;
|
|
31
|
+
} & {
|
|
32
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone").MultiValueItemItemProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
TemplateGallery: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryProps & {
|
|
36
|
+
children?: import("react").ReactNode;
|
|
37
|
+
}> & {
|
|
38
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryProps & {
|
|
39
|
+
children?: import("react").ReactNode;
|
|
40
|
+
}>;
|
|
41
|
+
originalName: string;
|
|
42
|
+
} & {
|
|
43
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").ShouldRender) => JSX.Element;
|
|
44
|
+
} & {
|
|
45
|
+
Container: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryContainerProps & {
|
|
46
|
+
children?: import("react").ReactNode;
|
|
47
|
+
}> & {
|
|
48
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryContainerProps & {
|
|
49
|
+
children?: import("react").ReactNode;
|
|
50
|
+
}>;
|
|
51
|
+
originalName: string;
|
|
52
|
+
} & {
|
|
53
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryContainerProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").ShouldRender) => JSX.Element;
|
|
54
|
+
};
|
|
55
|
+
List: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryListProps & {
|
|
56
|
+
children?: import("react").ReactNode;
|
|
57
|
+
}> & {
|
|
58
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryListProps & {
|
|
59
|
+
children?: import("react").ReactNode;
|
|
60
|
+
}>;
|
|
61
|
+
originalName: string;
|
|
62
|
+
} & {
|
|
63
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").TemplateGalleryListProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").ShouldRender) => JSX.Element;
|
|
64
|
+
};
|
|
65
|
+
Item: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateItem").TemplateCardProps & {
|
|
66
|
+
children?: import("react").ReactNode;
|
|
67
|
+
}> & {
|
|
68
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateItem").TemplateCardProps & {
|
|
69
|
+
children?: import("react").ReactNode;
|
|
70
|
+
}>;
|
|
71
|
+
originalName: string;
|
|
72
|
+
} & {
|
|
73
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateItem").TemplateCardProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").ShouldRender) => JSX.Element;
|
|
74
|
+
};
|
|
75
|
+
Close: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").CloseGalleryProps & {
|
|
76
|
+
children?: import("react").ReactNode;
|
|
77
|
+
}> & {
|
|
78
|
+
original: import("@webiny/react-composition").GenericComponent<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").CloseGalleryProps & {
|
|
79
|
+
children?: import("react").ReactNode;
|
|
80
|
+
}>;
|
|
81
|
+
originalName: string;
|
|
82
|
+
} & {
|
|
83
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("react").PropsWithChildren<import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").CloseGalleryProps>, context?: any) => import("react").ReactElement<any, any> | null>) => (props: import("./admin/plugins/fieldRenderers/dynamicZone/TemplateGallery").ShouldRender) => JSX.Element;
|
|
84
|
+
};
|
|
10
85
|
};
|
|
11
86
|
};
|
|
12
87
|
};
|
package/components.js
CHANGED
|
@@ -8,6 +8,9 @@ var _dynamicZone = require("./admin/plugins/fieldRenderers/dynamicZone");
|
|
|
8
8
|
var Components = {
|
|
9
9
|
FieldRenderers: {
|
|
10
10
|
DynamicZone: {
|
|
11
|
+
Template: {
|
|
12
|
+
useTemplate: _dynamicZone.useTemplate
|
|
13
|
+
},
|
|
11
14
|
Container: _dynamicZone.DynamicZoneContainer,
|
|
12
15
|
// SingleValue: {
|
|
13
16
|
// Container: null,
|
|
@@ -18,7 +21,8 @@ var Components = {
|
|
|
18
21
|
Container: _dynamicZone.MultiValueContainer,
|
|
19
22
|
ItemContainer: _dynamicZone.MultiValueItemContainer,
|
|
20
23
|
Item: _dynamicZone.MultiValueItem
|
|
21
|
-
}
|
|
24
|
+
},
|
|
25
|
+
TemplateGallery: _dynamicZone.TemplateGallery
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
28
|
};
|
package/components.js.map
CHANGED
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"names":["_dynamicZone","require","Components","FieldRenderers","DynamicZone","Template","useTemplate","Container","DynamicZoneContainer","MultiValue","MultiValueContainer","ItemContainer","MultiValueItemContainer","Item","MultiValueItem","TemplateGallery","exports"],"sources":["components.ts"],"sourcesContent":["import {\n DynamicZoneContainer,\n MultiValueContainer,\n MultiValueItemContainer,\n MultiValueItem,\n TemplateGallery,\n useTemplate\n} from \"~/admin/plugins/fieldRenderers/dynamicZone\";\n\nexport const Components = {\n FieldRenderers: {\n DynamicZone: {\n Template: {\n useTemplate\n },\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 TemplateGallery\n }\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASO,IAAMC,UAAU,GAAG;EACtBC,cAAc,EAAE;IACZC,WAAW,EAAE;MACTC,QAAQ,EAAE;QACNC,WAAW,EAAXA;MACJ,CAAC;MACDC,SAAS,EAAEC,iCAAoB;MAC/B;MACA;MACA;MACA;MACA;MACAC,UAAU,EAAE;QACRF,SAAS,EAAEG,gCAAmB;QAC9BC,aAAa,EAAEC,oCAAuB;QACtCC,IAAI,EAAEC;MACV,CAAC;MACDC,eAAe,EAAfA;IACJ;EACJ;AACJ,CAAC;AAACC,OAAA,CAAAd,UAAA,GAAAA,UAAA"}
|