@webiny/app-headless-cms 5.23.1 → 5.25.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/HeadlessCMS.d.ts +4 -3
- package/HeadlessCMS.js.map +1 -0
- package/admin/components/ContentEntryForm/ContentEntryForm.d.ts +2 -2
- package/admin/components/ContentEntryForm/ContentEntryForm.js +27 -6
- package/admin/components/ContentEntryForm/ContentEntryForm.js.map +1 -0
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.d.ts +2 -2
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js +18 -2
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js.map +1 -0
- package/admin/components/ContentEntryForm/Fields.d.ts +4 -5
- package/admin/components/ContentEntryForm/Fields.js +1 -1
- package/admin/components/ContentEntryForm/Fields.js.map +1 -0
- package/admin/components/ContentEntryForm/Label.d.ts +2 -4
- package/admin/components/ContentEntryForm/Label.js.map +1 -0
- package/admin/components/ContentEntryForm/RenderFieldElement.d.ts +5 -4
- package/admin/components/ContentEntryForm/RenderFieldElement.js.map +1 -0
- package/admin/components/ContentEntryForm/functions/createValidators.d.ts +3 -1
- package/admin/components/ContentEntryForm/functions/createValidators.js +8 -5
- package/admin/components/ContentEntryForm/functions/createValidators.js.map +1 -0
- package/admin/components/ContentEntryForm/functions/getValue.d.ts +9 -5
- package/admin/components/ContentEntryForm/functions/getValue.js +4 -4
- package/admin/components/ContentEntryForm/functions/getValue.js.map +1 -0
- package/admin/components/ContentEntryForm/functions/setValue.d.ts +10 -6
- package/admin/components/ContentEntryForm/functions/setValue.js +5 -5
- package/admin/components/ContentEntryForm/functions/setValue.js.map +1 -0
- package/admin/components/ContentEntryForm/useBind.d.ts +6 -6
- package/admin/components/ContentEntryForm/useBind.js +23 -10
- package/admin/components/ContentEntryForm/useBind.js.map +1 -0
- package/admin/components/ContentEntryForm/useContentEntryForm.d.ts +2 -4
- package/admin/components/ContentEntryForm/useContentEntryForm.js +84 -31
- package/admin/components/ContentEntryForm/useContentEntryForm.js.map +1 -0
- package/admin/components/ContentEntryForm/useRenderPlugins.js.map +1 -0
- package/admin/components/ContentModelEditor/Context.d.ts +24 -13
- package/admin/components/ContentModelEditor/Context.js +190 -61
- package/admin/components/ContentModelEditor/Context.js.map +1 -0
- package/admin/components/ContentModelEditor/Editor.d.ts +2 -2
- package/admin/components/ContentModelEditor/Editor.js +5 -3
- package/admin/components/ContentModelEditor/Editor.js.map +1 -0
- package/admin/components/ContentModelEditor/FieldsSidebar.d.ts +6 -4
- package/admin/components/ContentModelEditor/FieldsSidebar.js +11 -11
- package/admin/components/ContentModelEditor/FieldsSidebar.js.map +1 -0
- package/admin/components/ContentModelEditor/Header.d.ts +3 -2
- package/admin/components/ContentModelEditor/Header.js +5 -2
- package/admin/components/ContentModelEditor/Header.js.map +1 -0
- package/admin/components/ContentModelEditor/PreviewTab.js.map +1 -0
- package/admin/components/ContentModelEditor/useContentModelEditor.d.ts +1 -1
- package/admin/components/ContentModelEditor/useContentModelEditor.js.map +1 -0
- package/admin/components/DragPreview.d.ts +3 -2
- package/admin/components/DragPreview.js +12 -5
- package/admin/components/DragPreview.js.map +1 -0
- package/admin/components/Draggable.d.ts +9 -7
- package/admin/components/Draggable.js +4 -3
- package/admin/components/Draggable.js.map +1 -0
- package/admin/components/DropZone/Center.d.ts +6 -6
- package/admin/components/DropZone/Center.js +7 -4
- package/admin/components/DropZone/Center.js.map +1 -0
- package/admin/components/DropZone/Horizontal.d.ts +7 -5
- package/admin/components/DropZone/Horizontal.js +2 -2
- package/admin/components/DropZone/Horizontal.js.map +1 -0
- package/admin/components/DropZone/Vertical.d.ts +4 -4
- package/admin/components/DropZone/Vertical.js +2 -2
- package/admin/components/DropZone/Vertical.js.map +1 -0
- package/admin/components/DropZone/index.js.map +1 -0
- package/admin/components/Droppable.d.ts +22 -13
- package/admin/components/Droppable.js +3 -3
- package/admin/components/Droppable.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.d.ts +8 -2
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js +7 -6
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.d.ts +4 -4
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +14 -4
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.d.ts +2 -2
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js +7 -1
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.d.ts +9 -4
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js +38 -30
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.d.ts +7 -5
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.js +4 -4
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.d.ts +8 -6
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.js +5 -5
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.js.map +1 -0
- package/admin/components/FieldEditor/EditFieldDialog.d.ts +7 -7
- package/admin/components/FieldEditor/EditFieldDialog.js +45 -28
- package/admin/components/FieldEditor/EditFieldDialog.js.map +1 -0
- package/admin/components/FieldEditor/Field.d.ts +4 -4
- package/admin/components/FieldEditor/Field.js +2 -2
- package/admin/components/FieldEditor/Field.js.map +1 -0
- package/admin/components/FieldEditor/FieldEditor.d.ts +2 -2
- package/admin/components/FieldEditor/FieldEditor.js +9 -6
- package/admin/components/FieldEditor/FieldEditor.js.map +1 -0
- package/admin/components/FieldEditor/FieldEditorContext.d.ts +70 -25
- package/admin/components/FieldEditor/FieldEditorContext.js +63 -35
- package/admin/components/FieldEditor/FieldEditorContext.js.map +1 -0
- package/admin/components/FieldEditor/Styled.d.ts +2 -2
- package/admin/components/FieldEditor/Styled.js.map +1 -0
- package/admin/components/FieldEditor/index.js.map +1 -0
- package/admin/components/FieldEditor/useFieldEditor.js.map +1 -0
- package/admin/components/FieldEditor/utils/deleteField.d.ts +6 -8
- package/admin/components/FieldEditor/utils/deleteField.js +10 -6
- package/admin/components/FieldEditor/utils/deleteField.js.map +1 -0
- package/admin/components/FieldEditor/utils/getFieldPosition.d.ts +6 -5
- package/admin/components/FieldEditor/utils/getFieldPosition.js +6 -5
- package/admin/components/FieldEditor/utils/getFieldPosition.js.map +1 -0
- package/admin/components/FieldEditor/utils/index.js.map +1 -0
- package/admin/components/FieldEditor/utils/moveField.d.ts +5 -4
- package/admin/components/FieldEditor/utils/moveField.js +16 -10
- package/admin/components/FieldEditor/utils/moveField.js.map +1 -0
- package/admin/components/FieldEditor/utils/moveRow.d.ts +5 -6
- package/admin/components/FieldEditor/utils/moveRow.js.map +1 -0
- package/admin/constants/statusLabels.d.ts +2 -8
- package/admin/constants/statusLabels.js +3 -2
- package/admin/constants/statusLabels.js.map +1 -0
- package/admin/contexts/Cms/NetworkError.js.map +1 -0
- package/admin/contexts/Cms/index.d.ts +3 -3
- package/admin/contexts/Cms/index.js +24 -9
- package/admin/contexts/Cms/index.js.map +1 -0
- package/admin/elements/ContentGroupMenuElement.js +1 -0
- package/admin/elements/ContentGroupMenuElement.js.map +1 -0
- package/admin/elements/ContentModelMenuElement.js +1 -0
- package/admin/elements/ContentModelMenuElement.js.map +1 -0
- package/admin/elements/NothingToShowElement.d.ts +1 -1
- package/admin/elements/NothingToShowElement.js.map +1 -0
- package/admin/graphql/contentEntries.d.ts +172 -11
- package/admin/graphql/contentEntries.js +55 -0
- package/admin/graphql/contentEntries.js.map +1 -0
- package/admin/graphql/contentModels.d.ts +28 -0
- package/admin/graphql/contentModels.js +13 -2
- package/admin/graphql/contentModels.js.map +1 -0
- package/admin/graphql/createFieldsList.js.map +1 -0
- package/admin/hooks/index.js.map +1 -0
- package/admin/hooks/useApolloClient.d.ts +2 -1
- package/admin/hooks/useApolloClient.js.map +1 -0
- package/admin/hooks/useCms.js.map +1 -0
- package/admin/hooks/useLazyQuery.d.ts +4 -1
- package/admin/hooks/useLazyQuery.js.map +1 -0
- package/admin/hooks/useMutation.d.ts +4 -1
- package/admin/hooks/useMutation.js +1 -1
- package/admin/hooks/useMutation.js.map +1 -0
- package/admin/hooks/usePermission.d.ts +21 -20
- package/admin/hooks/usePermission.js +25 -21
- package/admin/hooks/usePermission.js.map +1 -0
- package/admin/hooks/useQuery.d.ts +4 -1
- package/admin/hooks/useQuery.js.map +1 -0
- package/admin/hooks/useQueryLocale.d.ts +3 -1
- package/admin/hooks/useQueryLocale.js.map +1 -0
- package/admin/menus/CmsMenuLoader.d.ts +1 -1
- package/admin/menus/CmsMenuLoader.js +5 -2
- package/admin/menus/CmsMenuLoader.js.map +1 -0
- package/admin/menus/ContentGroupsMenuItems.d.ts +2 -1
- package/admin/menus/ContentGroupsMenuItems.js +5 -7
- package/admin/menus/ContentGroupsMenuItems.js.map +1 -0
- package/admin/menus/GlobalSearchPlugins.d.ts +2 -1
- package/admin/menus/GlobalSearchPlugins.js +2 -2
- package/admin/menus/GlobalSearchPlugins.js.map +1 -0
- package/admin/menus/NothingToShowElement.d.ts +2 -2
- package/admin/menus/NothingToShowElement.js.map +1 -0
- package/admin/plugins/apiInformation/index.js +3 -3
- package/admin/plugins/apiInformation/index.js.map +1 -0
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js.map +1 -0
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js.map +1 -0
- package/admin/plugins/editor/defaultBar/BackButton.d.ts +1 -1
- package/admin/plugins/editor/defaultBar/BackButton.js.map +1 -0
- package/admin/plugins/editor/defaultBar/CreateContentButton.d.ts +2 -2
- package/admin/plugins/editor/defaultBar/CreateContentButton.js.map +1 -0
- package/admin/plugins/editor/defaultBar/Divider.d.ts +1 -1
- package/admin/plugins/editor/defaultBar/Divider.js.map +1 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.d.ts +4 -4
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js +11 -1
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js.map +1 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.d.ts +2 -2
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.js.map +1 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +2 -2
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.js.map +1 -0
- package/admin/plugins/editor/defaultBar/FormSettings/index.js.map +1 -0
- package/admin/plugins/editor/defaultBar/Name/Name.d.ts +2 -2
- package/admin/plugins/editor/defaultBar/Name/Name.js +10 -5
- package/admin/plugins/editor/defaultBar/Name/Name.js.map +1 -0
- package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +3 -3
- package/admin/plugins/editor/defaultBar/Name/NameStyled.js.map +1 -0
- package/admin/plugins/editor/defaultBar/Name/index.js.map +1 -0
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.d.ts +2 -2
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.js +37 -32
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.js.map +1 -0
- package/admin/plugins/editor/defaultBar/index.js.map +1 -0
- package/admin/plugins/editor/formSettings/components/GeneralSettings.js.map +1 -0
- package/admin/plugins/editor/formSettings/components/GroupSelect.js +1 -1
- package/admin/plugins/editor/formSettings/components/GroupSelect.js.map +1 -0
- package/admin/plugins/editor/formSettings/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/Accordion.d.ts +5 -6
- package/admin/plugins/fieldRenderers/Accordion.js +3 -2
- package/admin/plugins/fieldRenderers/Accordion.js.map +1 -0
- package/admin/plugins/fieldRenderers/DynamicSection.d.ts +12 -5
- package/admin/plugins/fieldRenderers/DynamicSection.js +7 -4
- package/admin/plugins/fieldRenderers/DynamicSection.js.map +1 -0
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.js.map +1 -0
- package/admin/plugins/fieldRenderers/boolean/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/checkboxes.js +11 -5
- package/admin/plugins/fieldRenderers/checkboxes.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.d.ts +2 -1
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.js +40 -9
- package/admin/plugins/fieldRenderers/dateTime/DateOnly.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.d.ts +4 -3
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js +75 -19
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.d.ts +4 -3
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js +72 -16
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/Input.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dateTime/Input.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/Select.d.ts +3 -3
- package/admin/plugins/fieldRenderers/dateTime/Select.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/Time.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dateTime/Time.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js +4 -3
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js +15 -10
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/dateTime/utils.d.ts +8 -6
- package/admin/plugins/fieldRenderers/dateTime/utils.js.map +1 -0
- package/admin/plugins/fieldRenderers/file/File.d.ts +5 -5
- package/admin/plugins/fieldRenderers/file/File.js +10 -4
- package/admin/plugins/fieldRenderers/file/File.js.map +1 -0
- package/admin/plugins/fieldRenderers/file/fileField.js +4 -3
- package/admin/plugins/fieldRenderers/file/fileField.js.map +1 -0
- package/admin/plugins/fieldRenderers/file/fileFields.js +17 -6
- package/admin/plugins/fieldRenderers/file/fileFields.js.map +1 -0
- package/admin/plugins/fieldRenderers/file/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/file/utils.d.ts +8 -3
- package/admin/plugins/fieldRenderers/file/utils.js +2 -2
- package/admin/plugins/fieldRenderers/file/utils.js.map +1 -0
- package/admin/plugins/fieldRenderers/longText/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/longText/longText.js.map +1 -0
- package/admin/plugins/fieldRenderers/longText/longTexts.js +1 -1
- package/admin/plugins/fieldRenderers/longText/longTexts.js.map +1 -0
- package/admin/plugins/fieldRenderers/number/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/number/numberInput.js.map +1 -0
- package/admin/plugins/fieldRenderers/number/numberInputs.js +1 -1
- package/admin/plugins/fieldRenderers/number/numberInputs.js.map +1 -0
- package/admin/plugins/fieldRenderers/object/StyledComponents.js.map +1 -0
- package/admin/plugins/fieldRenderers/object/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +5 -5
- package/admin/plugins/fieldRenderers/object/multipleObjects.js.map +1 -0
- package/admin/plugins/fieldRenderers/object/singleObject.js +3 -2
- package/admin/plugins/fieldRenderers/object/singleObject.js.map +1 -0
- package/admin/plugins/fieldRenderers/radioButtons.js +11 -5
- package/admin/plugins/fieldRenderers/radioButtons.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.d.ts +8 -5
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +5 -5
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.d.ts +8 -5
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js +15 -9
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/MissingEntryHelpText.d.ts +3 -2
- package/admin/plugins/fieldRenderers/ref/components/MissingEntryHelpText.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.d.ts +2 -1
- package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js +16 -9
- package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.d.ts +2 -2
- package/admin/plugins/fieldRenderers/ref/components/createEntryUrl.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/getOptions.d.ts +16 -1
- package/admin/plugins/fieldRenderers/ref/components/getOptions.js +1 -1
- package/admin/plugins/fieldRenderers/ref/components/getOptions.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/graphql.d.ts +50 -0
- package/admin/plugins/fieldRenderers/ref/components/graphql.js +16 -1
- package/admin/plugins/fieldRenderers/ref/components/graphql.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/renderItem.d.ts +2 -2
- package/admin/plugins/fieldRenderers/ref/components/renderItem.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/useReference.d.ts +6 -11
- package/admin/plugins/fieldRenderers/ref/components/useReference.js +4 -3
- package/admin/plugins/fieldRenderers/ref/components/useReference.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/components/useReferences.d.ts +12 -9
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js +1 -1
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js +4 -3
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntryDialog.d.ts +2 -4
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntryDialog.js +6 -1
- package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntryDialog.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/refInput.js.map +1 -0
- package/admin/plugins/fieldRenderers/ref/refInputs.js +1 -1
- package/admin/plugins/fieldRenderers/ref/refInputs.js.map +1 -0
- package/admin/plugins/fieldRenderers/richText/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/richText/richTextInput.js +5 -0
- package/admin/plugins/fieldRenderers/richText/richTextInput.js.map +1 -0
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js +9 -2
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js.map +1 -0
- package/admin/plugins/fieldRenderers/select.js +28 -7
- package/admin/plugins/fieldRenderers/select.js.map +1 -0
- package/admin/plugins/fieldRenderers/text/index.js.map +1 -0
- package/admin/plugins/fieldRenderers/text/textInput.js.map +1 -0
- package/admin/plugins/fieldRenderers/text/textInputs.js +1 -1
- package/admin/plugins/fieldRenderers/text/textInputs.js.map +1 -0
- package/admin/plugins/fieldValidators/date/availableValidators.d.ts +1 -1
- package/admin/plugins/fieldValidators/date/availableValidators.js.map +1 -0
- package/admin/plugins/fieldValidators/date/createDateInputField.d.ts +2 -1
- package/admin/plugins/fieldValidators/date/createDateInputField.js +5 -3
- package/admin/plugins/fieldValidators/date/createDateInputField.js.map +1 -0
- package/admin/plugins/fieldValidators/dateGte.js +1 -1
- package/admin/plugins/fieldValidators/dateGte.js.map +1 -0
- package/admin/plugins/fieldValidators/dateLte.js +1 -1
- package/admin/plugins/fieldValidators/dateLte.js.map +1 -0
- package/admin/plugins/fieldValidators/gte.d.ts +2 -2
- package/admin/plugins/fieldValidators/gte.js +3 -2
- package/admin/plugins/fieldValidators/gte.js.map +1 -0
- package/admin/plugins/fieldValidators/in.d.ts +2 -2
- package/admin/plugins/fieldValidators/in.js +3 -2
- package/admin/plugins/fieldValidators/in.js.map +1 -0
- package/admin/plugins/fieldValidators/lte.d.ts +2 -2
- package/admin/plugins/fieldValidators/lte.js +3 -2
- package/admin/plugins/fieldValidators/lte.js.map +1 -0
- package/admin/plugins/fieldValidators/maxLength.d.ts +2 -2
- package/admin/plugins/fieldValidators/maxLength.js +3 -2
- package/admin/plugins/fieldValidators/maxLength.js.map +1 -0
- package/admin/plugins/fieldValidators/minLength.d.ts +2 -2
- package/admin/plugins/fieldValidators/minLength.js +3 -2
- package/admin/plugins/fieldValidators/minLength.js.map +1 -0
- package/admin/plugins/fieldValidators/pattern.d.ts +2 -2
- package/admin/plugins/fieldValidators/pattern.js +9 -2
- package/admin/plugins/fieldValidators/pattern.js.map +1 -0
- package/admin/plugins/fieldValidators/patternPlugins/email.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/email.js +3 -2
- package/admin/plugins/fieldValidators/patternPlugins/email.js.map +1 -0
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js +3 -2
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js.map +1 -0
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js +3 -2
- package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js.map +1 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.js +3 -2
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.js.map +1 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js +3 -2
- package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js.map +1 -0
- package/admin/plugins/fieldValidators/patternPlugins/url.d.ts +2 -2
- package/admin/plugins/fieldValidators/patternPlugins/url.js +3 -2
- package/admin/plugins/fieldValidators/patternPlugins/url.js.map +1 -0
- package/admin/plugins/fieldValidators/required.d.ts +2 -2
- package/admin/plugins/fieldValidators/required.js +3 -2
- package/admin/plugins/fieldValidators/required.js.map +1 -0
- package/admin/plugins/fieldValidators/unique.js.map +1 -0
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.d.ts +3 -2
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js.map +1 -0
- package/admin/plugins/fields/boolean.js.map +1 -0
- package/admin/plugins/fields/dateTime.js.map +1 -0
- package/admin/plugins/fields/file.js.map +1 -0
- package/admin/plugins/fields/longText.js.map +1 -0
- package/admin/plugins/fields/number.js.map +1 -0
- package/admin/plugins/fields/object/ObjectFields.d.ts +7 -4
- package/admin/plugins/fields/object/ObjectFields.js +2 -2
- package/admin/plugins/fields/object/ObjectFields.js.map +1 -0
- package/admin/plugins/fields/object.js +1 -1
- package/admin/plugins/fields/object.js.map +1 -0
- package/admin/plugins/fields/ref.js +7 -6
- package/admin/plugins/fields/ref.js.map +1 -0
- package/admin/plugins/fields/richText.js.map +1 -0
- package/admin/plugins/fields/text.js.map +1 -0
- package/admin/plugins/getObjectId.js.map +1 -0
- package/admin/plugins/icons.js +10 -4
- package/admin/plugins/icons.js.map +1 -0
- package/admin/plugins/index.d.ts +1 -1
- package/admin/plugins/index.js.map +1 -0
- package/admin/plugins/install.d.ts +22 -0
- package/admin/plugins/install.js +47 -37
- package/admin/plugins/install.js.map +1 -0
- package/admin/plugins/permissionRenderer/CmsPermissions.d.ts +11 -5
- package/admin/plugins/permissionRenderer/CmsPermissions.js +19 -10
- package/admin/plugins/permissionRenderer/CmsPermissions.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.d.ts +12 -8
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js +7 -6
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.d.ts +11 -8
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.js +7 -6
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/ContentModelList.d.ts +8 -6
- package/admin/plugins/permissionRenderer/components/ContentModelList.js +3 -3
- package/admin/plugins/permissionRenderer/components/ContentModelList.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.d.ts +14 -10
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.js +10 -8
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.d.ts +10 -5
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.js +4 -0
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/PermissionSelector.d.ts +12 -27
- package/admin/plugins/permissionRenderer/components/PermissionSelector.js +13 -1
- package/admin/plugins/permissionRenderer/components/PermissionSelector.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +1 -1
- package/admin/plugins/permissionRenderer/components/StyledComponents.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/types.d.ts +16 -0
- package/admin/plugins/permissionRenderer/components/types.js +1 -0
- package/admin/plugins/permissionRenderer/components/types.js.map +1 -0
- package/admin/plugins/permissionRenderer/components/useCmsData.d.ts +17 -1
- package/admin/plugins/permissionRenderer/components/useCmsData.js +37 -25
- package/admin/plugins/permissionRenderer/components/useCmsData.js.map +1 -0
- package/admin/plugins/permissionRenderer/index.d.ts +2 -2
- package/admin/plugins/permissionRenderer/index.js +3 -2
- package/admin/plugins/permissionRenderer/index.js.map +1 -0
- package/admin/plugins/routes.js.map +1 -0
- package/admin/plugins/transformers/dateTransformer.js +20 -24
- package/admin/plugins/transformers/dateTransformer.js.map +1 -0
- package/admin/plugins/transformers/index.js.map +1 -0
- package/admin/plugins/transformers/numberTransformer.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.d.ts +1 -1
- package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.d.ts +2 -2
- package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/createListModelsQuery.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/createRepublishMutation.d.ts +2 -1
- package/admin/plugins/upgrades/5.19.0/createRepublishMutation.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/fetchModelEntries.d.ts +2 -2
- package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js +1 -0
- package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js.map +1 -0
- package/admin/plugins/upgrades/5.19.0/types.js.map +1 -0
- package/admin/plugins/upgrades/v5.0.0.js +1 -0
- package/admin/plugins/upgrades/v5.0.0.js.map +1 -0
- package/admin/plugins/upgrades/v5.19.0.js +1 -0
- package/admin/plugins/upgrades/v5.19.0.js.map +1 -0
- package/admin/plugins/upgrades/v5.5.0.js +1 -0
- package/admin/plugins/upgrades/v5.5.0.js.map +1 -0
- package/admin/plugins/upgrades/v5.8.0.js +1 -0
- package/admin/plugins/upgrades/v5.8.0.js.map +1 -0
- package/admin/plugins/validators/dateGte.js.map +1 -0
- package/admin/plugins/validators/dateLte.js.map +1 -0
- package/admin/plugins/validators/gte.d.ts +2 -2
- package/admin/plugins/validators/gte.js +3 -2
- package/admin/plugins/validators/gte.js.map +1 -0
- package/admin/plugins/validators/in.d.ts +2 -2
- package/admin/plugins/validators/in.js +3 -2
- package/admin/plugins/validators/in.js.map +1 -0
- package/admin/plugins/validators/lte.d.ts +2 -2
- package/admin/plugins/validators/lte.js +3 -2
- package/admin/plugins/validators/lte.js.map +1 -0
- package/admin/plugins/validators/maxLength.d.ts +2 -2
- package/admin/plugins/validators/maxLength.js +3 -2
- package/admin/plugins/validators/maxLength.js.map +1 -0
- package/admin/plugins/validators/minLength.d.ts +2 -2
- package/admin/plugins/validators/minLength.js +3 -2
- package/admin/plugins/validators/minLength.js.map +1 -0
- package/admin/plugins/validators/pattern.d.ts +3 -9
- package/admin/plugins/validators/pattern.js +3 -2
- package/admin/plugins/validators/pattern.js.map +1 -0
- package/admin/plugins/validators/patternPlugins/email.d.ts +3 -10
- package/admin/plugins/validators/patternPlugins/email.js +3 -2
- package/admin/plugins/validators/patternPlugins/email.js.map +1 -0
- package/admin/plugins/validators/patternPlugins/lowerCase.d.ts +3 -10
- package/admin/plugins/validators/patternPlugins/lowerCase.js +3 -2
- package/admin/plugins/validators/patternPlugins/lowerCase.js.map +1 -0
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +3 -10
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js +3 -2
- package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js.map +1 -0
- package/admin/plugins/validators/patternPlugins/upperCase.d.ts +3 -10
- package/admin/plugins/validators/patternPlugins/upperCase.js +3 -2
- package/admin/plugins/validators/patternPlugins/upperCase.js.map +1 -0
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.d.ts +3 -10
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.js +3 -2
- package/admin/plugins/validators/patternPlugins/upperCaseSpace.js.map +1 -0
- package/admin/plugins/validators/patternPlugins/url.d.ts +3 -10
- package/admin/plugins/validators/patternPlugins/url.js +3 -2
- package/admin/plugins/validators/patternPlugins/url.js.map +1 -0
- package/admin/plugins/validators/required.d.ts +2 -2
- package/admin/plugins/validators/required.js +3 -2
- package/admin/plugins/validators/required.js.map +1 -0
- package/admin/plugins/validators/timeGte.js.map +1 -0
- package/admin/plugins/validators/timeLte.js.map +1 -0
- package/admin/plugins/validators/unique.js.map +1 -0
- package/admin/plugins/welcomeScreenWidget.js.map +1 -0
- package/admin/views/contentEntries/ContentEntries.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntries.js +2 -2
- package/admin/views/contentEntries/ContentEntries.js.map +1 -0
- package/admin/views/contentEntries/ContentEntriesContext.d.ts +9 -5
- package/admin/views/contentEntries/ContentEntriesContext.js +14 -5
- package/admin/views/contentEntries/ContentEntriesContext.js.map +1 -0
- package/admin/views/contentEntries/ContentEntriesList.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntriesList.js +11 -1
- package/admin/views/contentEntries/ContentEntriesList.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.d.ts +11 -11
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +93 -10
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.d.ts +4 -4
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js +15 -4
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/RevisionsList.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/RevisionsList.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/cache.d.ts +9 -7
- package/admin/views/contentEntries/ContentEntry/cache.js +39 -37
- package/admin/views/contentEntries/ContentEntry/cache.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/Header.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/header/Header.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.js +15 -8
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/index.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.d.ts +1 -1
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.js +8 -7
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.js +2 -2
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.js +2 -2
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js +2 -1
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/useRevision.d.ts +31 -9
- package/admin/views/contentEntries/ContentEntry/useRevision.js +212 -132
- package/admin/views/contentEntries/ContentEntry/useRevision.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry.d.ts +1 -2
- package/admin/views/contentEntries/ContentEntry.js +2 -5
- package/admin/views/contentEntries/ContentEntry.js.map +1 -0
- package/admin/views/contentEntries/hooks/useContentEntries.js.map +1 -0
- package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +3 -6
- package/admin/views/contentEntries/hooks/useContentEntriesList.js +4 -4
- package/admin/views/contentEntries/hooks/useContentEntriesList.js.map +1 -0
- package/admin/views/contentEntries/hooks/useContentEntry.js.map +1 -0
- package/admin/views/contentModelGroups/ContentModelGroups.d.ts +2 -2
- package/admin/views/contentModelGroups/ContentModelGroups.js +6 -5
- package/admin/views/contentModelGroups/ContentModelGroups.js.map +1 -0
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.d.ts +4 -4
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js +19 -24
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js.map +1 -0
- package/admin/views/contentModelGroups/ContentModelGroupsForm.d.ts +4 -4
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js +69 -37
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js.map +1 -0
- package/admin/views/contentModelGroups/DelayedOnChange.d.ts +29 -12
- package/admin/views/contentModelGroups/DelayedOnChange.js +13 -13
- package/admin/views/contentModelGroups/DelayedOnChange.js.map +1 -0
- package/admin/views/contentModelGroups/IconPicker.d.ts +3 -2
- package/admin/views/contentModelGroups/IconPicker.js +12 -4
- package/admin/views/contentModelGroups/IconPicker.js.map +1 -0
- package/admin/views/contentModelGroups/graphql.d.ts +68 -0
- package/admin/views/contentModelGroups/graphql.js +26 -5
- package/admin/views/contentModelGroups/graphql.js.map +1 -0
- package/admin/views/contentModels/CloneContentModelDialog.js +31 -39
- package/admin/views/contentModels/CloneContentModelDialog.js.map +1 -0
- package/admin/views/contentModels/ContentModelEditor.d.ts +3 -2
- package/admin/views/contentModels/ContentModelEditor.js +6 -3
- package/admin/views/contentModels/ContentModelEditor.js.map +1 -0
- package/admin/views/contentModels/ContentModels.d.ts +2 -2
- package/admin/views/contentModels/ContentModels.js +10 -9
- package/admin/views/contentModels/ContentModels.js.map +1 -0
- package/admin/views/contentModels/ContentModelsDataList.d.ts +4 -4
- package/admin/views/contentModels/ContentModelsDataList.js +26 -23
- package/admin/views/contentModels/ContentModelsDataList.js.map +1 -0
- package/admin/views/contentModels/NewContentModelDialog.d.ts +2 -2
- package/admin/views/contentModels/NewContentModelDialog.js +166 -77
- package/admin/views/contentModels/NewContentModelDialog.js.map +1 -0
- package/admin/views/contentModels/cache.d.ts +5 -4
- package/admin/views/contentModels/cache.js +47 -21
- package/admin/views/contentModels/cache.js.map +1 -0
- package/admin/views/contentModels/types.d.ts +4 -0
- package/admin/views/contentModels/types.js +1 -0
- package/admin/views/contentModels/types.js.map +1 -0
- package/admin/views/utils.d.ts +3 -2
- package/admin/views/utils.js +5 -18
- package/admin/views/utils.js.map +1 -0
- package/admin/viewsGraphql.d.ts +62 -0
- package/admin/viewsGraphql.js +30 -5
- package/admin/viewsGraphql.js.map +1 -0
- package/index.js.map +1 -0
- package/package.json +27 -23
- package/types.d.ts +129 -30
- package/types.js.map +1 -0
package/HeadlessCMS.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ApolloClient } from "apollo-client";
|
|
3
|
+
interface CreateApolloClientParams {
|
|
4
|
+
uri: string;
|
|
5
|
+
}
|
|
3
6
|
interface CreateApolloClient {
|
|
4
|
-
(params:
|
|
5
|
-
uri: string;
|
|
6
|
-
}): ApolloClient<any>;
|
|
7
|
+
(params: CreateApolloClientParams): ApolloClient<any>;
|
|
7
8
|
}
|
|
8
9
|
export interface HeadlessCMSProps {
|
|
9
10
|
createApolloClient: CreateApolloClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["HeadlessCMS.tsx"],"names":["React","Fragment","memo","plugins","Plugins","Provider","CmsProvider","CmsMenuLoader","apiInformation","createHeadlessCMSProvider","createApolloClient","Component","HeadlessCMSProvider","children","HeadlessCMSExtension","register","HeadlessCMS"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,IAA1B,QAAsC,OAAtC;AACA,SAASC,OAAT,QAAwB,iBAAxB;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,mBAAlC;AAEA,SAASC,WAAT;AACA,SAASC,aAAT;AACA,OAAOC,cAAP;;AAEA,IAAMC,yBAAyB,GAC3B,SADEA,yBACF,CAACC,kBAAD;AAAA,SACA,UAACC,SAAD,EAAmC;AAC/B,WAAO,SAASC,mBAAT,OAA2C;AAAA,UAAZC,QAAY,QAAZA,QAAY;AAC9C,0BACI,oBAAC,WAAD;AAAa,QAAA,kBAAkB,EAAEH;AAAjC,sBACI,oBAAC,SAAD,QAAYG,QAAZ,CADJ,CADJ;AAKH,KAND;AAOH,GATD;AAAA,CADJ;;AAuBA,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,QAA8C;AAAA,MAA3CJ,kBAA2C,SAA3CA,kBAA2C;AACvEP,EAAAA,OAAO,CAACY,QAAR,CAAiBP,cAAjB;AAEA,sBACI,oBAAC,QAAD,qBACI,oBAAC,QAAD;AAAU,IAAA,GAAG,EAAEC,yBAAyB,CAACC,kBAAD;AAAxC,IADJ,eAEI,oBAAC,OAAD,qBACI,oBAAC,aAAD,OADJ,CAFJ,CADJ;AAQH,CAXD;;AAaA,OAAO,IAAMM,WAAW,gBAAGd,IAAI,CAACY,oBAAD,CAAxB","sourcesContent":["import React, { Fragment, memo } from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Plugins, Provider } from \"@webiny/app-admin\";\nimport { ApolloClient } from \"apollo-client\";\nimport { CmsProvider } from \"./admin/contexts/Cms\";\nimport { CmsMenuLoader } from \"~/admin/menus/CmsMenuLoader\";\nimport apiInformation from \"./admin/plugins/apiInformation\";\n\nconst createHeadlessCMSProvider =\n (createApolloClient: CreateApolloClient) =>\n (Component: React.FC): React.FC => {\n return function HeadlessCMSProvider({ children }) {\n return (\n <CmsProvider createApolloClient={createApolloClient}>\n <Component>{children}</Component>\n </CmsProvider>\n );\n };\n };\n\ninterface CreateApolloClientParams {\n uri: string;\n}\ninterface CreateApolloClient {\n (params: CreateApolloClientParams): ApolloClient<any>;\n}\n\nexport interface HeadlessCMSProps {\n createApolloClient: CreateApolloClient;\n}\n\nconst HeadlessCMSExtension = ({ createApolloClient }: HeadlessCMSProps) => {\n plugins.register(apiInformation);\n\n return (\n <Fragment>\n <Provider hoc={createHeadlessCMSProvider(createApolloClient)} />\n <Plugins>\n <CmsMenuLoader />\n </Plugins>\n </Fragment>\n );\n};\n\nexport const HeadlessCMS = memo(HeadlessCMSExtension);\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { FormAPI } from "@webiny/form/types";
|
|
3
3
|
import { UseContentEntryFormParams } from "./useContentEntryForm";
|
|
4
4
|
interface ContentEntryFormProps extends UseContentEntryFormParams {
|
|
5
5
|
onForm?: (form: FormAPI) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare const ContentEntryForm:
|
|
7
|
+
export declare const ContentEntryForm: React.FC<ContentEntryFormProps>;
|
|
8
8
|
export {};
|
|
@@ -2,11 +2,11 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["onForm"];
|
|
4
4
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
5
|
+
import RenderFieldElement from "./RenderFieldElement";
|
|
5
6
|
import styled from "@emotion/styled";
|
|
6
7
|
import { Form } from "@webiny/form";
|
|
7
8
|
import { plugins } from "@webiny/plugins";
|
|
8
9
|
import { CircularProgress } from "@webiny/ui/Progress";
|
|
9
|
-
import RenderFieldElement from "./RenderFieldElement";
|
|
10
10
|
import { useContentEntryForm } from "./useContentEntryForm";
|
|
11
11
|
import { Fields } from "./Fields";
|
|
12
12
|
var FormWrapper = /*#__PURE__*/styled("div", {
|
|
@@ -31,13 +31,21 @@ export var ContentEntryForm = function ContentEntryForm(_ref) {
|
|
|
31
31
|
|
|
32
32
|
var ref = useRef(null);
|
|
33
33
|
useEffect(function () {
|
|
34
|
-
typeof onForm
|
|
34
|
+
if (typeof onForm !== "function" || !ref.current) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onForm(ref.current);
|
|
35
39
|
}, []);
|
|
36
40
|
var formRenderer = plugins.byType("cms-content-form-renderer").find(function (pl) {
|
|
37
41
|
return pl.modelId === contentModel.modelId;
|
|
38
42
|
});
|
|
39
43
|
var renderCustomLayout = useCallback(function (formRenderProps) {
|
|
40
44
|
var fields = contentModel.fields.reduce(function (acc, field) {
|
|
45
|
+
/**
|
|
46
|
+
* TODO @ts-refactor
|
|
47
|
+
* Figure out type for Bind.
|
|
48
|
+
*/
|
|
41
49
|
acc[field.fieldId] = /*#__PURE__*/React.createElement(RenderFieldElement, {
|
|
42
50
|
field: field,
|
|
43
51
|
Bind: formRenderProps.Bind,
|
|
@@ -45,9 +53,20 @@ export var ContentEntryForm = function ContentEntryForm(_ref) {
|
|
|
45
53
|
});
|
|
46
54
|
return acc;
|
|
47
55
|
}, {});
|
|
56
|
+
|
|
57
|
+
if (!formRenderer) {
|
|
58
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, "Missing form renderer for modelId \"".concat(contentModel.modelId, "\"."));
|
|
59
|
+
}
|
|
60
|
+
|
|
48
61
|
return formRenderer.render(_objectSpread(_objectSpread({}, formRenderProps), {}, {
|
|
49
62
|
contentModel: contentModel,
|
|
50
|
-
fields: fields
|
|
63
|
+
fields: fields,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* TODO @ts-refactor
|
|
67
|
+
* Figure out type for Bind.
|
|
68
|
+
*/
|
|
69
|
+
Bind: formRenderProps.Bind
|
|
51
70
|
}));
|
|
52
71
|
}, [formRenderer]);
|
|
53
72
|
return /*#__PURE__*/React.createElement(Form, {
|
|
@@ -61,8 +80,10 @@ export var ContentEntryForm = function ContentEntryForm(_ref) {
|
|
|
61
80
|
"data-testid": "cms-content-form"
|
|
62
81
|
}, loading && /*#__PURE__*/React.createElement(CircularProgress, null), formRenderer ? renderCustomLayout(formProps) : /*#__PURE__*/React.createElement(Fields, Object.assign({
|
|
63
82
|
contentModel: contentModel,
|
|
64
|
-
fields: contentModel.fields,
|
|
65
|
-
layout: contentModel.layout
|
|
66
|
-
}, formProps
|
|
83
|
+
fields: contentModel.fields || [],
|
|
84
|
+
layout: contentModel.layout || []
|
|
85
|
+
}, formProps, {
|
|
86
|
+
Bind: formProps.Bind
|
|
87
|
+
})));
|
|
67
88
|
});
|
|
68
89
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ContentEntryForm.tsx"],"names":["React","useCallback","useEffect","useRef","RenderFieldElement","styled","Form","plugins","CircularProgress","useContentEntryForm","Fields","FormWrapper","height","overflow","ContentEntryForm","onForm","props","contentModel","loading","data","onChange","onSubmit","invalidFields","ref","current","formRenderer","byType","find","pl","modelId","renderCustomLayout","formRenderProps","fields","reduce","acc","field","fieldId","Bind","render","formProps","layout"],"mappings":"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","sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport RenderFieldElement from \"./RenderFieldElement\";\nimport styled from \"@emotion/styled\";\nimport { Form } from \"@webiny/form\";\nimport { FormAPI, FormRenderPropParams } from \"@webiny/form/types\";\nimport { plugins } from \"@webiny/plugins\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { CmsContentFormRendererPlugin } from \"~/types\";\nimport { useContentEntryForm, UseContentEntryFormParams } from \"./useContentEntryForm\";\nimport { Fields } from \"./Fields\";\n\nconst FormWrapper = styled(\"div\")({\n height: \"calc(100vh - 260px)\",\n overflow: \"auto\"\n});\n\ninterface ContentEntryFormProps extends UseContentEntryFormParams {\n onForm?: (form: FormAPI) => void;\n}\n\nexport const ContentEntryForm: React.FC<ContentEntryFormProps> = ({ onForm, ...props }) => {\n const { contentModel } = props;\n const { loading, data, onChange, onSubmit, invalidFields } = useContentEntryForm(props);\n\n const ref = useRef<FormAPI | null>(null);\n\n useEffect(() => {\n if (typeof onForm !== \"function\" || !ref.current) {\n return;\n }\n onForm(ref.current);\n }, []);\n\n const formRenderer = plugins\n .byType<CmsContentFormRendererPlugin>(\"cms-content-form-renderer\")\n .find(pl => pl.modelId === contentModel.modelId);\n\n const renderCustomLayout = useCallback(\n (formRenderProps: FormRenderPropParams) => {\n const fields = contentModel.fields.reduce((acc, field) => {\n /**\n * TODO @ts-refactor\n * Figure out type for Bind.\n */\n acc[field.fieldId] = (\n <RenderFieldElement\n field={field}\n Bind={formRenderProps.Bind as any}\n contentModel={contentModel}\n />\n );\n\n return acc;\n }, {} as Record<string, React.ReactElement>);\n if (!formRenderer) {\n return <>{`Missing form renderer for modelId \"${contentModel.modelId}\".`}</>;\n }\n return formRenderer.render({\n ...formRenderProps,\n contentModel,\n fields,\n /**\n * TODO @ts-refactor\n * Figure out type for Bind.\n */\n Bind: formRenderProps.Bind as any\n });\n },\n [formRenderer]\n );\n\n return (\n <Form\n onChange={onChange}\n onSubmit={onSubmit}\n data={data}\n ref={ref}\n invalidFields={invalidFields}\n >\n {formProps => (\n <FormWrapper data-testid={\"cms-content-form\"}>\n {loading && <CircularProgress />}\n {formRenderer ? (\n renderCustomLayout(formProps)\n ) : (\n <Fields\n contentModel={contentModel}\n fields={contentModel.fields || []}\n layout={contentModel.layout || []}\n {...formProps}\n Bind={formProps.Bind as any}\n />\n )}\n </FormWrapper>\n )}\n </Form>\n );\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { CmsEditorContentModel } from "../../../types";
|
|
3
3
|
interface Props {
|
|
4
4
|
contentModel: CmsEditorContentModel;
|
|
5
5
|
}
|
|
6
|
-
export declare const ContentEntryFormPreview:
|
|
6
|
+
export declare const ContentEntryFormPreview: React.FC<Props>;
|
|
7
7
|
export {};
|
|
@@ -19,6 +19,10 @@ export var ContentEntryFormPreview = function ContentEntryFormPreview(props) {
|
|
|
19
19
|
});
|
|
20
20
|
var renderCustomLayout = useCallback(function (formRenderProps) {
|
|
21
21
|
var fields = contentModel.fields.reduce(function (acc, field) {
|
|
22
|
+
/**
|
|
23
|
+
* TODO @ts-refactor
|
|
24
|
+
* Figure out type for Bind.
|
|
25
|
+
*/
|
|
22
26
|
acc[field.fieldId] = /*#__PURE__*/React.createElement(RenderFieldElement, {
|
|
23
27
|
field: field,
|
|
24
28
|
Bind: formRenderProps.Bind,
|
|
@@ -26,7 +30,17 @@ export var ContentEntryFormPreview = function ContentEntryFormPreview(props) {
|
|
|
26
30
|
});
|
|
27
31
|
return acc;
|
|
28
32
|
}, {});
|
|
33
|
+
|
|
34
|
+
if (!formRenderer) {
|
|
35
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, "Missing form renderer for modelId \"".concat(contentModel.modelId, "\"."));
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
return formRenderer.render(_objectSpread(_objectSpread({}, formRenderProps), {}, {
|
|
39
|
+
/**
|
|
40
|
+
* TODO @ts-refactor
|
|
41
|
+
* Figure out type for Bind.
|
|
42
|
+
*/
|
|
43
|
+
Bind: formRenderProps.Bind,
|
|
30
44
|
contentModel: contentModel,
|
|
31
45
|
fields: fields
|
|
32
46
|
}));
|
|
@@ -37,7 +51,9 @@ export var ContentEntryFormPreview = function ContentEntryFormPreview(props) {
|
|
|
37
51
|
}, formRenderer ? renderCustomLayout(formProps) : /*#__PURE__*/React.createElement(Fields, Object.assign({
|
|
38
52
|
contentModel: contentModel,
|
|
39
53
|
fields: contentModel.fields,
|
|
40
|
-
layout: contentModel.layout
|
|
41
|
-
}, formProps
|
|
54
|
+
layout: contentModel.layout || []
|
|
55
|
+
}, formProps, {
|
|
56
|
+
Bind: formProps.Bind
|
|
57
|
+
})));
|
|
42
58
|
});
|
|
43
59
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ContentEntryFormPreview.tsx"],"names":["React","useCallback","styled","Form","plugins","RenderFieldElement","Fields","FormWrapper","height","overflow","ContentEntryFormPreview","props","contentModel","formRenderer","byType","find","pl","modelId","renderCustomLayout","formRenderProps","fields","reduce","acc","field","fieldId","Bind","render","formProps","layout"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,WAAhB,QAAmC,OAAnC;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,SAASC,IAAT,QAA2C,cAA3C;AACA,SAASC,OAAT,QAAwB,iBAAxB;AACA,OAAOC,kBAAP;AAEA,SAASC,MAAT;AAEA,IAAMC,WAAW,gBAAGL,MAAH,CAAU,KAAV;AAAA;AAAA;AAAA,GAAiB;AAC9BM,EAAAA,MAAM,EAAE,qBADsB;AAE9BC,EAAAA,QAAQ,EAAE;AAFoB,CAAjB,CAAjB;AASA,OAAO,IAAMC,uBAAwC,GAAG,SAA3CA,uBAA2C,CAAAC,KAAK,EAAI;AAC7D,MAAQC,YAAR,GAAyBD,KAAzB,CAAQC,YAAR;AAEA,MAAMC,YAAY,GAAGT,OAAO,CACvBU,MADgB,CACqB,2BADrB,EAEhBC,IAFgB,CAEX,UAAAC,EAAE;AAAA,WAAIA,EAAE,CAACC,OAAH,KAAeL,YAAY,CAACK,OAAhC;AAAA,GAFS,CAArB;AAIA,MAAMC,kBAAkB,GAAGjB,WAAW,CAClC,UAACkB,eAAD,EAA2C;AACvC,QAAMC,MAAM,GAAGR,YAAY,CAACQ,MAAb,CAAoBC,MAApB,CAA2B,UAACC,GAAD,EAAMC,KAAN,EAAgB;AACtD;AAChB;AACA;AACA;AACgBD,MAAAA,GAAG,CAACC,KAAK,CAACC,OAAP,CAAH,gBACI,oBAAC,kBAAD;AACI,QAAA,KAAK,EAAED,KADX;AAEI,QAAA,IAAI,EAAEJ,eAAe,CAACM,IAF1B;AAGI,QAAA,YAAY,EAAEb;AAHlB,QADJ;AAQA,aAAOU,GAAP;AACH,KAdc,EAcZ,EAdY,CAAf;;AAeA,QAAI,CAACT,YAAL,EAAmB;AACf,0BAAO,wFAAyCD,YAAY,CAACK,OAAtD,SAAP;AACH;;AACD,WAAOJ,YAAY,CAACa,MAAb,iCACAP,eADA;AAEH;AAChB;AACA;AACA;AACgBM,MAAAA,IAAI,EAAEN,eAAe,CAACM,IANnB;AAOHb,MAAAA,YAAY,EAAZA,YAPG;AAQHQ,MAAAA,MAAM,EAANA;AARG,OAAP;AAUH,GA9BiC,EA+BlC,CAACP,YAAD,EAAeD,YAAY,CAACQ,MAA5B,CA/BkC,CAAtC;AAkCA,sBACI,oBAAC,IAAD,QACK,UAAAO,SAAS;AAAA,wBACN,oBAAC,WAAD;AAAa,qBAAa;AAA1B,OACKd,YAAY,GACTK,kBAAkB,CAACS,SAAD,CADT,gBAGT,oBAAC,MAAD;AACI,MAAA,YAAY,EAAEf,YADlB;AAEI,MAAA,MAAM,EAAEA,YAAY,CAACQ,MAFzB;AAGI,MAAA,MAAM,EAAER,YAAY,CAACgB,MAAb,IAAuB;AAHnC,OAIQD,SAJR;AAKI,MAAA,IAAI,EAAEA,SAAS,CAACF;AALpB,OAJR,CADM;AAAA,GADd,CADJ;AAmBH,CA5DM","sourcesContent":["import React, { useCallback } from \"react\";\nimport styled from \"@emotion/styled\";\nimport { Form, FormRenderPropParams } from \"@webiny/form\";\nimport { plugins } from \"@webiny/plugins\";\nimport RenderFieldElement from \"./RenderFieldElement\";\nimport { CmsContentFormRendererPlugin, CmsEditorContentModel } from \"~/types\";\nimport { Fields } from \"~/admin/components/ContentEntryForm/Fields\";\n\nconst FormWrapper = styled(\"div\")({\n height: \"calc(100vh - 260px)\",\n overflow: \"auto\"\n});\n\ninterface Props {\n contentModel: CmsEditorContentModel;\n}\n\nexport const ContentEntryFormPreview: React.FC<Props> = props => {\n const { contentModel } = props;\n\n const formRenderer = plugins\n .byType<CmsContentFormRendererPlugin>(\"cms-content-form-renderer\")\n .find(pl => pl.modelId === contentModel.modelId);\n\n const renderCustomLayout = useCallback(\n (formRenderProps: FormRenderPropParams) => {\n const fields = contentModel.fields.reduce((acc, field) => {\n /**\n * TODO @ts-refactor\n * Figure out type for Bind.\n */\n acc[field.fieldId] = (\n <RenderFieldElement\n field={field}\n Bind={formRenderProps.Bind as any}\n contentModel={contentModel}\n />\n );\n\n return acc;\n }, {} as Record<string, React.ReactElement>);\n if (!formRenderer) {\n return <>{`Missing form renderer for modelId \"${contentModel.modelId}\".`}</>;\n }\n return formRenderer.render({\n ...formRenderProps,\n /**\n * TODO @ts-refactor\n * Figure out type for Bind.\n */\n Bind: formRenderProps.Bind as any,\n contentModel,\n fields\n });\n },\n [formRenderer, contentModel.fields]\n );\n\n return (\n <Form>\n {formProps => (\n <FormWrapper data-testid={\"cms-content-form\"}>\n {formRenderer ? (\n renderCustomLayout(formProps)\n ) : (\n <Fields\n contentModel={contentModel}\n fields={contentModel.fields}\n layout={contentModel.layout || []}\n {...formProps}\n Bind={formProps.Bind as any}\n />\n )}\n </FormWrapper>\n )}\n </Form>\n );\n};\n"]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import { BindComponent } from "
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CmsEditorContentModel, CmsEditorField, CmsEditorFieldsLayout, BindComponent } from "../../../types";
|
|
3
|
+
interface FieldsProps {
|
|
5
4
|
Bind: BindComponent;
|
|
6
5
|
contentModel: CmsEditorContentModel;
|
|
7
6
|
fields: CmsEditorField[];
|
|
8
7
|
layout: CmsEditorFieldsLayout;
|
|
9
8
|
gridClassName?: string;
|
|
10
9
|
}
|
|
11
|
-
export declare const Fields:
|
|
10
|
+
export declare const Fields: React.FC<FieldsProps>;
|
|
12
11
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Fields.tsx"],"names":["React","Cell","Grid","RenderFieldElement","getFieldById","fields","id","find","field","Fields","Bind","layout","contentModel","gridClassName","map","row","rowIndex","fieldId","Math","floor","length"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,iBAA3B;AACA,OAAOC,kBAAP;;AAgBA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,MAAD,EAA2BC,EAA3B,EAAiE;AAClF,SAAOD,MAAM,CAACE,IAAP,CAAY,UAAAC,KAAK;AAAA,WAAIA,KAAK,CAACF,EAAN,KAAaA,EAAjB;AAAA,GAAjB,KAAyC,IAAhD;AACH,CAFD;;AAIA,OAAO,IAAMG,MAA6B,GAAG,SAAhCA,MAAgC,OAMvC;AAAA,MALFC,IAKE,QALFA,IAKE;AAAA,MAJFL,MAIE,QAJFA,MAIE;AAAA,MAHFM,MAGE,QAHFA,MAGE;AAAA,MAFFC,YAEE,QAFFA,YAEE;AAAA,MADFC,aACE,QADFA,aACE;AACF,sBACI,oBAAC,IAAD;AAAM,IAAA,SAAS,EAAEA;AAAjB,KACKF,MAAM,CAACG,GAAP,CAAW,UAACC,GAAD,EAAMC,QAAN;AAAA,wBACR,oBAAC,KAAD,CAAO,QAAP;AAAgB,MAAA,GAAG,EAAEA;AAArB,OACKD,GAAG,CAACD,GAAJ,CAAQ,UAAAG,OAAO;AAAA,0BACZ,oBAAC,IAAD;AAAM,QAAA,IAAI,EAAEC,IAAI,CAACC,KAAL,CAAW,KAAKJ,GAAG,CAACK,MAApB,CAAZ;AAAyC,QAAA,GAAG,EAAEH;AAA9C,sBACI,oBAAC,kBAAD;AACI,QAAA,KAAK,EAAEb,YAAY,CAACC,MAAD,EAASY,OAAT,CADvB;AAEI,QAAA,IAAI,EAAEP,IAFV;AAGI,QAAA,YAAY,EAAEE;AAHlB,QADJ,CADY;AAAA,KAAf,CADL,CADQ;AAAA,GAAX,CADL,CADJ;AAiBH,CAxBM","sourcesContent":["import React from \"react\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport RenderFieldElement from \"./RenderFieldElement\";\nimport {\n CmsEditorContentModel,\n CmsEditorField,\n CmsEditorFieldsLayout,\n BindComponent\n} from \"~/types\";\n\ninterface FieldsProps {\n Bind: BindComponent;\n contentModel: CmsEditorContentModel;\n fields: CmsEditorField[];\n layout: CmsEditorFieldsLayout;\n gridClassName?: string;\n}\n\nconst getFieldById = (fields: CmsEditorField[], id: string): CmsEditorField | null => {\n return fields.find(field => field.id === id) || null;\n};\n\nexport const Fields: React.FC<FieldsProps> = ({\n Bind,\n fields,\n layout,\n contentModel,\n gridClassName\n}) => {\n return (\n <Grid className={gridClassName}>\n {layout.map((row, rowIndex) => (\n <React.Fragment key={rowIndex}>\n {row.map(fieldId => (\n <Cell span={Math.floor(12 / row.length)} key={fieldId}>\n <RenderFieldElement\n field={getFieldById(fields, fieldId) as CmsEditorField}\n Bind={Bind}\n contentModel={contentModel}\n />\n </Cell>\n ))}\n </React.Fragment>\n ))}\n </Grid>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Label.tsx"],"names":["React","css","classNames","Typography","style","label","marginBottom","Label","children"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,GAAT,QAAoB,SAApB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,UAAT,QAA2B,uBAA3B;AAEA,IAAMC,KAAK,GAAG;AACVC,EAAAA,KAAK,eAAEJ,GAAG,CAAC;AACPK,IAAAA,YAAY,EAAE;AADP,GAAD;AADA,CAAd;;AAMA,IAAMC,KAAe,GAAG,SAAlBA,KAAkB;AAAA,MAAGC,QAAH,QAAGA,QAAH;AAAA,sBACpB;AACI,IAAA,SAAS,EAAEN,UAAU,CACjB,mEADiB,EAEjBE,KAAK,CAACC,KAFW;AADzB,kBAMI,oBAAC,UAAD;AAAY,IAAA,GAAG,EAAE;AAAjB,KAA+BG,QAA/B,CANJ,CADoB;AAAA,CAAxB;;AAWA,eAAeD,KAAf","sourcesContent":["import React from \"react\";\nimport { css } from \"emotion\";\nimport classNames from \"classnames\";\nimport { Typography } from \"@webiny/ui/Typography\";\n\nconst style = {\n label: css({\n marginBottom: \"5px !important\"\n })\n};\n\nconst Label: React.FC = ({ children }) => (\n <div\n className={classNames(\n \"mdc-text-field-helper-text mdc-text-field-helper-text--persistent\",\n style.label\n )}\n >\n <Typography use={\"subtitle2\"}>{children}</Typography>\n </div>\n);\n\nexport default Label;\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BindComponent } from "
|
|
3
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CmsEditorField, CmsEditorContentModel, BindComponent } from "../../../types";
|
|
3
|
+
interface RenderFieldElementProps {
|
|
4
4
|
field: CmsEditorField;
|
|
5
5
|
Bind: BindComponent;
|
|
6
6
|
contentModel: CmsEditorContentModel;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
|
+
declare const RenderFieldElement: React.FC<RenderFieldElementProps>;
|
|
8
9
|
export default RenderFieldElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["RenderFieldElement.tsx"],"names":["React","get","i18n","Label","useBind","useRenderPlugins","t","ns","RenderFieldElement","props","renderPlugins","field","Bind","contentModel","getBind","renderPlugin","find","plugin","renderer","rendererName","fieldName","fieldId","render"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,GAAP,MAAgB,YAAhB;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,OAAOC,KAAP;AACA,SAASC,OAAT;AACA,SAASC,gBAAT;AAEA,IAAMC,CAAC,GAAGJ,IAAI,CAACK,EAAL,CAAQ,gDAAR,CAAV;;AAOA,IAAMC,kBAAqD,GAAG,SAAxDA,kBAAwD,CAAAC,KAAK,EAAI;AACnE,MAAMC,aAAa,GAAGL,gBAAgB,EAAtC;AACA,MAAQM,KAAR,GAAsCF,KAAtC,CAAQE,KAAR;AAAA,MAAeC,IAAf,GAAsCH,KAAtC,CAAeG,IAAf;AAAA,MAAqBC,YAArB,GAAsCJ,KAAtC,CAAqBI,YAArB;AACA,MAAMC,OAAO,GAAGV,OAAO,CAAC;AAAEQ,IAAAA,IAAI,EAAJA,IAAF;AAAQD,IAAAA,KAAK,EAALA;AAAR,GAAD,CAAvB;AAEA,MAAMI,YAAY,GAAGL,aAAa,CAACM,IAAd,CACjB,UAAAC,MAAM;AAAA,WAAIA,MAAM,CAACC,QAAP,CAAgBC,YAAhB,KAAiClB,GAAG,CAACU,KAAD,EAAQ,eAAR,CAAxC;AAAA,GADW,CAArB;;AAIA,MAAI,CAACI,YAAL,EAAmB;AACf,WAAOT,CAAC,kIAAD,CAA+D;AAClEc,MAAAA,SAAS,eAAE,oCAAST,KAAK,CAACU,OAAf;AADuD,KAA/D,CAAP;AAGH;;AAED,SAAON,YAAY,CAACG,QAAb,CAAsBI,MAAtB,CAA6B;AAAEX,IAAAA,KAAK,EAALA,KAAF;AAASG,IAAAA,OAAO,EAAPA,OAAT;AAAkBX,IAAAA,KAAK,EAALA,KAAlB;AAAyBU,IAAAA,YAAY,EAAZA;AAAzB,GAA7B,CAAP;AACH,CAhBD;;AAkBA,eAAeL,kBAAf","sourcesContent":["import React from \"react\";\nimport { CmsEditorField, CmsEditorContentModel, BindComponent } from \"~/types\";\nimport get from \"lodash/get\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport Label from \"./Label\";\nimport { useBind } from \"./useBind\";\nimport { useRenderPlugins } from \"./useRenderPlugins\";\n\nconst t = i18n.ns(\"app-headless-cms/admin/components/content-form\");\n\ninterface RenderFieldElementProps {\n field: CmsEditorField;\n Bind: BindComponent;\n contentModel: CmsEditorContentModel;\n}\nconst RenderFieldElement: React.FC<RenderFieldElementProps> = props => {\n const renderPlugins = useRenderPlugins();\n const { field, Bind, contentModel } = props;\n const getBind = useBind({ Bind, field });\n\n const renderPlugin = renderPlugins.find(\n plugin => plugin.renderer.rendererName === get(field, \"renderer.name\")\n );\n\n if (!renderPlugin) {\n return t`Cannot render \"{fieldName}\" field - field renderer missing.`({\n fieldName: <strong>{field.fieldId}</strong>\n });\n }\n\n return renderPlugin.renderer.render({ field, getBind, Label, contentModel });\n};\n\nexport default RenderFieldElement;\n"]}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { CmsEditorFieldValidator } from "../../../../types";
|
|
2
|
+
import { Validator } from "@webiny/validation/types";
|
|
3
|
+
export declare const createValidators: (validation: CmsEditorFieldValidator[]) => Validator[];
|
|
@@ -3,16 +3,16 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
import { plugins } from "@webiny/plugins";
|
|
4
4
|
export var createValidators = function createValidators(validation) {
|
|
5
5
|
var validatorPlugins = plugins.byType("cms-model-field-validator");
|
|
6
|
-
return validation.
|
|
6
|
+
return validation.reduce(function (collection, item) {
|
|
7
7
|
var validatorPlugin = validatorPlugins.find(function (plugin) {
|
|
8
8
|
return plugin.validator.name === item.name;
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
if (!validatorPlugin || typeof validatorPlugin.validator.validate !== "function") {
|
|
12
|
-
return
|
|
12
|
+
return collection;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
var validator = /*#__PURE__*/function () {
|
|
16
16
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
|
17
17
|
var isInvalid, result;
|
|
18
18
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -50,9 +50,12 @@ export var createValidators = function createValidators(validation) {
|
|
|
50
50
|
}, _callee, null, [[0, 7]]);
|
|
51
51
|
}));
|
|
52
52
|
|
|
53
|
-
return function (_x) {
|
|
53
|
+
return function validator(_x) {
|
|
54
54
|
return _ref.apply(this, arguments);
|
|
55
55
|
};
|
|
56
56
|
}();
|
|
57
|
-
|
|
57
|
+
|
|
58
|
+
collection.push(validator);
|
|
59
|
+
return collection;
|
|
60
|
+
}, []);
|
|
58
61
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createValidators.ts"],"names":["plugins","createValidators","validation","validatorPlugins","byType","reduce","collection","item","validatorPlugin","find","plugin","validator","name","validate","value","result","isInvalid","Error","message","push"],"mappings":";;AAAA,SAASA,OAAT,QAAwB,iBAAxB;AAIA,OAAO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,UAAD,EAAwD;AACpF,MAAMC,gBAAgB,GAAGH,OAAO,CAACI,MAAR,CACrB,2BADqB,CAAzB;AAIA,SAAOF,UAAU,CAACG,MAAX,CAAkB,UAACC,UAAD,EAAaC,IAAb,EAAsB;AAC3C,QAAMC,eAAe,GAAGL,gBAAgB,CAACM,IAAjB,CACpB,UAAAC,MAAM;AAAA,aAAIA,MAAM,CAACC,SAAP,CAAiBC,IAAjB,KAA0BL,IAAI,CAACK,IAAnC;AAAA,KADc,CAAxB;;AAIA,QAAI,CAACJ,eAAD,IAAoB,OAAOA,eAAe,CAACG,SAAhB,CAA0BE,QAAjC,KAA8C,UAAtE,EAAkF;AAC9E,aAAOP,UAAP;AACH;;AAED,QAAMK,SAAS;AAAA,0EAAG,iBAAOG,KAAP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAGWN,eAAe,CAACG,SAAhB,CAA0BE,QAA1B,CAAmCC,KAAnC,EAA0CP,IAA1C,CAHX;;AAAA;AAGJQ,gBAAAA,MAHI;AAIVC,gBAAAA,SAAS,GAAGD,MAAM,KAAK,KAAvB;AAJU;AAAA;;AAAA;AAAA;AAAA;AAMVC,gBAAAA,SAAS,GAAG,IAAZ;;AANU;AAAA,qBASVA,SATU;AAAA;AAAA;AAAA;;AAAA,sBAUJ,IAAIC,KAAJ,CAAUV,IAAI,CAACW,OAAL,IAAgB,gBAA1B,CAVI;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,OAAH;;AAAA,sBAATP,SAAS;AAAA;AAAA;AAAA,OAAf;;AAaAL,IAAAA,UAAU,CAACa,IAAX,CAAgBR,SAAhB;AACA,WAAOL,UAAP;AACH,GAxBM,EAwBJ,EAxBI,CAAP;AAyBH,CA9BM","sourcesContent":["import { plugins } from \"@webiny/plugins\";\nimport { CmsEditorFieldValidator, CmsModelFieldValidatorPlugin } from \"~/types\";\nimport { Validator } from \"@webiny/validation/types\";\n\nexport const createValidators = (validation: CmsEditorFieldValidator[]): Validator[] => {\n const validatorPlugins = plugins.byType<CmsModelFieldValidatorPlugin>(\n \"cms-model-field-validator\"\n );\n\n return validation.reduce((collection, item) => {\n const validatorPlugin = validatorPlugins.find(\n plugin => plugin.validator.name === item.name\n );\n\n if (!validatorPlugin || typeof validatorPlugin.validator.validate !== \"function\") {\n return collection;\n }\n\n const validator = async (value: string | string[]) => {\n let isInvalid;\n try {\n const result = await validatorPlugin.validator.validate(value, item);\n isInvalid = result === false;\n } catch (e) {\n isInvalid = true;\n }\n\n if (isInvalid) {\n throw new Error(item.message || \"Invalid value.\");\n }\n };\n collection.push(validator);\n return collection;\n }, [] as Validator[]);\n};\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CmsEditorField } from "../../../../types";
|
|
2
|
+
import { BindComponentRenderProp } from "@webiny/form";
|
|
3
|
+
interface GetValueParams {
|
|
4
|
+
bind: BindComponentRenderProp;
|
|
5
|
+
field: Pick<CmsEditorField, "multipleValues">;
|
|
6
|
+
index: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const getValue: (params: GetValueParams) => string;
|
|
9
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export var getValue = function getValue(
|
|
2
|
-
var bind =
|
|
3
|
-
field =
|
|
4
|
-
index =
|
|
1
|
+
export var getValue = function getValue(params) {
|
|
2
|
+
var bind = params.bind,
|
|
3
|
+
field = params.field,
|
|
4
|
+
index = params.index;
|
|
5
5
|
var value = bind.value || null;
|
|
6
6
|
|
|
7
7
|
if (field.multipleValues) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getValue.ts"],"names":["getValue","params","bind","field","index","value","multipleValues","Array","isArray"],"mappings":"AAQA,OAAO,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,MAAD,EAAoC;AACxD,MAAQC,IAAR,GAA+BD,MAA/B,CAAQC,IAAR;AAAA,MAAcC,KAAd,GAA+BF,MAA/B,CAAcE,KAAd;AAAA,MAAqBC,KAArB,GAA+BH,MAA/B,CAAqBG,KAArB;AACA,MAAIC,KAAK,GAAGH,IAAI,CAACG,KAAL,IAAc,IAA1B;;AAEA,MAAIF,KAAK,CAACG,cAAV,EAA0B;AACtB,QAAI,CAACC,KAAK,CAACC,OAAN,CAAcH,KAAd,CAAL,EAA2B;AACvBA,MAAAA,KAAK,GAAG,EAAR;AACH;;AAED,QAAID,KAAK,IAAI,CAAb,EAAgB;AACZ,aAAOC,KAAK,CAACD,KAAD,CAAL,IAAgB,IAAvB;AACH;;AAED,WAAOC,KAAP;AACH;;AAED,SAAOA,KAAP;AACH,CAjBM","sourcesContent":["import { CmsEditorField } from \"~/types\";\nimport { BindComponentRenderProp } from \"@webiny/form\";\n\ninterface GetValueParams {\n bind: BindComponentRenderProp;\n field: Pick<CmsEditorField, \"multipleValues\">;\n index: number;\n}\nexport const getValue = (params: GetValueParams): string => {\n const { bind, field, index } = params;\n let value = bind.value || null;\n\n if (field.multipleValues) {\n if (!Array.isArray(value)) {\n value = [];\n }\n\n if (index >= 0) {\n return value[index] || null;\n }\n\n return value;\n }\n\n return value;\n};\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { CmsEditorField } from "../../../../types";
|
|
2
|
+
import { BindComponentRenderProp } from "@webiny/form";
|
|
3
|
+
interface setValueParams {
|
|
4
|
+
value: string[];
|
|
5
|
+
bind: BindComponentRenderProp;
|
|
6
|
+
field: Pick<CmsEditorField, "multipleValues">;
|
|
7
|
+
index: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const setValue: (params: setValueParams) => void;
|
|
10
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
export var setValue = function setValue(
|
|
3
|
-
var value =
|
|
4
|
-
bind =
|
|
5
|
-
field =
|
|
6
|
-
index =
|
|
2
|
+
export var setValue = function setValue(params) {
|
|
3
|
+
var value = params.value,
|
|
4
|
+
bind = params.bind,
|
|
5
|
+
field = params.field,
|
|
6
|
+
index = params.index;
|
|
7
7
|
var newValue = field.multipleValues ? _toConsumableArray(bind.value || []) : bind.value;
|
|
8
8
|
|
|
9
9
|
if (field.multipleValues) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["setValue.ts"],"names":["setValue","params","value","bind","field","index","newValue","multipleValues","onChange"],"mappings":";AASA,OAAO,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,MAAD,EAAkC;AACtD,MAAQC,KAAR,GAAsCD,MAAtC,CAAQC,KAAR;AAAA,MAAeC,IAAf,GAAsCF,MAAtC,CAAeE,IAAf;AAAA,MAAqBC,KAArB,GAAsCH,MAAtC,CAAqBG,KAArB;AAAA,MAA4BC,KAA5B,GAAsCJ,MAAtC,CAA4BI,KAA5B;AACA,MAAIC,QAAQ,GAAGF,KAAK,CAACG,cAAN,sBAA4BJ,IAAI,CAACD,KAAL,IAAc,EAA1C,IAAiDC,IAAI,CAACD,KAArE;;AAEA,MAAIE,KAAK,CAACG,cAAV,EAA0B;AACtB,QAAIF,KAAK,IAAI,CAAb,EAAgB;AACZC,MAAAA,QAAQ,CAACD,KAAD,CAAR,GAAkBH,KAAlB;AACH,KAFD,MAEO;AACHI,MAAAA,QAAQ,GAAGJ,KAAX;AACH;AACJ,GAND,MAMO;AACHI,IAAAA,QAAQ,GAAGJ,KAAX;AACH;;AAEDC,EAAAA,IAAI,CAACK,QAAL,CAAcF,QAAd;AACH,CAfM","sourcesContent":["import { CmsEditorField } from \"~/types\";\nimport { BindComponentRenderProp } from \"@webiny/form\";\n\ninterface setValueParams {\n value: string[];\n bind: BindComponentRenderProp;\n field: Pick<CmsEditorField, \"multipleValues\">;\n index: number;\n}\nexport const setValue = (params: setValueParams): void => {\n const { value, bind, field, index } = params;\n let newValue = field.multipleValues ? [...(bind.value || [])] : bind.value;\n\n if (field.multipleValues) {\n if (index >= 0) {\n newValue[index] = value;\n } else {\n newValue = value;\n }\n } else {\n newValue = value;\n }\n\n bind.onChange(newValue);\n};\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BindComponent } from "
|
|
2
|
-
import { CmsEditorField } from "../../../types";
|
|
1
|
+
import { BindComponent, CmsEditorField } from "../../../types";
|
|
3
2
|
interface UseBindProps {
|
|
4
3
|
field: CmsEditorField;
|
|
5
|
-
Bind: BindComponent
|
|
6
|
-
parentName?: string;
|
|
7
|
-
};
|
|
4
|
+
Bind: BindComponent;
|
|
8
5
|
}
|
|
9
|
-
export
|
|
6
|
+
export interface GetBindCallable {
|
|
7
|
+
(index?: number): BindComponent;
|
|
8
|
+
}
|
|
9
|
+
export declare function useBind({ Bind: ParentBind, field }: UseBindProps): (index?: any) => BindComponent;
|
|
10
10
|
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Figure out correct types for this and packages/app-headless-cms/src/admin/plugins/fieldRenderers/DynamicSection.tsx files
|
|
6
|
+
* TODO @ts-refactor
|
|
7
|
+
*/
|
|
3
8
|
import React, { useRef, useCallback, cloneElement } from "react";
|
|
4
9
|
import { createValidators } from "./functions/createValidators";
|
|
5
10
|
export function useBind(_ref) {
|
|
@@ -24,11 +29,17 @@ export function useBind(_ref) {
|
|
|
24
29
|
var defaultValue = field.multipleValues ? [] : undefined;
|
|
25
30
|
var isMultipleValues = index === -1 && field.multipleValues;
|
|
26
31
|
var inputValidators = isMultipleValues ? listValidators : validators;
|
|
32
|
+
/**
|
|
33
|
+
* TODO @ts-refactor
|
|
34
|
+
*
|
|
35
|
+
* TS is complaining about validators property because UseBindParams.validators cannot be single validator??????
|
|
36
|
+
*/
|
|
37
|
+
// @ts-ignore
|
|
27
38
|
|
|
28
|
-
memoizedBindComponents.current[name] = function UseBind(
|
|
29
|
-
var childName =
|
|
30
|
-
childValidators =
|
|
31
|
-
children =
|
|
39
|
+
memoizedBindComponents.current[name] = function UseBind(params) {
|
|
40
|
+
var childName = params.name,
|
|
41
|
+
childValidators = params.validators,
|
|
42
|
+
children = params.children;
|
|
32
43
|
return /*#__PURE__*/React.createElement(ParentBind, {
|
|
33
44
|
name: childName || name,
|
|
34
45
|
validators: childValidators || inputValidators,
|
|
@@ -51,13 +62,15 @@ export function useBind(_ref) {
|
|
|
51
62
|
};
|
|
52
63
|
|
|
53
64
|
props.removeValue = function (index) {
|
|
54
|
-
if (index
|
|
55
|
-
|
|
56
|
-
_value = [].concat(_toConsumableArray(_value.slice(0, index)), _toConsumableArray(_value.slice(index + 1)));
|
|
57
|
-
bind.onChange(_value); // To make sure the field is still valid, we must trigger validation.
|
|
58
|
-
|
|
59
|
-
bind.form.validateInput(field.fieldId);
|
|
65
|
+
if (index < 0) {
|
|
66
|
+
return;
|
|
60
67
|
}
|
|
68
|
+
|
|
69
|
+
var value = bind.value;
|
|
70
|
+
value = [].concat(_toConsumableArray(value.slice(0, index)), _toConsumableArray(value.slice(index + 1)));
|
|
71
|
+
bind.onChange(value); // To make sure the field is still valid, we must trigger validation.
|
|
72
|
+
|
|
73
|
+
bind.form.validateInput(field.fieldId);
|
|
61
74
|
};
|
|
62
75
|
}
|
|
63
76
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useBind.tsx"],"names":["React","useRef","useCallback","cloneElement","createValidators","useBind","ParentBind","Bind","field","memoizedBindComponents","index","parentName","name","fieldId","undefined","filter","v","join","current","validators","validation","listValidators","listValidation","defaultValue","multipleValues","isMultipleValues","inputValidators","UseBind","params","childName","childValidators","children","bind","props","appendValue","newValue","onChange","value","prependValue","appendValues","newValues","removeValue","slice","form","validateInput"],"mappings":"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","sourcesContent":["/**\n * Figure out correct types for this and packages/app-headless-cms/src/admin/plugins/fieldRenderers/DynamicSection.tsx files\n * TODO @ts-refactor\n */\nimport React, { useRef, useCallback, cloneElement } from \"react\";\nimport { createValidators } from \"./functions/createValidators\";\nimport { BindComponent, CmsEditorField } from \"~/types\";\nimport { Validator } from \"@webiny/validation/types\";\n\ninterface UseBindProps {\n field: CmsEditorField;\n Bind: BindComponent;\n}\n\ninterface UseBindParams {\n name?: string;\n validators?: Validator[];\n children?: any;\n}\n\nexport interface GetBindCallable {\n (index?: number): BindComponent;\n}\n\nexport function useBind({ Bind: ParentBind, field }: UseBindProps) {\n const memoizedBindComponents = useRef<Record<string, BindComponent>>({});\n\n return useCallback(\n (index = -1) => {\n const { parentName } = ParentBind;\n // If there's a parent name assigned to the given Bind component, we need to include it in the new field \"name\".\n // This allows us to have nested fields (like \"object\" field with nested properties)\n const name = [parentName, field.fieldId, index >= 0 ? index : undefined]\n .filter(v => v !== undefined)\n .join(\".\");\n\n if (memoizedBindComponents.current[name]) {\n return memoizedBindComponents.current[name];\n }\n\n const validators = createValidators(field.validation || []);\n const listValidators = createValidators(field.listValidation || []);\n const defaultValue: string[] | undefined = field.multipleValues ? [] : undefined;\n const isMultipleValues = index === -1 && field.multipleValues;\n const inputValidators = isMultipleValues ? listValidators : validators;\n /**\n * TODO @ts-refactor\n *\n * TS is complaining about validators property because UseBindParams.validators cannot be single validator??????\n */\n // @ts-ignore\n memoizedBindComponents.current[name] = function UseBind(params: UseBindParams) {\n const { name: childName, validators: childValidators, children } = params;\n return (\n <ParentBind\n name={childName || name}\n validators={childValidators || inputValidators}\n defaultValue={index === -1 ? defaultValue : null}\n >\n {bind => {\n // Multiple-values functions below.\n const props = { ...bind };\n if (field.multipleValues && index === -1) {\n props.appendValue = (newValue: string) => {\n bind.onChange([...bind.value, newValue]);\n };\n props.prependValue = (newValue: string) => {\n bind.onChange([newValue, ...bind.value]);\n };\n props.appendValues = (newValues: string[]) => {\n bind.onChange([...bind.value, ...newValues]);\n };\n\n props.removeValue = (index: number) => {\n if (index < 0) {\n return;\n }\n let value = bind.value;\n value = [...value.slice(0, index), ...value.slice(index + 1)];\n\n bind.onChange(value);\n\n // To make sure the field is still valid, we must trigger validation.\n bind.form.validateInput(field.fieldId);\n };\n }\n\n if (typeof children === \"function\") {\n return children(props);\n }\n\n return cloneElement(children, props);\n }}\n </ParentBind>\n );\n };\n\n // We need to keep track of current field name, to support nested fields.\n memoizedBindComponents.current[name].parentName = name;\n\n return memoizedBindComponents.current[name];\n },\n [field.fieldId]\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from "react";
|
|
2
2
|
import { FormOnSubmit } from "@webiny/form";
|
|
3
|
-
import { CmsEditorContentModel, CmsEditorFieldRendererPlugin } from "../../../types";
|
|
3
|
+
import { CmsEditorContentEntry, CmsEditorContentModel, CmsEditorFieldRendererPlugin } from "../../../types";
|
|
4
4
|
interface UseContentEntryForm {
|
|
5
5
|
data: Record<string, any>;
|
|
6
6
|
loading: boolean;
|
|
@@ -12,9 +12,7 @@ interface UseContentEntryForm {
|
|
|
12
12
|
}
|
|
13
13
|
export interface UseContentEntryFormParams {
|
|
14
14
|
contentModel: CmsEditorContentModel;
|
|
15
|
-
entry
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
};
|
|
15
|
+
entry: Partial<CmsEditorContentEntry>;
|
|
18
16
|
onChange?: FormOnSubmit;
|
|
19
17
|
onSubmit?: FormOnSubmit;
|
|
20
18
|
addEntryToListCache: boolean;
|