@webiny/app-headless-cms 0.0.0-mt-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -0
- package/admin/components/ContentEntryForm/ContentEntryForm.d.ts +8 -0
- package/admin/components/ContentEntryForm/ContentEntryForm.js +68 -0
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.d.ts +7 -0
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js +43 -0
- package/admin/components/ContentEntryForm/Fields.d.ts +12 -0
- package/admin/components/ContentEntryForm/Fields.js +33 -0
- package/admin/components/ContentEntryForm/Label.d.ts +5 -0
- package/admin/components/ContentEntryForm/Label.js +20 -0
- package/admin/components/ContentEntryForm/RenderFieldElement.d.ts +8 -0
- package/admin/components/ContentEntryForm/RenderFieldElement.js +40 -0
- package/admin/components/ContentEntryForm/functions/createValidators.d.ts +1 -0
- package/admin/components/ContentEntryForm/functions/createValidators.js +58 -0
- package/admin/components/ContentEntryForm/functions/getValue.d.ts +5 -0
- package/admin/components/ContentEntryForm/functions/getValue.js +20 -0
- package/admin/components/ContentEntryForm/functions/setValue.d.ts +6 -0
- package/admin/components/ContentEntryForm/functions/setValue.js +20 -0
- package/admin/components/ContentEntryForm/useBind.d.ts +10 -0
- package/admin/components/ContentEntryForm/useBind.js +76 -0
- package/admin/components/ContentEntryForm/useContentEntryForm.d.ts +22 -0
- package/admin/components/ContentEntryForm/useContentEntryForm.js +338 -0
- package/admin/components/ContentEntryForm/useRenderPlugins.d.ts +2 -0
- package/admin/components/ContentEntryForm/useRenderPlugins.js +7 -0
- package/admin/components/ContentModelEditor/Context.d.ts +23 -0
- package/admin/components/ContentModelEditor/Context.js +218 -0
- package/admin/components/ContentModelEditor/Editor.d.ts +3 -0
- package/admin/components/ContentModelEditor/Editor.js +138 -0
- package/admin/components/ContentModelEditor/FieldsSidebar.d.ts +4 -0
- package/admin/components/ContentModelEditor/FieldsSidebar.js +91 -0
- package/admin/components/ContentModelEditor/Header.d.ts +2 -0
- package/admin/components/ContentModelEditor/Header.js +24 -0
- package/admin/components/ContentModelEditor/PreviewTab.d.ts +2 -0
- package/admin/components/ContentModelEditor/PreviewTab.js +36 -0
- package/admin/components/ContentModelEditor/icons/round-assignment-24px.svg +4 -0
- package/admin/components/ContentModelEditor/icons/round-drag_indicator-24px.svg +4 -0
- package/admin/components/ContentModelEditor/useContentModelEditor.d.ts +1 -0
- package/admin/components/ContentModelEditor/useContentModelEditor.js +11 -0
- package/admin/components/DragPreview.d.ts +2 -0
- package/admin/components/DragPreview.js +98 -0
- package/admin/components/Draggable.d.ts +14 -0
- package/admin/components/Draggable.js +49 -0
- package/admin/components/DropZone/Center.d.ts +12 -0
- package/admin/components/DropZone/Center.js +60 -0
- package/admin/components/DropZone/Horizontal.d.ts +9 -0
- package/admin/components/DropZone/Horizontal.js +83 -0
- package/admin/components/DropZone/Vertical.d.ts +10 -0
- package/admin/components/DropZone/Vertical.js +79 -0
- package/admin/components/DropZone/index.d.ts +4 -0
- package/admin/components/DropZone/index.js +4 -0
- package/admin/components/Droppable.d.ts +23 -0
- package/admin/components/Droppable.js +45 -0
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.d.ts +3 -0
- package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js +83 -0
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.d.ts +10 -0
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +120 -0
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.d.ts +5 -0
- package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js +55 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.d.ts +10 -0
- package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js +121 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.d.ts +6 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/getValue.js +16 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.d.ts +7 -0
- package/admin/components/FieldEditor/EditFieldDialog/functions/setValue.js +21 -0
- package/admin/components/FieldEditor/EditFieldDialog.d.ts +9 -0
- package/admin/components/FieldEditor/EditFieldDialog.js +231 -0
- package/admin/components/FieldEditor/Field.d.ts +3 -0
- package/admin/components/FieldEditor/Field.js +179 -0
- package/admin/components/FieldEditor/FieldEditor.d.ts +12 -0
- package/admin/components/FieldEditor/FieldEditor.js +166 -0
- package/admin/components/FieldEditor/FieldEditorContext.d.ts +53 -0
- package/admin/components/FieldEditor/FieldEditorContext.js +330 -0
- package/admin/components/FieldEditor/Styled.d.ts +6 -0
- package/admin/components/FieldEditor/Styled.js +54 -0
- package/admin/components/FieldEditor/index.d.ts +2 -0
- package/admin/components/FieldEditor/index.js +2 -0
- package/admin/components/FieldEditor/useFieldEditor.d.ts +1 -0
- package/admin/components/FieldEditor/useFieldEditor.js +5 -0
- package/admin/components/FieldEditor/utils/deleteField.d.ts +10 -0
- package/admin/components/FieldEditor/utils/deleteField.js +34 -0
- package/admin/components/FieldEditor/utils/getFieldPosition.d.ts +6 -0
- package/admin/components/FieldEditor/utils/getFieldPosition.js +20 -0
- package/admin/components/FieldEditor/utils/index.d.ts +4 -0
- package/admin/components/FieldEditor/utils/index.js +4 -0
- package/admin/components/FieldEditor/utils/moveField.d.ts +7 -0
- package/admin/components/FieldEditor/utils/moveField.js +51 -0
- package/admin/components/FieldEditor/utils/moveRow.d.ts +9 -0
- package/admin/components/FieldEditor/utils/moveRow.js +10 -0
- package/admin/constants/statusLabels.d.ts +8 -0
- package/admin/constants/statusLabels.js +13 -0
- package/admin/contexts/Cms/NetworkError.d.ts +2 -0
- package/admin/contexts/Cms/NetworkError.js +7 -0
- package/admin/contexts/Cms/index.d.ts +16 -0
- package/admin/contexts/Cms/index.js +43 -0
- package/admin/elements/ContentGroupMenuElement.d.ts +3 -0
- package/admin/elements/ContentGroupMenuElement.js +17 -0
- package/admin/elements/ContentModelMenuElement.d.ts +3 -0
- package/admin/elements/ContentModelMenuElement.js +17 -0
- package/admin/elements/NothingToShowElement.d.ts +15 -0
- package/admin/elements/NothingToShowElement.js +88 -0
- package/admin/graphql/contentEntries.d.ts +12 -0
- package/admin/graphql/contentEntries.js +68 -0
- package/admin/graphql/contentModels.d.ts +4 -0
- package/admin/graphql/contentModels.js +9 -0
- package/admin/graphql/createFieldsList.d.ts +2 -0
- package/admin/graphql/createFieldsList.js +21 -0
- package/admin/hooks/index.d.ts +5 -0
- package/admin/hooks/index.js +5 -0
- package/admin/hooks/useApolloClient.d.ts +2 -0
- package/admin/hooks/useApolloClient.js +10 -0
- package/admin/hooks/useCms.d.ts +3 -0
- package/admin/hooks/useCms.js +14 -0
- package/admin/hooks/useLazyQuery.d.ts +2 -0
- package/admin/hooks/useLazyQuery.js +16 -0
- package/admin/hooks/useMutation.d.ts +2 -0
- package/admin/hooks/useMutation.js +16 -0
- package/admin/hooks/usePermission.d.ts +27 -0
- package/admin/hooks/usePermission.js +218 -0
- package/admin/hooks/useQuery.d.ts +2 -0
- package/admin/hooks/useQuery.js +17 -0
- package/admin/icons/add.svg +5 -0
- package/admin/icons/arrow_forward-24px.svg +1 -0
- package/admin/icons/baseline-autorenew-24px.svg +4 -0
- package/admin/icons/beenhere.svg +1 -0
- package/admin/icons/call_split-24px.svg +4 -0
- package/admin/icons/close.svg +13 -0
- package/admin/icons/delete.svg +12 -0
- package/admin/icons/devices_other-black-24px.svg +1 -0
- package/admin/icons/done-24px.svg +1 -0
- package/admin/icons/edit.svg +17 -0
- package/admin/icons/emoji_people-24px.svg +1 -0
- package/admin/icons/gesture.svg +1 -0
- package/admin/icons/help_outline.svg +1 -0
- package/admin/icons/how_to_vote-24px.svg +4 -0
- package/admin/icons/info.svg +1 -0
- package/admin/icons/lock.svg +1 -0
- package/admin/icons/more_vert.svg +12 -0
- package/admin/icons/publish.svg +1 -0
- package/admin/icons/round-arrow_drop_down-24px.svg +12 -0
- package/admin/icons/round-drag_indicator-24px.svg +4 -0
- package/admin/icons/round-translate-24px.svg +4 -0
- package/admin/icons/rule-24px.svg +1 -0
- package/admin/icons/title-24px.svg +1 -0
- package/admin/icons/unpublish.svg +4 -0
- package/admin/icons/view_list.svg +1 -0
- package/admin/icons/visibility.svg +16 -0
- package/admin/plugins/apiInformation/index.d.ts +3 -0
- package/admin/plugins/apiInformation/index.js +59 -0
- package/admin/plugins/apiInformation/placeholder.manage.graphql +18 -0
- package/admin/plugins/apiInformation/placeholder.preview.graphql +15 -0
- package/admin/plugins/apiInformation/placeholder.read.graphql +16 -0
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.d.ts +21 -0
- package/admin/plugins/definitions/CmsEditorFieldValidatorFileTypePlugin.js +61 -0
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.d.ts +10 -0
- package/admin/plugins/definitions/CmsFieldValidatorFileTypePlugin.js +36 -0
- package/admin/plugins/editor/defaultBar/BackButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/BackButton.js +21 -0
- package/admin/plugins/editor/defaultBar/CreateContentButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/CreateContentButton.js +46 -0
- package/admin/plugins/editor/defaultBar/Divider.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/Divider.js +11 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.d.ts +6 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js +90 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsButton.js +27 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +6 -0
- package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.js +42 -0
- package/admin/plugins/editor/defaultBar/FormSettings/index.d.ts +1 -0
- package/admin/plugins/editor/defaultBar/FormSettings/index.js +1 -0
- package/admin/plugins/editor/defaultBar/Name/Name.d.ts +7 -0
- package/admin/plugins/editor/defaultBar/Name/Name.js +80 -0
- package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +5 -0
- package/admin/plugins/editor/defaultBar/Name/NameStyled.js +48 -0
- package/admin/plugins/editor/defaultBar/Name/index.d.ts +1 -0
- package/admin/plugins/editor/defaultBar/Name/index.js +1 -0
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.d.ts +3 -0
- package/admin/plugins/editor/defaultBar/SaveContentModelButton.js +63 -0
- package/admin/plugins/editor/defaultBar/icons/more_vert.svg +12 -0
- package/admin/plugins/editor/defaultBar/icons/round-arrow_back-24px.svg +13 -0
- package/admin/plugins/editor/defaultBar/icons/round-arrow_drop_down-24px.svg +12 -0
- package/admin/plugins/editor/defaultBar/icons/settings.svg +25 -0
- package/admin/plugins/editor/defaultBar/index.d.ts +7 -0
- package/admin/plugins/editor/defaultBar/index.js +44 -0
- package/admin/plugins/editor/formSettings/components/GeneralSettings.d.ts +7 -0
- package/admin/plugins/editor/formSettings/components/GeneralSettings.js +37 -0
- package/admin/plugins/editor/formSettings/components/GroupSelect.d.ts +3 -0
- package/admin/plugins/editor/formSettings/components/GroupSelect.js +30 -0
- package/admin/plugins/editor/formSettings/icons/round-settings-24px.svg +1 -0
- package/admin/plugins/editor/formSettings/index.d.ts +3 -0
- package/admin/plugins/editor/formSettings/index.js +14 -0
- package/admin/plugins/fieldRenderers/Accordion.d.ts +10 -0
- package/admin/plugins/fieldRenderers/Accordion.js +125 -0
- package/admin/plugins/fieldRenderers/DynamicSection.d.ts +14 -0
- package/admin/plugins/fieldRenderers/DynamicSection.js +103 -0
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.d.ts +3 -0
- package/admin/plugins/fieldRenderers/boolean/booleanSwitch.js +34 -0
- package/admin/plugins/fieldRenderers/boolean/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/boolean/index.js +2 -0
- package/admin/plugins/fieldRenderers/checkboxes.d.ts +3 -0
- package/admin/plugins/fieldRenderers/checkboxes.js +45 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.d.ts +9 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js +148 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.d.ts +8 -0
- package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js +115 -0
- package/admin/plugins/fieldRenderers/dateTime/Input.d.ts +16 -0
- package/admin/plugins/fieldRenderers/dateTime/Input.js +26 -0
- package/admin/plugins/fieldRenderers/dateTime/Select.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/Select.js +13 -0
- package/admin/plugins/fieldRenderers/dateTime/Time.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/Time.js +13 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeField.js +59 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.d.ts +3 -0
- package/admin/plugins/fieldRenderers/dateTime/dateTimeFields.js +84 -0
- package/admin/plugins/fieldRenderers/dateTime/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/dateTime/index.js +3 -0
- package/admin/plugins/fieldRenderers/dateTime/utils.d.ts +15 -0
- package/admin/plugins/fieldRenderers/dateTime/utils.js +153 -0
- package/admin/plugins/fieldRenderers/file/File.d.ts +15 -0
- package/admin/plugins/fieldRenderers/file/File.js +79 -0
- package/admin/plugins/fieldRenderers/file/fileField.d.ts +3 -0
- package/admin/plugins/fieldRenderers/file/fileField.js +64 -0
- package/admin/plugins/fieldRenderers/file/fileFields.d.ts +3 -0
- package/admin/plugins/fieldRenderers/file/fileFields.js +125 -0
- package/admin/plugins/fieldRenderers/file/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/file/index.js +3 -0
- package/admin/plugins/fieldRenderers/file/utils.d.ts +7 -0
- package/admin/plugins/fieldRenderers/file/utils.js +51 -0
- package/admin/plugins/fieldRenderers/longText/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/longText/index.js +3 -0
- package/admin/plugins/fieldRenderers/longText/longText.d.ts +3 -0
- package/admin/plugins/fieldRenderers/longText/longText.js +36 -0
- package/admin/plugins/fieldRenderers/longText/longTexts.d.ts +3 -0
- package/admin/plugins/fieldRenderers/longText/longTexts.js +43 -0
- package/admin/plugins/fieldRenderers/number/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/number/index.js +3 -0
- package/admin/plugins/fieldRenderers/number/numberInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/number/numberInput.js +39 -0
- package/admin/plugins/fieldRenderers/number/numberInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/number/numberInputs.js +50 -0
- package/admin/plugins/fieldRenderers/object/StyledComponents.d.ts +4 -0
- package/admin/plugins/fieldRenderers/object/StyledComponents.js +5 -0
- package/admin/plugins/fieldRenderers/object/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/object/index.js +3 -0
- package/admin/plugins/fieldRenderers/object/multipleObjects.d.ts +3 -0
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +72 -0
- package/admin/plugins/fieldRenderers/object/singleObject.d.ts +3 -0
- package/admin/plugins/fieldRenderers/object/singleObject.js +45 -0
- package/admin/plugins/fieldRenderers/radioButtons.d.ts +3 -0
- package/admin/plugins/fieldRenderers/radioButtons.js +45 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.d.ts +6 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +54 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.d.ts +6 -0
- package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js +65 -0
- package/admin/plugins/fieldRenderers/ref/components/getOptions.d.ts +1 -0
- package/admin/plugins/fieldRenderers/ref/components/getOptions.js +21 -0
- package/admin/plugins/fieldRenderers/ref/components/graphql.d.ts +4 -0
- package/admin/plugins/fieldRenderers/ref/components/graphql.js +10 -0
- package/admin/plugins/fieldRenderers/ref/components/renderItem.d.ts +2 -0
- package/admin/plugins/fieldRenderers/ref/components/renderItem.js +14 -0
- package/admin/plugins/fieldRenderers/ref/components/useReference.d.ts +22 -0
- package/admin/plugins/fieldRenderers/ref/components/useReference.js +240 -0
- package/admin/plugins/fieldRenderers/ref/components/useReferences.d.ts +19 -0
- package/admin/plugins/fieldRenderers/ref/components/useReferences.js +180 -0
- package/admin/plugins/fieldRenderers/ref/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/ref/index.js +3 -0
- package/admin/plugins/fieldRenderers/ref/refInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/ref/refInput.js +30 -0
- package/admin/plugins/fieldRenderers/ref/refInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/ref/refInputs.js +37 -0
- package/admin/plugins/fieldRenderers/richText/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/richText/index.js +3 -0
- package/admin/plugins/fieldRenderers/richText/richTextInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/richText/richTextInput.js +50 -0
- package/admin/plugins/fieldRenderers/richText/richTextInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/richText/richTextInputs.js +79 -0
- package/admin/plugins/fieldRenderers/select.d.ts +3 -0
- package/admin/plugins/fieldRenderers/select.js +34 -0
- package/admin/plugins/fieldRenderers/text/index.d.ts +2 -0
- package/admin/plugins/fieldRenderers/text/index.js +3 -0
- package/admin/plugins/fieldRenderers/text/textInput.d.ts +3 -0
- package/admin/plugins/fieldRenderers/text/textInput.js +35 -0
- package/admin/plugins/fieldRenderers/text/textInputs.d.ts +3 -0
- package/admin/plugins/fieldRenderers/text/textInputs.js +46 -0
- package/admin/plugins/fieldValidators/date/availableValidators.d.ts +1 -0
- package/admin/plugins/fieldValidators/date/availableValidators.js +11 -0
- package/admin/plugins/fieldValidators/date/createDateInputField.d.ts +3 -0
- package/admin/plugins/fieldValidators/date/createDateInputField.js +33 -0
- package/admin/plugins/fieldValidators/dateGte.d.ts +3 -0
- package/admin/plugins/fieldValidators/dateGte.js +40 -0
- package/admin/plugins/fieldValidators/dateLte.d.ts +3 -0
- package/admin/plugins/fieldValidators/dateLte.js +40 -0
- package/admin/plugins/fieldValidators/gte.d.ts +3 -0
- package/admin/plugins/fieldValidators/gte.js +27 -0
- package/admin/plugins/fieldValidators/in.d.ts +3 -0
- package/admin/plugins/fieldValidators/in.js +26 -0
- package/admin/plugins/fieldValidators/lte.d.ts +3 -0
- package/admin/plugins/fieldValidators/lte.js +27 -0
- package/admin/plugins/fieldValidators/maxLength.d.ts +3 -0
- package/admin/plugins/fieldValidators/maxLength.js +27 -0
- package/admin/plugins/fieldValidators/minLength.d.ts +3 -0
- package/admin/plugins/fieldValidators/minLength.js +27 -0
- package/admin/plugins/fieldValidators/pattern.d.ts +3 -0
- package/admin/plugins/fieldValidators/pattern.js +74 -0
- package/admin/plugins/fieldValidators/patternPlugins/email.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/email.js +9 -0
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js +9 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/upperCase.js +9 -0
- package/admin/plugins/fieldValidators/patternPlugins/url.d.ts +3 -0
- package/admin/plugins/fieldValidators/patternPlugins/url.js +9 -0
- package/admin/plugins/fieldValidators/required.d.ts +3 -0
- package/admin/plugins/fieldValidators/required.js +10 -0
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.d.ts +6 -0
- package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js +108 -0
- package/admin/plugins/fields/boolean.d.ts +3 -0
- package/admin/plugins/fields/boolean.js +31 -0
- package/admin/plugins/fields/dateTime.d.ts +3 -0
- package/admin/plugins/fields/dateTime.js +77 -0
- package/admin/plugins/fields/file.d.ts +3 -0
- package/admin/plugins/fields/file.js +46 -0
- package/admin/plugins/fields/icons/ballot_black_24dp.svg +1 -0
- package/admin/plugins/fields/icons/dropdown-icon.svg +16 -0
- package/admin/plugins/fields/icons/notes-black-24px.svg +1 -0
- package/admin/plugins/fields/icons/round-check_box-24px.svg +4 -0
- package/admin/plugins/fields/icons/round-link-24px.svg +1 -0
- package/admin/plugins/fields/icons/round-looks_3-24px.svg +4 -0
- package/admin/plugins/fields/icons/round-notes.svg +1 -0
- package/admin/plugins/fields/icons/round-radio_button_checked-24px.svg +5 -0
- package/admin/plugins/fields/icons/round-short_text.svg +1 -0
- package/admin/plugins/fields/icons/round-subject.svg +1 -0
- package/admin/plugins/fields/icons/round-text_fields-24px.svg +4 -0
- package/admin/plugins/fields/icons/round-visibility_off-24px.svg +4 -0
- package/admin/plugins/fields/icons/round_insert_drive_file-24px.svg +1 -0
- package/admin/plugins/fields/icons/schedule-black-24px.svg +1 -0
- package/admin/plugins/fields/icons/title-black-24px.svg +1 -0
- package/admin/plugins/fields/icons/toggle_on-black-24px.svg +1 -0
- package/admin/plugins/fields/longText.d.ts +3 -0
- package/admin/plugins/fields/longText.js +46 -0
- package/admin/plugins/fields/number.d.ts +3 -0
- package/admin/plugins/fields/number.js +63 -0
- package/admin/plugins/fields/object/ObjectFields.d.ts +4 -0
- package/admin/plugins/fields/object/ObjectFields.js +32 -0
- package/admin/plugins/fields/object.d.ts +3 -0
- package/admin/plugins/fields/object.js +46 -0
- package/admin/plugins/fields/ref.d.ts +3 -0
- package/admin/plugins/fields/ref.js +144 -0
- package/admin/plugins/fields/richText.d.ts +3 -0
- package/admin/plugins/fields/richText.js +45 -0
- package/admin/plugins/fields/text.d.ts +3 -0
- package/admin/plugins/fields/text.js +51 -0
- package/admin/plugins/getObjectId.d.ts +3 -0
- package/admin/plugins/getObjectId.js +13 -0
- package/admin/plugins/icons.d.ts +3 -0
- package/admin/plugins/icons.js +40 -0
- package/admin/plugins/index.d.ts +13 -0
- package/admin/plugins/index.js +14 -0
- package/admin/plugins/install.d.ts +3 -0
- package/admin/plugins/install.js +127 -0
- package/admin/plugins/menus/CmsMenuLoader.d.ts +7 -0
- package/admin/plugins/menus/CmsMenuLoader.js +76 -0
- package/admin/plugins/menus/ContentGroupsMenuItems.d.ts +6 -0
- package/admin/plugins/menus/ContentGroupsMenuItems.js +154 -0
- package/admin/plugins/menus/GlobalSearchPlugins.d.ts +8 -0
- package/admin/plugins/menus/GlobalSearchPlugins.js +53 -0
- package/admin/plugins/menus.d.ts +4 -0
- package/admin/plugins/menus.js +19 -0
- package/admin/plugins/permissionRenderer/CmsPermissions.d.ts +5 -0
- package/admin/plugins/permissionRenderer/CmsPermissions.js +340 -0
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.d.ts +8 -0
- package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js +117 -0
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.d.ts +9 -0
- package/admin/plugins/permissionRenderer/components/ContentModelGroupPermission.js +77 -0
- package/admin/plugins/permissionRenderer/components/ContentModelList.d.ts +7 -0
- package/admin/plugins/permissionRenderer/components/ContentModelList.js +53 -0
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.d.ts +10 -0
- package/admin/plugins/permissionRenderer/components/ContentModelPermission.js +104 -0
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.d.ts +5 -0
- package/admin/plugins/permissionRenderer/components/PermissionRendererWrapper.js +28 -0
- package/admin/plugins/permissionRenderer/components/PermissionSelector.d.ts +34 -0
- package/admin/plugins/permissionRenderer/components/PermissionSelector.js +66 -0
- package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +2 -0
- package/admin/plugins/permissionRenderer/components/StyledComponents.js +10 -0
- package/admin/plugins/permissionRenderer/components/useCmsData.d.ts +1 -0
- package/admin/plugins/permissionRenderer/components/useCmsData.js +79 -0
- package/admin/plugins/permissionRenderer/index.d.ts +3 -0
- package/admin/plugins/permissionRenderer/index.js +16 -0
- package/admin/plugins/routes.d.ts +3 -0
- package/admin/plugins/routes.js +88 -0
- package/admin/plugins/transformers/dateTransformer.d.ts +3 -0
- package/admin/plugins/transformers/dateTransformer.js +44 -0
- package/admin/plugins/transformers/index.d.ts +3 -0
- package/admin/plugins/transformers/index.js +5 -0
- package/admin/plugins/transformers/numberTransformer.d.ts +3 -0
- package/admin/plugins/transformers/numberTransformer.js +14 -0
- package/admin/plugins/upgrades/v5.0.0.d.ts +5 -0
- package/admin/plugins/upgrades/v5.0.0.js +85 -0
- package/admin/plugins/upgrades/v5.5.0.d.ts +5 -0
- package/admin/plugins/upgrades/v5.5.0.js +85 -0
- package/admin/plugins/upgrades/v5.8.0.d.ts +5 -0
- package/admin/plugins/upgrades/v5.8.0.js +85 -0
- package/admin/plugins/validators/dateGte.d.ts +3 -0
- package/admin/plugins/validators/dateGte.js +23 -0
- package/admin/plugins/validators/dateLte.d.ts +3 -0
- package/admin/plugins/validators/dateLte.js +23 -0
- package/admin/plugins/validators/gte.d.ts +3 -0
- package/admin/plugins/validators/gte.js +15 -0
- package/admin/plugins/validators/in.d.ts +3 -0
- package/admin/plugins/validators/in.js +15 -0
- package/admin/plugins/validators/lte.d.ts +3 -0
- package/admin/plugins/validators/lte.js +15 -0
- package/admin/plugins/validators/maxLength.d.ts +3 -0
- package/admin/plugins/validators/maxLength.js +15 -0
- package/admin/plugins/validators/minLength.d.ts +3 -0
- package/admin/plugins/validators/minLength.js +15 -0
- package/admin/plugins/validators/pattern.d.ts +9 -0
- package/admin/plugins/validators/pattern.js +34 -0
- package/admin/plugins/validators/patternPlugins/email.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/email.js +9 -0
- package/admin/plugins/validators/patternPlugins/lowerCase.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/lowerCase.js +9 -0
- package/admin/plugins/validators/patternPlugins/upperCase.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/upperCase.js +9 -0
- package/admin/plugins/validators/patternPlugins/url.d.ts +10 -0
- package/admin/plugins/validators/patternPlugins/url.js +9 -0
- package/admin/plugins/validators/required.d.ts +3 -0
- package/admin/plugins/validators/required.js +11 -0
- package/admin/plugins/validators/timeGte.d.ts +3 -0
- package/admin/plugins/validators/timeGte.js +19 -0
- package/admin/plugins/validators/timeLte.d.ts +3 -0
- package/admin/plugins/validators/timeLte.js +19 -0
- package/admin/plugins/welcomeScreenWidget.d.ts +3 -0
- package/admin/plugins/welcomeScreenWidget.js +29 -0
- package/admin/views/contentEntries/ContentEntries.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntries.js +73 -0
- package/admin/views/contentEntries/ContentEntriesContext.d.ts +24 -0
- package/admin/views/contentEntries/ContentEntriesContext.js +78 -0
- package/admin/views/contentEntries/ContentEntriesList.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntriesList.js +180 -0
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.d.ts +28 -0
- package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +113 -0
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.d.ts +7 -0
- package/admin/views/contentEntries/ContentEntry/RevisionListItem.js +152 -0
- package/admin/views/contentEntries/ContentEntry/RevisionsList.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/RevisionsList.js +59 -0
- package/admin/views/contentEntries/ContentEntry/cache.d.ts +7 -0
- package/admin/views/contentEntries/ContentEntry/cache.js +183 -0
- package/admin/views/contentEntries/ContentEntry/header/Header.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/Header.js +32 -0
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/contentFormOptionsMenu/ContentFormOptionsMenu.js +141 -0
- package/admin/views/contentEntries/ContentEntry/header/index.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/index.js +45 -0
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js +67 -0
- package/admin/views/contentEntries/ContentEntry/header/requestChanges/rule-24px.svg +1 -0
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js +69 -0
- package/admin/views/contentEntries/ContentEntry/header/requestReview/emoji_people-24px.svg +1 -0
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/revisionSelector/RevisionSelector.js +75 -0
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/saveAndPublishContent/SaveAndPublishContent.js +84 -0
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.d.ts +3 -0
- package/admin/views/contentEntries/ContentEntry/header/saveContent/SaveContent.js +32 -0
- package/admin/views/contentEntries/ContentEntry/prepareFormData.d.ts +2 -0
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js +79 -0
- package/admin/views/contentEntries/ContentEntry/useRevision.d.ts +13 -0
- package/admin/views/contentEntries/ContentEntry/useRevision.js +335 -0
- package/admin/views/contentEntries/ContentEntry.d.ts +12 -0
- package/admin/views/contentEntries/ContentEntry.js +99 -0
- package/admin/views/contentEntries/hooks/useContentEntries.d.ts +1 -0
- package/admin/views/contentEntries/hooks/useContentEntries.js +5 -0
- package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +21 -0
- package/admin/views/contentEntries/hooks/useContentEntriesList.js +152 -0
- package/admin/views/contentEntries/hooks/useContentEntry.d.ts +1 -0
- package/admin/views/contentEntries/hooks/useContentEntry.js +5 -0
- package/admin/views/contentModelGroups/ContentModelGroups.d.ts +3 -0
- package/admin/views/contentModelGroups/ContentModelGroups.js +35 -0
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.d.ts +6 -0
- package/admin/views/contentModelGroups/ContentModelGroupsDataList.js +242 -0
- package/admin/views/contentModelGroups/ContentModelGroupsForm.d.ts +6 -0
- package/admin/views/contentModelGroups/ContentModelGroupsForm.js +231 -0
- package/admin/views/contentModelGroups/DelayedOnChange.d.ts +25 -0
- package/admin/views/contentModelGroups/DelayedOnChange.js +134 -0
- package/admin/views/contentModelGroups/IconPicker.d.ts +7 -0
- package/admin/views/contentModelGroups/IconPicker.js +204 -0
- package/admin/views/contentModelGroups/graphql.d.ts +5 -0
- package/admin/views/contentModelGroups/graphql.js +11 -0
- package/admin/views/contentModels/ContentModelEditor.d.ts +2 -0
- package/admin/views/contentModels/ContentModelEditor.js +35 -0
- package/admin/views/contentModels/ContentModels.d.ts +3 -0
- package/admin/views/contentModels/ContentModels.js +82 -0
- package/admin/views/contentModels/ContentModelsDataList.d.ts +7 -0
- package/admin/views/contentModels/ContentModelsDataList.js +281 -0
- package/admin/views/contentModels/NewContentModelDialog.d.ts +8 -0
- package/admin/views/contentModels/NewContentModelDialog.js +196 -0
- package/admin/views/contentModels/cache.d.ts +5 -0
- package/admin/views/contentModels/cache.js +68 -0
- package/admin/views/utils.d.ts +2 -0
- package/admin/views/utils.js +27 -0
- package/admin/viewsGraphql.d.ts +4 -0
- package/admin/viewsGraphql.js +12 -0
- package/package.json +109 -0
- package/types.d.ts +484 -0
- package/types.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @webiny/app-headless-cms
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@webiny/app-headless-cms)
|
|
4
|
+
[](https://www.npmjs.com/package/@webiny/app-headless-cms)
|
|
5
|
+
[](https://github.com/prettier/prettier)
|
|
6
|
+
[](http://makeapullrequest.com)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install --save @webiny/app-headless-cms
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or if you prefer yarn:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
yarn add @webiny/app-headless-cms
|
|
18
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormAPI } from "@webiny/form/types";
|
|
3
|
+
import { UseContentEntryFormParams } from "./useContentEntryForm";
|
|
4
|
+
interface ContentEntryFormProps extends UseContentEntryFormParams {
|
|
5
|
+
onForm?: (form: FormAPI) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ContentEntryForm: ({ onForm, ...props }: ContentEntryFormProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["onForm"];
|
|
4
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
5
|
+
import styled from "@emotion/styled";
|
|
6
|
+
import { Form } from "@webiny/form";
|
|
7
|
+
import { plugins } from "@webiny/plugins";
|
|
8
|
+
import { CircularProgress } from "@webiny/ui/Progress";
|
|
9
|
+
import RenderFieldElement from "./RenderFieldElement";
|
|
10
|
+
import { useContentEntryForm } from "./useContentEntryForm";
|
|
11
|
+
import { Fields } from "./Fields";
|
|
12
|
+
var FormWrapper = /*#__PURE__*/styled("div", {
|
|
13
|
+
target: "ejw5gwy0",
|
|
14
|
+
label: "FormWrapper"
|
|
15
|
+
})({
|
|
16
|
+
height: "calc(100vh - 260px)",
|
|
17
|
+
overflow: "auto"
|
|
18
|
+
});
|
|
19
|
+
export var ContentEntryForm = function ContentEntryForm(_ref) {
|
|
20
|
+
var onForm = _ref.onForm,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
|
|
23
|
+
var contentModel = props.contentModel;
|
|
24
|
+
|
|
25
|
+
var _useContentEntryForm = useContentEntryForm(props),
|
|
26
|
+
loading = _useContentEntryForm.loading,
|
|
27
|
+
data = _useContentEntryForm.data,
|
|
28
|
+
onChange = _useContentEntryForm.onChange,
|
|
29
|
+
onSubmit = _useContentEntryForm.onSubmit,
|
|
30
|
+
invalidFields = _useContentEntryForm.invalidFields;
|
|
31
|
+
|
|
32
|
+
var ref = useRef(null);
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
typeof onForm === "function" && onForm(ref.current);
|
|
35
|
+
}, []);
|
|
36
|
+
var formRenderer = plugins.byType("cms-content-form-renderer").find(function (pl) {
|
|
37
|
+
return pl.modelId === contentModel.modelId;
|
|
38
|
+
});
|
|
39
|
+
var renderCustomLayout = useCallback(function (formRenderProps) {
|
|
40
|
+
var fields = contentModel.fields.reduce(function (acc, field) {
|
|
41
|
+
acc[field.fieldId] = /*#__PURE__*/React.createElement(RenderFieldElement, {
|
|
42
|
+
field: field,
|
|
43
|
+
Bind: formRenderProps.Bind,
|
|
44
|
+
contentModel: contentModel
|
|
45
|
+
});
|
|
46
|
+
return acc;
|
|
47
|
+
}, {});
|
|
48
|
+
return formRenderer.render(_objectSpread(_objectSpread({}, formRenderProps), {}, {
|
|
49
|
+
contentModel: contentModel,
|
|
50
|
+
fields: fields
|
|
51
|
+
}));
|
|
52
|
+
}, [formRenderer]);
|
|
53
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
54
|
+
onChange: onChange,
|
|
55
|
+
onSubmit: onSubmit,
|
|
56
|
+
data: data,
|
|
57
|
+
ref: ref,
|
|
58
|
+
invalidFields: invalidFields
|
|
59
|
+
}, function (formProps) {
|
|
60
|
+
return /*#__PURE__*/React.createElement(FormWrapper, {
|
|
61
|
+
"data-testid": "cms-content-form"
|
|
62
|
+
}, loading && /*#__PURE__*/React.createElement(CircularProgress, null), formRenderer ? renderCustomLayout(formProps) : /*#__PURE__*/React.createElement(Fields, Object.assign({
|
|
63
|
+
contentModel: contentModel,
|
|
64
|
+
fields: contentModel.fields,
|
|
65
|
+
layout: contentModel.layout
|
|
66
|
+
}, formProps)));
|
|
67
|
+
});
|
|
68
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
|
+
import styled from "@emotion/styled";
|
|
4
|
+
import { Form } from "@webiny/form";
|
|
5
|
+
import { plugins } from "@webiny/plugins";
|
|
6
|
+
import RenderFieldElement from "./RenderFieldElement";
|
|
7
|
+
import { Fields } from "./Fields";
|
|
8
|
+
var FormWrapper = /*#__PURE__*/styled("div", {
|
|
9
|
+
target: "eh1hbib0",
|
|
10
|
+
label: "FormWrapper"
|
|
11
|
+
})({
|
|
12
|
+
height: "calc(100vh - 260px)",
|
|
13
|
+
overflow: "auto"
|
|
14
|
+
});
|
|
15
|
+
export var ContentEntryFormPreview = function ContentEntryFormPreview(props) {
|
|
16
|
+
var contentModel = props.contentModel;
|
|
17
|
+
var formRenderer = plugins.byType("cms-content-form-renderer").find(function (pl) {
|
|
18
|
+
return pl.modelId === contentModel.modelId;
|
|
19
|
+
});
|
|
20
|
+
var renderCustomLayout = useCallback(function (formRenderProps) {
|
|
21
|
+
var fields = contentModel.fields.reduce(function (acc, field) {
|
|
22
|
+
acc[field.fieldId] = /*#__PURE__*/React.createElement(RenderFieldElement, {
|
|
23
|
+
field: field,
|
|
24
|
+
Bind: formRenderProps.Bind,
|
|
25
|
+
contentModel: contentModel
|
|
26
|
+
});
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
return formRenderer.render(_objectSpread(_objectSpread({}, formRenderProps), {}, {
|
|
30
|
+
contentModel: contentModel,
|
|
31
|
+
fields: fields
|
|
32
|
+
}));
|
|
33
|
+
}, [formRenderer, contentModel.fields]);
|
|
34
|
+
return /*#__PURE__*/React.createElement(Form, null, function (formProps) {
|
|
35
|
+
return /*#__PURE__*/React.createElement(FormWrapper, {
|
|
36
|
+
"data-testid": "cms-content-form"
|
|
37
|
+
}, formRenderer ? renderCustomLayout(formProps) : /*#__PURE__*/React.createElement(Fields, Object.assign({
|
|
38
|
+
contentModel: contentModel,
|
|
39
|
+
fields: contentModel.fields,
|
|
40
|
+
layout: contentModel.layout
|
|
41
|
+
}, formProps)));
|
|
42
|
+
});
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BindComponent } from "@webiny/form";
|
|
3
|
+
import { CmsEditorContentModel, CmsEditorField, CmsEditorFieldsLayout } from "../../../types";
|
|
4
|
+
interface Props {
|
|
5
|
+
Bind: BindComponent;
|
|
6
|
+
contentModel: CmsEditorContentModel;
|
|
7
|
+
fields: CmsEditorField[];
|
|
8
|
+
layout: CmsEditorFieldsLayout;
|
|
9
|
+
gridClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const Fields: ({ Bind, fields, layout, contentModel, gridClassName }: Props) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Cell, Grid } from "@webiny/ui/Grid";
|
|
3
|
+
import RenderFieldElement from "./RenderFieldElement";
|
|
4
|
+
|
|
5
|
+
var getFieldById = function getFieldById(fields, id) {
|
|
6
|
+
return fields.find(function (field) {
|
|
7
|
+
return field.id === id;
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export var Fields = function Fields(_ref) {
|
|
12
|
+
var Bind = _ref.Bind,
|
|
13
|
+
fields = _ref.fields,
|
|
14
|
+
layout = _ref.layout,
|
|
15
|
+
contentModel = _ref.contentModel,
|
|
16
|
+
gridClassName = _ref.gridClassName;
|
|
17
|
+
return /*#__PURE__*/React.createElement(Grid, {
|
|
18
|
+
className: gridClassName
|
|
19
|
+
}, layout.map(function (row, rowIndex) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
21
|
+
key: rowIndex
|
|
22
|
+
}, row.map(function (fieldId) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
24
|
+
span: Math.floor(12 / row.length),
|
|
25
|
+
key: fieldId
|
|
26
|
+
}, /*#__PURE__*/React.createElement(RenderFieldElement, {
|
|
27
|
+
field: getFieldById(fields, fieldId),
|
|
28
|
+
Bind: Bind,
|
|
29
|
+
contentModel: contentModel
|
|
30
|
+
}));
|
|
31
|
+
}));
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { css } from "emotion";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { Typography } from "@webiny/ui/Typography";
|
|
5
|
+
var style = {
|
|
6
|
+
label: /*#__PURE__*/css({
|
|
7
|
+
marginBottom: "5px !important"
|
|
8
|
+
}, "label:label;")
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
var Label = function Label(_ref) {
|
|
12
|
+
var children = _ref.children;
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
className: classNames("mdc-text-field-helper-text mdc-text-field-helper-text--persistent", style.label)
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
16
|
+
use: "subtitle2"
|
|
17
|
+
}, children));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default Label;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CmsEditorField, CmsEditorContentModel } from "../../../types";
|
|
2
|
+
import { BindComponent } from "@webiny/form";
|
|
3
|
+
declare const RenderFieldElement: (props: {
|
|
4
|
+
field: CmsEditorField;
|
|
5
|
+
Bind: BindComponent;
|
|
6
|
+
contentModel: CmsEditorContentModel;
|
|
7
|
+
}) => any;
|
|
8
|
+
export default RenderFieldElement;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
import React from "react";
|
|
6
|
+
import get from "lodash/get";
|
|
7
|
+
import { i18n } from "@webiny/app/i18n";
|
|
8
|
+
import Label from "./Label";
|
|
9
|
+
import { useBind } from "./useBind";
|
|
10
|
+
import { useRenderPlugins } from "./useRenderPlugins";
|
|
11
|
+
var t = i18n.ns("app-headless-cms/admin/components/content-form");
|
|
12
|
+
|
|
13
|
+
var RenderFieldElement = function RenderFieldElement(props) {
|
|
14
|
+
var renderPlugins = useRenderPlugins();
|
|
15
|
+
var field = props.field,
|
|
16
|
+
Bind = props.Bind,
|
|
17
|
+
contentModel = props.contentModel;
|
|
18
|
+
var getBind = useBind({
|
|
19
|
+
Bind: Bind,
|
|
20
|
+
field: field
|
|
21
|
+
});
|
|
22
|
+
var renderPlugin = renderPlugins.find(function (plugin) {
|
|
23
|
+
return plugin.renderer.rendererName === get(field, "renderer.name");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (!renderPlugin) {
|
|
27
|
+
return t(_templateObject || (_templateObject = _taggedTemplateLiteral(["Cannot render \"{fieldName}\" field - field renderer missing."])))({
|
|
28
|
+
fieldName: /*#__PURE__*/React.createElement("strong", null, field.fieldId)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return renderPlugin.renderer.render({
|
|
33
|
+
field: field,
|
|
34
|
+
getBind: getBind,
|
|
35
|
+
Label: Label,
|
|
36
|
+
contentModel: contentModel
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default RenderFieldElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createValidators: (validation: any) => any;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { plugins } from "@webiny/plugins";
|
|
4
|
+
export var createValidators = function createValidators(validation) {
|
|
5
|
+
var validatorPlugins = plugins.byType("cms-model-field-validator");
|
|
6
|
+
return validation.map(function (item) {
|
|
7
|
+
var validatorPlugin = validatorPlugins.find(function (plugin) {
|
|
8
|
+
return plugin.validator.name === item.name;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
if (!validatorPlugin || typeof validatorPlugin.validator.validate !== "function") {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return /*#__PURE__*/function () {
|
|
16
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
|
|
17
|
+
var isInvalid, result;
|
|
18
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
+
while (1) {
|
|
20
|
+
switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
_context.prev = 0;
|
|
23
|
+
_context.next = 3;
|
|
24
|
+
return validatorPlugin.validator.validate(value, item);
|
|
25
|
+
|
|
26
|
+
case 3:
|
|
27
|
+
result = _context.sent;
|
|
28
|
+
isInvalid = result === false;
|
|
29
|
+
_context.next = 10;
|
|
30
|
+
break;
|
|
31
|
+
|
|
32
|
+
case 7:
|
|
33
|
+
_context.prev = 7;
|
|
34
|
+
_context.t0 = _context["catch"](0);
|
|
35
|
+
isInvalid = true;
|
|
36
|
+
|
|
37
|
+
case 10:
|
|
38
|
+
if (!isInvalid) {
|
|
39
|
+
_context.next = 12;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
throw new Error(item.message || "Invalid value.");
|
|
44
|
+
|
|
45
|
+
case 12:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, _callee, null, [[0, 7]]);
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
return function (_x) {
|
|
54
|
+
return _ref.apply(this, arguments);
|
|
55
|
+
};
|
|
56
|
+
}();
|
|
57
|
+
}).filter(Boolean);
|
|
58
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var getValue = function getValue(_ref) {
|
|
2
|
+
var bind = _ref.bind,
|
|
3
|
+
field = _ref.field,
|
|
4
|
+
index = _ref.index;
|
|
5
|
+
var value = bind.value || null;
|
|
6
|
+
|
|
7
|
+
if (field.multipleValues) {
|
|
8
|
+
if (!Array.isArray(value)) {
|
|
9
|
+
value = [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (index >= 0) {
|
|
13
|
+
return value[index] || null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
export var setValue = function setValue(_ref) {
|
|
3
|
+
var value = _ref.value,
|
|
4
|
+
bind = _ref.bind,
|
|
5
|
+
field = _ref.field,
|
|
6
|
+
index = _ref.index;
|
|
7
|
+
var newValue = field.multipleValues ? _toConsumableArray(bind.value || []) : bind.value;
|
|
8
|
+
|
|
9
|
+
if (field.multipleValues) {
|
|
10
|
+
if (index >= 0) {
|
|
11
|
+
newValue[index] = value;
|
|
12
|
+
} else {
|
|
13
|
+
newValue = value;
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
newValue = value;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
bind.onChange(newValue);
|
|
20
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BindComponent } from "@webiny/form";
|
|
2
|
+
import { CmsEditorField } from "../../../types";
|
|
3
|
+
interface UseBindProps {
|
|
4
|
+
field: CmsEditorField;
|
|
5
|
+
Bind: BindComponent & {
|
|
6
|
+
parentName?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare function useBind({ Bind: ParentBind, field }: UseBindProps): (index?: any) => any;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
+
import React, { useRef, useCallback, cloneElement } from "react";
|
|
4
|
+
import { createValidators } from "./functions/createValidators";
|
|
5
|
+
export function useBind(_ref) {
|
|
6
|
+
var ParentBind = _ref.Bind,
|
|
7
|
+
field = _ref.field;
|
|
8
|
+
var memoizedBindComponents = useRef({});
|
|
9
|
+
return useCallback(function () {
|
|
10
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
11
|
+
var parentName = ParentBind.parentName; // If there's a parent name assigned to the given Bind component, we need to include it in the new field "name".
|
|
12
|
+
// This allows us to have nested fields (like "object" field with nested properties)
|
|
13
|
+
|
|
14
|
+
var name = [parentName, field.fieldId, index >= 0 ? index : undefined].filter(function (v) {
|
|
15
|
+
return v !== undefined;
|
|
16
|
+
}).join(".");
|
|
17
|
+
|
|
18
|
+
if (memoizedBindComponents.current[name]) {
|
|
19
|
+
return memoizedBindComponents.current[name];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var validators = createValidators(field.validation || []);
|
|
23
|
+
var listValidators = createValidators(field.listValidation || []);
|
|
24
|
+
var defaultValue = field.multipleValues ? [] : undefined;
|
|
25
|
+
var isMultipleValues = index === -1 && field.multipleValues;
|
|
26
|
+
var inputValidators = isMultipleValues ? listValidators : validators;
|
|
27
|
+
|
|
28
|
+
memoizedBindComponents.current[name] = function UseBind(_ref2) {
|
|
29
|
+
var childName = _ref2.name,
|
|
30
|
+
childValidators = _ref2.validators,
|
|
31
|
+
children = _ref2.children;
|
|
32
|
+
return /*#__PURE__*/React.createElement(ParentBind, {
|
|
33
|
+
name: childName || name,
|
|
34
|
+
validators: childValidators || inputValidators,
|
|
35
|
+
defaultValue: index === -1 ? defaultValue : null
|
|
36
|
+
}, function (bind) {
|
|
37
|
+
// Multiple-values functions below.
|
|
38
|
+
var props = _objectSpread({}, bind);
|
|
39
|
+
|
|
40
|
+
if (field.multipleValues && index === -1) {
|
|
41
|
+
props.appendValue = function (newValue) {
|
|
42
|
+
bind.onChange([].concat(_toConsumableArray(bind.value), [newValue]));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
props.prependValue = function (newValue) {
|
|
46
|
+
bind.onChange([newValue].concat(_toConsumableArray(bind.value)));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
props.appendValues = function (newValues) {
|
|
50
|
+
bind.onChange([].concat(_toConsumableArray(bind.value), _toConsumableArray(newValues)));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
props.removeValue = function (index) {
|
|
54
|
+
if (index >= 0) {
|
|
55
|
+
var _value = bind.value;
|
|
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);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (typeof children === "function") {
|
|
65
|
+
return children(props);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/cloneElement(children, props);
|
|
69
|
+
});
|
|
70
|
+
}; // We need to keep track of current field name, to support nested fields.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
memoizedBindComponents.current[name].parentName = name;
|
|
74
|
+
return memoizedBindComponents.current[name];
|
|
75
|
+
}, [field.fieldId]);
|
|
76
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { FormOnSubmit } from "@webiny/form";
|
|
3
|
+
import { CmsEditorContentModel, CmsEditorFieldRendererPlugin } from "../../../types";
|
|
4
|
+
interface UseContentEntryForm {
|
|
5
|
+
data: Record<string, any>;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
setLoading: Dispatch<SetStateAction<boolean>>;
|
|
8
|
+
onChange: FormOnSubmit;
|
|
9
|
+
onSubmit: (data: Record<string, any>) => void;
|
|
10
|
+
invalidFields: Record<string, string>;
|
|
11
|
+
renderPlugins: CmsEditorFieldRendererPlugin[];
|
|
12
|
+
}
|
|
13
|
+
export interface UseContentEntryFormParams {
|
|
14
|
+
contentModel: CmsEditorContentModel;
|
|
15
|
+
entry?: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
onChange?: FormOnSubmit;
|
|
19
|
+
onSubmit?: FormOnSubmit;
|
|
20
|
+
}
|
|
21
|
+
export declare function useContentEntryForm(params: UseContentEntryFormParams): UseContentEntryForm;
|
|
22
|
+
export {};
|