@akemona-org/strapi-plugin-content-manager 3.7.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/LICENSE +22 -0
- package/README.md +27 -0
- package/admin/src/InjectedComponents/ContentTypeBuilder/ConfigureViewButton/index.js +78 -0
- package/admin/src/assets/images/background_input.svg +1 -0
- package/admin/src/assets/images/icon-cross-blue.svg +1 -0
- package/admin/src/assets/images/icon_remove.svg +19 -0
- package/admin/src/assets/images/logo.svg +1 -0
- package/admin/src/components/AddDropdown/components.js +113 -0
- package/admin/src/components/AddDropdown/index.js +76 -0
- package/admin/src/components/Block/components.js +28 -0
- package/admin/src/components/Block/index.js +45 -0
- package/admin/src/components/ComponentInitializer/P.js +9 -0
- package/admin/src/components/ComponentInitializer/index.js +43 -0
- package/admin/src/components/Container/index.js +7 -0
- package/admin/src/components/CustomInputCheckbox/components.js +77 -0
- package/admin/src/components/CustomInputCheckbox/index.js +53 -0
- package/admin/src/components/CustomTable/ActionCollapse/Delete.js +14 -0
- package/admin/src/components/CustomTable/ActionCollapse/DeleteAll.js +18 -0
- package/admin/src/components/CustomTable/ActionCollapse/Wrapper.js +20 -0
- package/admin/src/components/CustomTable/ActionCollapse/index.js +38 -0
- package/admin/src/components/CustomTable/Headers/Header.js +59 -0
- package/admin/src/components/CustomTable/Headers/Thead.js +35 -0
- package/admin/src/components/CustomTable/Headers/index.js +46 -0
- package/admin/src/components/CustomTable/Row/ActionContainer.js +19 -0
- package/admin/src/components/CustomTable/Row/Cell.js +55 -0
- package/admin/src/components/CustomTable/Row/index.js +112 -0
- package/admin/src/components/CustomTable/index.js +162 -0
- package/admin/src/components/CustomTable/styledComponents.js +85 -0
- package/admin/src/components/DragLayer/index.js +102 -0
- package/admin/src/components/DraggedField/Close/index.js +10 -0
- package/admin/src/components/DraggedField/GrabWrapper.js +38 -0
- package/admin/src/components/DraggedField/Link.js +17 -0
- package/admin/src/components/DraggedField/NameWrapper.js +29 -0
- package/admin/src/components/DraggedField/RemoveWrapper.js +32 -0
- package/admin/src/components/DraggedField/SubWrapper.js +36 -0
- package/admin/src/components/DraggedField/Wrapper.js +134 -0
- package/admin/src/components/DraggedField/index.js +196 -0
- package/admin/src/components/DraggedField/utils/getColor.js +12 -0
- package/admin/src/components/DraggedField/utils/getHeight.js +3 -0
- package/admin/src/components/DraggedFieldWithPreview/Carret.js +24 -0
- package/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +70 -0
- package/admin/src/components/DraggedFieldWithPreview/DynamicZoneWrapper.js +10 -0
- package/admin/src/components/DraggedFieldWithPreview/Tooltip.js +19 -0
- package/admin/src/components/DraggedFieldWithPreview/Wrapper.js +24 -0
- package/admin/src/components/DraggedFieldWithPreview/index.js +194 -0
- package/admin/src/components/DynamicComponentCard/Wrapper.js +63 -0
- package/admin/src/components/DynamicComponentCard/index.js +49 -0
- package/admin/src/components/DynamicZone/BaselineAlignement.js +11 -0
- package/admin/src/components/DynamicZone/Button.js +31 -0
- package/admin/src/components/DynamicZone/Component/RoundCTA.js +45 -0
- package/admin/src/components/DynamicZone/Component/index.js +79 -0
- package/admin/src/components/DynamicZone/ComponentWrapper.js +44 -0
- package/admin/src/components/DynamicZone/DynamicZoneWrapper.js +12 -0
- package/admin/src/components/DynamicZone/Label.js +42 -0
- package/admin/src/components/DynamicZone/Picker/Category/Banner/Wrapper.js +78 -0
- package/admin/src/components/DynamicZone/Picker/Category/Banner/index.js +33 -0
- package/admin/src/components/DynamicZone/Picker/Category/index.js +53 -0
- package/admin/src/components/DynamicZone/Picker/Wrapper.js +32 -0
- package/admin/src/components/DynamicZone/Picker/index.js +88 -0
- package/admin/src/components/DynamicZone/Wrapper.js +34 -0
- package/admin/src/components/DynamicZone/index.js +238 -0
- package/admin/src/components/DynamicZone/utils/connect.js +12 -0
- package/admin/src/components/DynamicZone/utils/select.js +49 -0
- package/admin/src/components/FieldComponent/ComponentIcon.js +44 -0
- package/admin/src/components/FieldComponent/EmptyComponent.js +19 -0
- package/admin/src/components/FieldComponent/Label.js +10 -0
- package/admin/src/components/FieldComponent/ResetComponent.js +41 -0
- package/admin/src/components/FieldComponent/Wrapper.js +18 -0
- package/admin/src/components/FieldComponent/index.js +171 -0
- package/admin/src/components/FieldComponent/utils/connect.js +12 -0
- package/admin/src/components/FieldComponent/utils/select.js +123 -0
- package/admin/src/components/FieldsReorder/Item.js +249 -0
- package/admin/src/components/FieldsReorder/components.js +8 -0
- package/admin/src/components/FieldsReorder/index.js +102 -0
- package/admin/src/components/FilterOptionsCTA/index.js +14 -0
- package/admin/src/components/FilterPicker/components.js +56 -0
- package/admin/src/components/FilterPicker/index.js +258 -0
- package/admin/src/components/FilterPicker/init.js +25 -0
- package/admin/src/components/FilterPicker/reducer.js +58 -0
- package/admin/src/components/FilterPickerOption/Input.js +58 -0
- package/admin/src/components/FilterPickerOption/Option.js +18 -0
- package/admin/src/components/FilterPickerOption/components.js +60 -0
- package/admin/src/components/FilterPickerOption/index.js +101 -0
- package/admin/src/components/FormTitle/index.js +26 -0
- package/admin/src/components/FormWrapper/index.js +20 -0
- package/admin/src/components/InputJSON/components.js +30 -0
- package/admin/src/components/InputJSON/index.js +184 -0
- package/admin/src/components/InputJSON/jsonlint.js +424 -0
- package/admin/src/components/InputJSONWithErrors/Wrapper.js +32 -0
- package/admin/src/components/InputJSONWithErrors/index.js +168 -0
- package/admin/src/components/InputUID/InputUID.js +26 -0
- package/admin/src/components/InputUID/Options/Option.js +22 -0
- package/admin/src/components/InputUID/Options/OptionsTitle.js +12 -0
- package/admin/src/components/InputUID/Options/RightOptionLabel.js +10 -0
- package/admin/src/components/InputUID/Options/index.js +34 -0
- package/admin/src/components/InputUID/Options/wrapper.js +13 -0
- package/admin/src/components/InputUID/RegenerateButton.js +18 -0
- package/admin/src/components/InputUID/RightContent.js +14 -0
- package/admin/src/components/InputUID/RightContentLabel.js +10 -0
- package/admin/src/components/InputUID/RightLabel.js +42 -0
- package/admin/src/components/InputUID/SubLabel.js +9 -0
- package/admin/src/components/InputUID/Wrapper.js +8 -0
- package/admin/src/components/InputUID/index.js +325 -0
- package/admin/src/components/InputUID/regex.js +3 -0
- package/admin/src/components/Inputs/index.js +283 -0
- package/admin/src/components/Inputs/utils/VALIDATIONS_TO_OMIT.js +12 -0
- package/admin/src/components/Inputs/utils/connect.js +12 -0
- package/admin/src/components/Inputs/utils/generateOptions.js +19 -0
- package/admin/src/components/Inputs/utils/getInputType.js +44 -0
- package/admin/src/components/Inputs/utils/getStep.js +15 -0
- package/admin/src/components/Inputs/utils/index.js +6 -0
- package/admin/src/components/Inputs/utils/select.js +38 -0
- package/admin/src/components/LayoutTitle/index.js +19 -0
- package/admin/src/components/MediaPreviewList/StyledMediaPreviewList.js +171 -0
- package/admin/src/components/MediaPreviewList/index.js +110 -0
- package/admin/src/components/NonRepeatableComponent/index.js +73 -0
- package/admin/src/components/NonRepeatableWrapper/index.js +73 -0
- package/admin/src/components/PlusButton/index.js +52 -0
- package/admin/src/components/PopupForm/index.js +93 -0
- package/admin/src/components/PreviewCarret/components.js +27 -0
- package/admin/src/components/PreviewCarret/index.js +22 -0
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +133 -0
- package/admin/src/components/PreviewWysiwyg/index.js +34 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.js +72 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +16 -0
- package/admin/src/components/RelationPreviewList/CountWrapper.js +7 -0
- package/admin/src/components/RelationPreviewList/RelationPreviewTooltip.js +117 -0
- package/admin/src/components/RelationPreviewList/index.js +111 -0
- package/admin/src/components/RepeatableComponent/AddFieldButton.js +64 -0
- package/admin/src/components/RepeatableComponent/Banner.js +112 -0
- package/admin/src/components/RepeatableComponent/BannerWrapper.js +194 -0
- package/admin/src/components/RepeatableComponent/CarretTop.js +14 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/index.js +245 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/connect.js +11 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/index.js +2 -0
- package/admin/src/components/RepeatableComponent/DraggedItem/utils/select.js +30 -0
- package/admin/src/components/RepeatableComponent/EmptyComponent.js +27 -0
- package/admin/src/components/RepeatableComponent/FormWrapper.js +27 -0
- package/admin/src/components/RepeatableComponent/index.js +187 -0
- package/admin/src/components/RepeatableComponent/reducer.js +73 -0
- package/admin/src/components/RepeatableComponent/utils/connect.js +11 -0
- package/admin/src/components/RepeatableComponent/utils/select.js +12 -0
- package/admin/src/components/Search/index.js +88 -0
- package/admin/src/components/SectionTitle/Title.js +11 -0
- package/admin/src/components/SectionTitle/index.js +29 -0
- package/admin/src/components/SelectMany/ListItem.js +107 -0
- package/admin/src/components/SelectMany/Relation.js +106 -0
- package/admin/src/components/SelectMany/components.js +153 -0
- package/admin/src/components/SelectMany/index.js +159 -0
- package/admin/src/components/SelectOne/SingleValue.js +58 -0
- package/admin/src/components/SelectOne/index.js +71 -0
- package/admin/src/components/SelectWrapper/ClearIndicator.js +15 -0
- package/admin/src/components/SelectWrapper/IndicatorSeparator.js +3 -0
- package/admin/src/components/SelectWrapper/Option.js +76 -0
- package/admin/src/components/SelectWrapper/components.js +14 -0
- package/admin/src/components/SelectWrapper/index.js +393 -0
- package/admin/src/components/SelectWrapper/utils/connect.js +12 -0
- package/admin/src/components/SelectWrapper/utils/index.js +3 -0
- package/admin/src/components/SelectWrapper/utils/select.js +45 -0
- package/admin/src/components/SelectWrapper/utils/styles.js +105 -0
- package/admin/src/components/Separator/index.js +9 -0
- package/admin/src/components/SettingFormWrapper/index.js +9 -0
- package/admin/src/components/SettingsViewWrapper/index.js +283 -0
- package/admin/src/components/SortWrapper/index.js +9 -0
- package/admin/src/components/SortableList/Item.js +126 -0
- package/admin/src/components/SortableList/index.js +60 -0
- package/admin/src/components/State/Wrapper.js +30 -0
- package/admin/src/components/State/index.js +26 -0
- package/admin/src/components/Truncate/index.js +5 -0
- package/admin/src/components/Truncated/index.js +10 -0
- package/admin/src/components/Wysiwyg/EditorWrapper.js +122 -0
- package/admin/src/components/Wysiwyg/MediaLib.js +71 -0
- package/admin/src/components/Wysiwyg/PreviewControlWrapper.js +30 -0
- package/admin/src/components/Wysiwyg/SelectWrapper.js +24 -0
- package/admin/src/components/Wysiwyg/ToggleModeWrapper.js +30 -0
- package/admin/src/components/Wysiwyg/constants.js +98 -0
- package/admin/src/components/Wysiwyg/customSelect.js +39 -0
- package/admin/src/components/Wysiwyg/helpers.js +116 -0
- package/admin/src/components/Wysiwyg/index.js +819 -0
- package/admin/src/components/Wysiwyg/previewControl.js +29 -0
- package/admin/src/components/Wysiwyg/toggleMode.js +44 -0
- package/admin/src/components/Wysiwyg/utils.js +70 -0
- package/admin/src/components/WysiwygBottomControls/components.js +44 -0
- package/admin/src/components/WysiwygBottomControls/index.js +33 -0
- package/admin/src/components/WysiwygDropUpload/Label.js +16 -0
- package/admin/src/components/WysiwygDropUpload/index.js +18 -0
- package/admin/src/components/WysiwygEditor/index.js +26 -0
- package/admin/src/components/WysiwygInlineControls/Button.js +77 -0
- package/admin/src/components/WysiwygInlineControls/StyledButton.js +54 -0
- package/admin/src/components/WysiwygInlineControls/Wrapper.js +25 -0
- package/admin/src/components/WysiwygInlineControls/index.js +66 -0
- package/admin/src/components/WysiwygWithErrors/Wrapper.js +38 -0
- package/admin/src/components/WysiwygWithErrors/index.js +158 -0
- package/admin/src/containers/CollectionTypeFormWrapper/index.js +376 -0
- package/admin/src/containers/CollectionTypeFormWrapper/utils/getRequestUrl.js +5 -0
- package/admin/src/containers/CollectionTypeFormWrapper/utils/index.js +2 -0
- package/admin/src/containers/CollectionTypeRecursivePath/index.js +125 -0
- package/admin/src/containers/ComponentSetttingsView/index.js +55 -0
- package/admin/src/containers/EditSettingsView/index.js +408 -0
- package/admin/src/containers/EditSettingsView/init.js +18 -0
- package/admin/src/containers/EditSettingsView/reducer.js +126 -0
- package/admin/src/containers/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +26 -0
- package/admin/src/containers/EditSettingsView/utils/getInputProps.js +30 -0
- package/admin/src/containers/EditSettingsView/utils/index.js +2 -0
- package/admin/src/containers/EditSettingsView/utils/layout.js +98 -0
- package/admin/src/containers/EditView/DeleteLink/index.js +94 -0
- package/admin/src/containers/EditView/DeleteLink/utils/connect.js +12 -0
- package/admin/src/containers/EditView/DeleteLink/utils/index.js +2 -0
- package/admin/src/containers/EditView/DeleteLink/utils/select.js +21 -0
- package/admin/src/containers/EditView/Header/index.js +258 -0
- package/admin/src/containers/EditView/Header/utils/connect.js +12 -0
- package/admin/src/containers/EditView/Header/utils/getDraftRelations.js +62 -0
- package/admin/src/containers/EditView/Header/utils/index.js +3 -0
- package/admin/src/containers/EditView/Header/utils/select.js +31 -0
- package/admin/src/containers/EditView/InformationCard.js +100 -0
- package/admin/src/containers/EditView/components.js +74 -0
- package/admin/src/containers/EditView/index.js +297 -0
- package/admin/src/containers/EditView/utils/createAttributesLayout.js +39 -0
- package/admin/src/containers/EditView/utils/getFieldsActionMatchingPermissions.js +23 -0
- package/admin/src/containers/EditView/utils/index.js +3 -0
- package/admin/src/containers/EditViewDataManagerProvider/index.js +519 -0
- package/admin/src/containers/EditViewDataManagerProvider/reducer.js +218 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/cleanData.js +88 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/getYupInnerErrors.js +17 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/index.js +3 -0
- package/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +368 -0
- package/admin/src/containers/EditViewLayoutManager/Permissions.js +30 -0
- package/admin/src/containers/EditViewLayoutManager/actions.js +9 -0
- package/admin/src/containers/EditViewLayoutManager/constants.js +2 -0
- package/admin/src/containers/EditViewLayoutManager/index.js +44 -0
- package/admin/src/containers/EditViewLayoutManager/reducer.js +30 -0
- package/admin/src/containers/EditViewLayoutManager/selectors.js +5 -0
- package/admin/src/containers/LayoutDndProvider/index.js +75 -0
- package/admin/src/containers/ListSettingsView/DragWrapper.js +21 -0
- package/admin/src/containers/ListSettingsView/DropdownButton.js +8 -0
- package/admin/src/containers/ListSettingsView/Label.js +91 -0
- package/admin/src/containers/ListSettingsView/MenuDropdown.js +41 -0
- package/admin/src/containers/ListSettingsView/Toggle.js +51 -0
- package/admin/src/containers/ListSettingsView/forms.json +64 -0
- package/admin/src/containers/ListSettingsView/index.js +298 -0
- package/admin/src/containers/ListSettingsView/init.js +11 -0
- package/admin/src/containers/ListSettingsView/reducer.js +77 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/StyledLink.js +28 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/Wrapper.js +8 -0
- package/admin/src/containers/ListView/FieldPicker/ConfigureLink/index.js +29 -0
- package/admin/src/containers/ListView/FieldPicker/Field/Wrapper.js +15 -0
- package/admin/src/containers/ListView/FieldPicker/Field/index.js +24 -0
- package/admin/src/containers/ListView/FieldPicker/Fields/Wrapper.js +18 -0
- package/admin/src/containers/ListView/FieldPicker/Fields/index.js +27 -0
- package/admin/src/containers/ListView/FieldPicker/Header/Reset.js +8 -0
- package/admin/src/containers/ListView/FieldPicker/Header/index.js +42 -0
- package/admin/src/containers/ListView/FieldPicker/Wrapper.js +9 -0
- package/admin/src/containers/ListView/FieldPicker/index.js +46 -0
- package/admin/src/containers/ListView/Filter.js +83 -0
- package/admin/src/containers/ListView/Footer.js +60 -0
- package/admin/src/containers/ListView/actions.js +91 -0
- package/admin/src/containers/ListView/components.js +138 -0
- package/admin/src/containers/ListView/constants.js +16 -0
- package/admin/src/containers/ListView/index.js +573 -0
- package/admin/src/containers/ListView/reducer.js +182 -0
- package/admin/src/containers/ListView/selectors.js +24 -0
- package/admin/src/containers/ListView/utils/buildQueryString.js +26 -0
- package/admin/src/containers/ListView/utils/createPluginsFilter.js +13 -0
- package/admin/src/containers/ListView/utils/getAllAllowedHeaders.js +17 -0
- package/admin/src/containers/ListView/utils/getFirstSortableHeader.js +14 -0
- package/admin/src/containers/ListView/utils/index.js +3 -0
- package/admin/src/containers/ListViewLayoutManager/Permissions.js +29 -0
- package/admin/src/containers/ListViewLayoutManager/index.js +60 -0
- package/admin/src/containers/ListViewProvider/index.js +16 -0
- package/admin/src/containers/Main/actions.js +13 -0
- package/admin/src/containers/Main/constants.js +3 -0
- package/admin/src/containers/Main/index.js +100 -0
- package/admin/src/containers/Main/reducer.js +37 -0
- package/admin/src/containers/Main/selectors.js +20 -0
- package/admin/src/containers/RBACManager/actions.js +14 -0
- package/admin/src/containers/RBACManager/constants.js +2 -0
- package/admin/src/containers/RBACManager/reducer.js +32 -0
- package/admin/src/containers/RBACManager/useSyncRbac.js +28 -0
- package/admin/src/containers/SingleTypeFormWrapper/index.js +317 -0
- package/admin/src/containers/SingleTypeFormWrapper/utils/getRequestUrl.js +5 -0
- package/admin/src/containers/SingleTypeFormWrapper/utils/index.js +2 -0
- package/admin/src/containers/SingleTypeRecursivePath/index.js +84 -0
- package/admin/src/containers/WysiwygProvider/index.js +16 -0
- package/admin/src/contexts/ContentTypeLayout.js +5 -0
- package/admin/src/contexts/LayoutDnd.js +5 -0
- package/admin/src/contexts/ListView.js +5 -0
- package/admin/src/contexts/Wysiwyg.js +5 -0
- package/admin/src/contexts/index.js +4 -0
- package/admin/src/hooks/index.js +6 -0
- package/admin/src/hooks/useContentTypeLayout/index.js +19 -0
- package/admin/src/hooks/useFetchContentTypeLayout/index.js +83 -0
- package/admin/src/hooks/useFetchContentTypeLayout/reducer.js +56 -0
- package/admin/src/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +235 -0
- package/admin/src/hooks/useFindRedirectionLink/index.js +14 -0
- package/admin/src/hooks/useFindRedirectionLink/selectors.js +7 -0
- package/admin/src/hooks/useFindRedirectionLink/utils/getRedirectionLink.js +45 -0
- package/admin/src/hooks/useLayoutDnd.js +6 -0
- package/admin/src/hooks/useListView.js +6 -0
- package/admin/src/hooks/useWysiwyg.js +6 -0
- package/admin/src/icons/Bold/index.js +22 -0
- package/admin/src/icons/Code/index.js +13 -0
- package/admin/src/icons/Cross/index.js +33 -0
- package/admin/src/icons/Italic/index.js +23 -0
- package/admin/src/icons/Link/index.js +21 -0
- package/admin/src/icons/Media/index.js +14 -0
- package/admin/src/icons/Na/index.js +58 -0
- package/admin/src/icons/Ol/index.js +13 -0
- package/admin/src/icons/Quote/index.js +13 -0
- package/admin/src/icons/Striked/index.js +24 -0
- package/admin/src/icons/Ul/index.js +15 -0
- package/admin/src/icons/Underline/index.js +22 -0
- package/admin/src/index.js +52 -0
- package/admin/src/lifecycles.js +19 -0
- package/admin/src/permissions.js +27 -0
- package/admin/src/pluginId.js +5 -0
- package/admin/src/reducers.js +16 -0
- package/admin/src/selectors.js +6 -0
- package/admin/src/sharedReducers/crudReducer/actions.js +44 -0
- package/admin/src/sharedReducers/crudReducer/constants.js +7 -0
- package/admin/src/sharedReducers/crudReducer/reducer.js +75 -0
- package/admin/src/sharedReducers/crudReducer/selectors.js +5 -0
- package/admin/src/testUtils/data.js +305 -0
- package/admin/src/testUtils/index.js +4 -0
- package/admin/src/translations/ar.json +94 -0
- package/admin/src/translations/cs.json +130 -0
- package/admin/src/translations/de.json +177 -0
- package/admin/src/translations/dk.json +180 -0
- package/admin/src/translations/en.json +177 -0
- package/admin/src/translations/es.json +177 -0
- package/admin/src/translations/fr.json +162 -0
- package/admin/src/translations/id.json +175 -0
- package/admin/src/translations/index.js +53 -0
- package/admin/src/translations/it.json +177 -0
- package/admin/src/translations/ja.json +94 -0
- package/admin/src/translations/ko.json +110 -0
- package/admin/src/translations/ms.json +148 -0
- package/admin/src/translations/nl.json +94 -0
- package/admin/src/translations/pl.json +142 -0
- package/admin/src/translations/pt-BR.json +94 -0
- package/admin/src/translations/pt.json +94 -0
- package/admin/src/translations/ru.json +177 -0
- package/admin/src/translations/sk.json +172 -0
- package/admin/src/translations/th.json +155 -0
- package/admin/src/translations/tr.json +177 -0
- package/admin/src/translations/uk.json +148 -0
- package/admin/src/translations/vi.json +110 -0
- package/admin/src/translations/zh-Hans.json +177 -0
- package/admin/src/translations/zh.json +94 -0
- package/admin/src/utils/ItemTypes.js +7 -0
- package/admin/src/utils/checkIfAttributeIsDisplayable.js +13 -0
- package/admin/src/utils/createDefaultForm.js +50 -0
- package/admin/src/utils/dateFormats.js +18 -0
- package/admin/src/utils/formatFiltersFromQuery.js +55 -0
- package/admin/src/utils/formatFiltersToQuery.js +27 -0
- package/admin/src/utils/formatLayoutToApi.js +44 -0
- package/admin/src/utils/generatePermissionsObject.js +20 -0
- package/admin/src/utils/getComponents.js +50 -0
- package/admin/src/utils/getDisplayedValue.js +61 -0
- package/admin/src/utils/getFieldName.js +6 -0
- package/admin/src/utils/getMaxTempKey.js +12 -0
- package/admin/src/utils/getRequestUrl.js +5 -0
- package/admin/src/utils/getTrad.js +5 -0
- package/admin/src/utils/index.js +17 -0
- package/admin/src/utils/mergeMetasWithSchema.js +20 -0
- package/admin/src/utils/removeKeyInObject.js +45 -0
- package/admin/src/utils/removePasswordFieldsFromData.js +54 -0
- package/config/admin.json +5 -0
- package/config/functions/bootstrap.js +9 -0
- package/config/policies/has-draft-and-publish.js +19 -0
- package/config/policies/hasPermissions.js +34 -0
- package/config/policies/routing.js +27 -0
- package/config/routes.json +275 -0
- package/controllers/collection-types.js +282 -0
- package/controllers/components.js +66 -0
- package/controllers/content-types.js +112 -0
- package/controllers/relations.js +63 -0
- package/controllers/single-types.js +170 -0
- package/controllers/uid.js +41 -0
- package/controllers/validation/index.js +104 -0
- package/controllers/validation/model-configuration.js +114 -0
- package/oas.yml +757 -0
- package/package.json +77 -0
- package/services/components.js +92 -0
- package/services/configuration.js +79 -0
- package/services/content-types.js +73 -0
- package/services/data-mapper.js +98 -0
- package/services/entity-manager.js +140 -0
- package/services/metrics.js +34 -0
- package/services/permission-checker.js +69 -0
- package/services/permission.js +95 -0
- package/services/uid.js +63 -0
- package/services/utils/configuration/attributes.js +175 -0
- package/services/utils/configuration/index.js +43 -0
- package/services/utils/configuration/layouts.js +185 -0
- package/services/utils/configuration/metadatas.js +142 -0
- package/services/utils/configuration/settings.js +52 -0
- package/services/utils/store.js +93 -0
- package/utils/index.js +16 -0
- package/utils/pick-writable-attributes.js +6 -0
- package/utils/wrap-bad-request.js +15 -0
- package/validation/policies/hasPermissions.js +17 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { memo, useCallback } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { get } from 'lodash';
|
|
4
|
+
|
|
5
|
+
import useLayoutDnd from '../../hooks/useLayoutDnd';
|
|
6
|
+
|
|
7
|
+
import Add from '../AddDropdown';
|
|
8
|
+
import SortWrapper from '../SortWrapper';
|
|
9
|
+
import Wrapper from './components';
|
|
10
|
+
import Item from './Item';
|
|
11
|
+
|
|
12
|
+
const FieldsReorder = ({ className }) => {
|
|
13
|
+
const {
|
|
14
|
+
attributes,
|
|
15
|
+
buttonData,
|
|
16
|
+
layout,
|
|
17
|
+
moveItem,
|
|
18
|
+
moveRow,
|
|
19
|
+
onAddData,
|
|
20
|
+
removeField,
|
|
21
|
+
} = useLayoutDnd();
|
|
22
|
+
|
|
23
|
+
const getComponent = useCallback(
|
|
24
|
+
attributeName => {
|
|
25
|
+
return get(attributes, [attributeName, 'component'], '');
|
|
26
|
+
},
|
|
27
|
+
[attributes]
|
|
28
|
+
);
|
|
29
|
+
const getType = useCallback(
|
|
30
|
+
attributeName => {
|
|
31
|
+
const attribute = get(attributes, [attributeName], {});
|
|
32
|
+
|
|
33
|
+
return attribute.type;
|
|
34
|
+
},
|
|
35
|
+
[attributes]
|
|
36
|
+
);
|
|
37
|
+
const getDynamicZoneComponents = useCallback(
|
|
38
|
+
attributeName => {
|
|
39
|
+
const attribute = get(attributes, [attributeName], {});
|
|
40
|
+
|
|
41
|
+
return attribute.components || [];
|
|
42
|
+
},
|
|
43
|
+
[attributes]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={className}>
|
|
48
|
+
<SortWrapper
|
|
49
|
+
style={{
|
|
50
|
+
marginTop: 7,
|
|
51
|
+
paddingTop: 11,
|
|
52
|
+
paddingLeft: 5,
|
|
53
|
+
paddingRight: 5,
|
|
54
|
+
border: '1px dashed #e3e9f3',
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{layout.map((row, rowIndex) => {
|
|
58
|
+
return (
|
|
59
|
+
<Wrapper key={row.rowId} style={{}}>
|
|
60
|
+
{row.rowContent.map((rowContent, index) => {
|
|
61
|
+
const { name, size } = rowContent;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Item
|
|
65
|
+
componentUid={getComponent(name)}
|
|
66
|
+
dynamicZoneComponents={getDynamicZoneComponents(name)}
|
|
67
|
+
itemIndex={index}
|
|
68
|
+
key={name}
|
|
69
|
+
moveRow={moveRow}
|
|
70
|
+
moveItem={moveItem}
|
|
71
|
+
name={name}
|
|
72
|
+
removeField={removeField}
|
|
73
|
+
rowIndex={rowIndex}
|
|
74
|
+
size={size}
|
|
75
|
+
type={getType(name)}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</Wrapper>
|
|
80
|
+
);
|
|
81
|
+
})}
|
|
82
|
+
<Wrapper style={{ marginBottom: 10 }}>
|
|
83
|
+
<Add
|
|
84
|
+
data={buttonData}
|
|
85
|
+
onClick={onAddData}
|
|
86
|
+
style={{ width: '100%', margin: '0 5px' }}
|
|
87
|
+
/>
|
|
88
|
+
</Wrapper>
|
|
89
|
+
</SortWrapper>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
FieldsReorder.defaultProps = {
|
|
95
|
+
className: 'col-8',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
FieldsReorder.propTypes = {
|
|
99
|
+
className: PropTypes.string,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default memo(FieldsReorder);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const FilterOptionsCTA = styled.button`
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
height: 20px;
|
|
7
|
+
width: 20px;
|
|
8
|
+
margin: 8px 5px 0px 0px;
|
|
9
|
+
border-radius: 50%;
|
|
10
|
+
border: 1px solid #E3E9F3;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export default FilterOptionsCTA;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable indent */
|
|
4
|
+
const Wrapper = styled.div`
|
|
5
|
+
margin-top: -6px;
|
|
6
|
+
> div {
|
|
7
|
+
padding-top: 2px;
|
|
8
|
+
&:not(:first-of-type) {
|
|
9
|
+
padding-top: 9px;
|
|
10
|
+
padding-bottom: 2px;
|
|
11
|
+
&:last-of-type:nth-of-type(even) {
|
|
12
|
+
padding-bottom: 11px;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const Span = styled.span`
|
|
19
|
+
vertical-align: text-top;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
|
|
22
|
+
&:after {
|
|
23
|
+
margin-left: 2px;
|
|
24
|
+
content: '\f077';
|
|
25
|
+
font-family: FontAwesome;
|
|
26
|
+
font-size: 10px;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const Flex = styled.div`
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: flex-end;
|
|
33
|
+
padding: 0 0 10px 30px !important;
|
|
34
|
+
margin-top: -10px;
|
|
35
|
+
color: #c3c5c8;
|
|
36
|
+
font-size: 13px;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const Div = styled.div`
|
|
40
|
+
width: calc(100% + 60px);
|
|
41
|
+
margin: ${props => (props.show ? '-100px -30px 30px' : `-${props.number}px -30px 103px`)};
|
|
42
|
+
background: #fff;
|
|
43
|
+
box-shadow: 3px 2px 4px #e3e9f3;
|
|
44
|
+
padding: 18px 30px 0px 30px;
|
|
45
|
+
transition: ${props => {
|
|
46
|
+
if (props.anim) {
|
|
47
|
+
return props.show
|
|
48
|
+
? 'margin-top .3s ease-out, margin-bottom .2s ease-out'
|
|
49
|
+
: 'margin .3s ease-in';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return '';
|
|
53
|
+
}};
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
export { Div, Flex, Span, Wrapper };
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import React, { memo, useCallback, useMemo, useReducer, useRef } from 'react';
|
|
2
|
+
import { withRouter } from 'react-router';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { capitalize, get } from 'lodash';
|
|
5
|
+
import { Collapse } from 'reactstrap';
|
|
6
|
+
import { FormattedMessage } from 'react-intl';
|
|
7
|
+
import {
|
|
8
|
+
PluginHeader,
|
|
9
|
+
getFilterType,
|
|
10
|
+
useUser,
|
|
11
|
+
findMatchingPermissions,
|
|
12
|
+
useGlobalContext,
|
|
13
|
+
} from 'strapi-helper-plugin';
|
|
14
|
+
|
|
15
|
+
import pluginId from '../../pluginId';
|
|
16
|
+
import { formatFiltersToQuery, getTrad } from '../../utils';
|
|
17
|
+
import Container from '../Container';
|
|
18
|
+
import FilterPickerOption from '../FilterPickerOption';
|
|
19
|
+
import { Flex, Span, Wrapper } from './components';
|
|
20
|
+
import init from './init';
|
|
21
|
+
import reducer, { initialState } from './reducer';
|
|
22
|
+
|
|
23
|
+
const NOT_ALLOWED_FILTERS = ['json', 'component', 'media', 'richtext', 'dynamiczone'];
|
|
24
|
+
|
|
25
|
+
function FilterPicker({
|
|
26
|
+
contentType,
|
|
27
|
+
filters,
|
|
28
|
+
isOpen,
|
|
29
|
+
metadatas,
|
|
30
|
+
name,
|
|
31
|
+
toggleFilterPickerState,
|
|
32
|
+
setQuery,
|
|
33
|
+
slug,
|
|
34
|
+
}) {
|
|
35
|
+
const { emitEvent } = useGlobalContext();
|
|
36
|
+
const emitEventRef = useRef(emitEvent);
|
|
37
|
+
const { userPermissions } = useUser();
|
|
38
|
+
const readActionAllowedFields = useMemo(() => {
|
|
39
|
+
const matchingPermissions = findMatchingPermissions(userPermissions, [
|
|
40
|
+
{
|
|
41
|
+
action: 'plugins::content-manager.explorer.read',
|
|
42
|
+
subject: slug,
|
|
43
|
+
},
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
return get(matchingPermissions, ['0', 'properties', 'fields'], []);
|
|
47
|
+
}, [userPermissions, slug]);
|
|
48
|
+
|
|
49
|
+
let timestamps = get(contentType, ['options', 'timestamps']);
|
|
50
|
+
|
|
51
|
+
if (!Array.isArray(timestamps)) {
|
|
52
|
+
timestamps = [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const actions = [
|
|
56
|
+
{
|
|
57
|
+
label: getTrad('components.FiltersPickWrapper.PluginHeader.actions.clearAll'),
|
|
58
|
+
kind: 'secondary',
|
|
59
|
+
onClick: () => {
|
|
60
|
+
toggleFilterPickerState();
|
|
61
|
+
setQuery({ _where: [] }, 'remove');
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: getTrad('components.FiltersPickWrapper.PluginHeader.actions.apply'),
|
|
66
|
+
kind: 'primary',
|
|
67
|
+
type: 'submit',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const allowedAttributes = Object.keys(get(contentType, ['attributes']), {})
|
|
72
|
+
.filter(attr => {
|
|
73
|
+
const current = get(contentType, ['attributes', attr], {});
|
|
74
|
+
|
|
75
|
+
if (!readActionAllowedFields.includes(attr) && attr !== 'id' && !timestamps.includes(attr)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return !NOT_ALLOWED_FILTERS.includes(current.type) && current.type !== undefined;
|
|
80
|
+
})
|
|
81
|
+
.sort()
|
|
82
|
+
.map(attr => {
|
|
83
|
+
const current = get(contentType, ['attributes', attr], {});
|
|
84
|
+
|
|
85
|
+
return { name: attr, type: current.type, options: current.enum || null };
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const [state, dispatch] = useReducer(reducer, initialState, () =>
|
|
89
|
+
init(initialState, allowedAttributes[0] || {})
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const modifiedData = state.get('modifiedData').toJS();
|
|
93
|
+
const handleChange = ({ target: { name, value } }) => {
|
|
94
|
+
dispatch({
|
|
95
|
+
type: 'ON_CHANGE',
|
|
96
|
+
keys: name.split('.'),
|
|
97
|
+
value,
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const renderTitle = () => (
|
|
102
|
+
<FormattedMessage id={`${pluginId}.components.FiltersPickWrapper.PluginHeader.title.filter`}>
|
|
103
|
+
{message => (
|
|
104
|
+
<span>
|
|
105
|
+
{capitalize(name)} -
|
|
106
|
+
<span>{message}</span>
|
|
107
|
+
</span>
|
|
108
|
+
)}
|
|
109
|
+
</FormattedMessage>
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const initialFilter = useMemo(() => {
|
|
113
|
+
const type = get(allowedAttributes, [0, 'type'], '');
|
|
114
|
+
const [filter] = getFilterType(type);
|
|
115
|
+
|
|
116
|
+
let value = '';
|
|
117
|
+
|
|
118
|
+
switch (type) {
|
|
119
|
+
case 'boolean': {
|
|
120
|
+
value = 'true';
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case 'number': {
|
|
124
|
+
value = 0;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case 'enumeration': {
|
|
128
|
+
value = get(allowedAttributes, [0, 'options', 0], '');
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
default: {
|
|
132
|
+
value = '';
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const initFilter = {
|
|
137
|
+
name: get(allowedAttributes, [0, 'name'], ''),
|
|
138
|
+
filter: filter.value,
|
|
139
|
+
value,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return initFilter;
|
|
143
|
+
}, [allowedAttributes]);
|
|
144
|
+
|
|
145
|
+
// Set the filters when the collapse is opening
|
|
146
|
+
const handleEntering = () => {
|
|
147
|
+
const currentFilters = filters;
|
|
148
|
+
const initialFilters = currentFilters.length ? currentFilters : [initialFilter];
|
|
149
|
+
|
|
150
|
+
dispatch({
|
|
151
|
+
type: 'SET_FILTERS',
|
|
152
|
+
initialFilters,
|
|
153
|
+
attributes: get(contentType, 'attributes', {}),
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const addFilter = () => {
|
|
158
|
+
dispatch({
|
|
159
|
+
type: 'ADD_FILTER',
|
|
160
|
+
filter: initialFilter,
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const handleSubmit = useCallback(
|
|
165
|
+
e => {
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
const nextFilters = formatFiltersToQuery(modifiedData, metadatas);
|
|
168
|
+
const useRelation = nextFilters._where.some(obj => Object.keys(obj)[0].includes('.'));
|
|
169
|
+
|
|
170
|
+
emitEventRef.current('didFilterEntries', { useRelation });
|
|
171
|
+
setQuery({ ...nextFilters, page: 1 });
|
|
172
|
+
toggleFilterPickerState();
|
|
173
|
+
},
|
|
174
|
+
[modifiedData, setQuery, toggleFilterPickerState, metadatas]
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const handleRemoveFilter = index => {
|
|
178
|
+
if (index === 0 && modifiedData.length === 1) {
|
|
179
|
+
toggleFilterPickerState();
|
|
180
|
+
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
dispatch({
|
|
185
|
+
type: 'REMOVE_FILTER',
|
|
186
|
+
index,
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const getAttributeType = useCallback(
|
|
191
|
+
filter => {
|
|
192
|
+
const attributeType = get(contentType, ['attributes', filter.name, 'type'], '');
|
|
193
|
+
|
|
194
|
+
if (attributeType === 'relation') {
|
|
195
|
+
return get(metadatas, [filter.name, 'list', 'mainField', 'schema', 'type'], 'string');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return attributeType;
|
|
199
|
+
},
|
|
200
|
+
[contentType, metadatas]
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<Collapse isOpen={isOpen} onEntering={handleEntering}>
|
|
205
|
+
<Container style={{ backgroundColor: 'white', paddingBottom: 0 }}>
|
|
206
|
+
<form onSubmit={handleSubmit}>
|
|
207
|
+
<PluginHeader
|
|
208
|
+
actions={actions}
|
|
209
|
+
title={renderTitle}
|
|
210
|
+
description={{
|
|
211
|
+
id: `${pluginId}.components.FiltersPickWrapper.PluginHeader.description`,
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
<Wrapper>
|
|
215
|
+
{modifiedData.map((filter, key) => (
|
|
216
|
+
<FilterPickerOption
|
|
217
|
+
{...filter}
|
|
218
|
+
allowedAttributes={allowedAttributes}
|
|
219
|
+
index={key}
|
|
220
|
+
modifiedData={modifiedData}
|
|
221
|
+
onChange={handleChange}
|
|
222
|
+
onClickAddFilter={addFilter}
|
|
223
|
+
onRemoveFilter={handleRemoveFilter}
|
|
224
|
+
type={getAttributeType(filter)}
|
|
225
|
+
showAddButton={key === modifiedData.length - 1}
|
|
226
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
227
|
+
key={key}
|
|
228
|
+
/>
|
|
229
|
+
))}
|
|
230
|
+
</Wrapper>
|
|
231
|
+
<Flex>
|
|
232
|
+
<Span onClick={toggleFilterPickerState}>
|
|
233
|
+
<FormattedMessage id="content-manager.components.FiltersPickWrapper.hide" />
|
|
234
|
+
|
|
235
|
+
</Span>
|
|
236
|
+
</Flex>
|
|
237
|
+
</form>
|
|
238
|
+
</Container>
|
|
239
|
+
</Collapse>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
FilterPicker.defaultProps = {
|
|
244
|
+
name: '',
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
FilterPicker.propTypes = {
|
|
248
|
+
contentType: PropTypes.object.isRequired,
|
|
249
|
+
filters: PropTypes.array.isRequired,
|
|
250
|
+
isOpen: PropTypes.bool.isRequired,
|
|
251
|
+
metadatas: PropTypes.object.isRequired,
|
|
252
|
+
name: PropTypes.string,
|
|
253
|
+
setQuery: PropTypes.func.isRequired,
|
|
254
|
+
slug: PropTypes.string.isRequired,
|
|
255
|
+
toggleFilterPickerState: PropTypes.func.isRequired,
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export default withRouter(memo(FilterPicker));
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { fromJS } from 'immutable';
|
|
2
|
+
import { getFilterType } from 'strapi-helper-plugin';
|
|
3
|
+
import { get } from 'lodash';
|
|
4
|
+
|
|
5
|
+
function init(initialState, { name, type, options }) {
|
|
6
|
+
// Create the first filter
|
|
7
|
+
const [filter] = getFilterType(type);
|
|
8
|
+
let value = '';
|
|
9
|
+
|
|
10
|
+
if (type === 'boolean') {
|
|
11
|
+
value = 'true';
|
|
12
|
+
} else if (type === 'number') {
|
|
13
|
+
value = 0;
|
|
14
|
+
} else if (type === 'enumeration') {
|
|
15
|
+
value = get(options, [0], '');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const initialFilter = { name, filter: filter.value, value };
|
|
19
|
+
|
|
20
|
+
return initialState
|
|
21
|
+
.update('initialData', () => fromJS([initialFilter]))
|
|
22
|
+
.update('modifiedData', () => fromJS([initialFilter]));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default init;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { fromJS } from 'immutable';
|
|
2
|
+
|
|
3
|
+
const initialState = fromJS({
|
|
4
|
+
attributes: {},
|
|
5
|
+
initialData: [],
|
|
6
|
+
modifiedData: [],
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
function reducer(state, action) {
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
case 'ADD_FILTER':
|
|
12
|
+
return state.update('modifiedData', list => list.push(fromJS(action.filter)));
|
|
13
|
+
case 'ON_CHANGE': {
|
|
14
|
+
const [index, key] = action.keys;
|
|
15
|
+
|
|
16
|
+
return state
|
|
17
|
+
.updateIn(['modifiedData', ...action.keys], () => {
|
|
18
|
+
if (action.value && action.value._isAMomentObject === true) {
|
|
19
|
+
return action.value.toISOString();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return action.value;
|
|
23
|
+
})
|
|
24
|
+
.updateIn(['modifiedData', index, 'value'], value => {
|
|
25
|
+
if (key === 'name') {
|
|
26
|
+
const attribute = state.getIn(['attributes', action.value]);
|
|
27
|
+
const attributeType = attribute.get('type');
|
|
28
|
+
|
|
29
|
+
if (attributeType === 'boolean') {
|
|
30
|
+
return 'true';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (attributeType === 'enumeration') {
|
|
34
|
+
return attribute.getIn(['enum', '0']) || '';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return value;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
case 'REMOVE_FILTER':
|
|
44
|
+
return state.removeIn(['modifiedData', action.index]);
|
|
45
|
+
case 'RESET_FILTERS':
|
|
46
|
+
return initialState;
|
|
47
|
+
case 'SET_FILTERS':
|
|
48
|
+
return state
|
|
49
|
+
.update('attributes', () => fromJS(action.attributes))
|
|
50
|
+
.update('initialData', () => fromJS(action.initialFilters))
|
|
51
|
+
.update('modifiedData', () => fromJS(action.initialFilters));
|
|
52
|
+
default:
|
|
53
|
+
return state;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default reducer;
|
|
58
|
+
export { initialState };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* InputWithAutoFocus that programatically manage the autofocus of another one
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { memo } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
|
|
9
|
+
import { DateTime } from '@buffetjs/custom';
|
|
10
|
+
import { DatePicker, InputText, InputNumber, Select, TimePicker } from '@buffetjs/core';
|
|
11
|
+
import { InputWrapperDate } from './components';
|
|
12
|
+
|
|
13
|
+
const getInputType = attrType => {
|
|
14
|
+
switch (attrType) {
|
|
15
|
+
case 'boolean':
|
|
16
|
+
return Select;
|
|
17
|
+
case 'date':
|
|
18
|
+
case 'timestamp':
|
|
19
|
+
case 'timestampUpdate':
|
|
20
|
+
return DatePicker;
|
|
21
|
+
case 'datetime':
|
|
22
|
+
return DateTime;
|
|
23
|
+
case 'enumeration':
|
|
24
|
+
return Select;
|
|
25
|
+
case 'integer':
|
|
26
|
+
case 'biginteger':
|
|
27
|
+
case 'decimal':
|
|
28
|
+
case 'float':
|
|
29
|
+
return InputNumber;
|
|
30
|
+
case 'time':
|
|
31
|
+
return TimePicker;
|
|
32
|
+
default:
|
|
33
|
+
return InputText;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
function Input({ type, ...rest }) {
|
|
38
|
+
const Component = getInputType(type);
|
|
39
|
+
let style = type !== 'time' ? { width: '210px' } : {};
|
|
40
|
+
|
|
41
|
+
if (['integer', 'biginteger', 'float', 'decimal'].includes(type)) {
|
|
42
|
+
style = { marginRight: '15px' };
|
|
43
|
+
}
|
|
44
|
+
const styles = type === 'boolean' ? { minWidth: '100px', maxWidth: '200px' } : style;
|
|
45
|
+
const wrapperStyle = { marginRight: '15px' };
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<InputWrapperDate type={type || 'text'} style={wrapperStyle}>
|
|
49
|
+
<Component {...rest} style={styles} autoComplete="off" />
|
|
50
|
+
</InputWrapperDate>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
Input.propTypes = {
|
|
55
|
+
type: PropTypes.string.isRequired,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default memo(Input);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
const Option = ({ id, value }) => {
|
|
6
|
+
return (
|
|
7
|
+
<FormattedMessage id={id}>
|
|
8
|
+
{msg => <option value={value}>{msg}</option>}
|
|
9
|
+
</FormattedMessage>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
Option.propTypes = {
|
|
14
|
+
id: PropTypes.string.isRequired,
|
|
15
|
+
value: PropTypes.string.isRequired,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default Option;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
const Wrapper = styled.div`
|
|
6
|
+
min-height: 38px;
|
|
7
|
+
border-left: ${props => props.borderLeft && '3px solid #007EFF'};
|
|
8
|
+
padding-left: ${props => (props.borderLeft ? '10px' : '13px')};
|
|
9
|
+
margin-bottom: 0px !important;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const InputWrapper = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
input,
|
|
15
|
+
select {
|
|
16
|
+
margin: 0px 5px !important;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const InputWrapperDate = styled.div`
|
|
21
|
+
margin-right: 10px;
|
|
22
|
+
span {
|
|
23
|
+
left: 5px;
|
|
24
|
+
}
|
|
25
|
+
.rc-input-number-handler-wrap {
|
|
26
|
+
right: -5px !important;
|
|
27
|
+
}
|
|
28
|
+
.rc-input-number-input-wrap {
|
|
29
|
+
max-width: 210px;
|
|
30
|
+
overflow: visible;
|
|
31
|
+
}
|
|
32
|
+
> div {
|
|
33
|
+
width: 210px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${({ type }) => {
|
|
37
|
+
if (type === 'datetime') {
|
|
38
|
+
return `
|
|
39
|
+
> div {
|
|
40
|
+
width: 300px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
}}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const Input = styled.input`
|
|
49
|
+
height: 3.4rem;
|
|
50
|
+
margin-top: 0.9rem;
|
|
51
|
+
padding-left: 1rem;
|
|
52
|
+
background-size: 0 !important;
|
|
53
|
+
border: 1px solid #e3e9f3;
|
|
54
|
+
border-radius: 0.25rem;
|
|
55
|
+
line-height: 3.4rem;
|
|
56
|
+
font-size: 1.3rem;
|
|
57
|
+
font-family: 'Lato' !important;
|
|
58
|
+
box-shadow: 0px 1px 1px rgba(104, 118, 142, 0.05);
|
|
59
|
+
`;
|
|
60
|
+
export { InputWrapper, Wrapper, InputWrapperDate, Input };
|