-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BACKLOG-22108: Asset provider selector with extension point for 8.1 (#…
- Loading branch information
Showing
66 changed files
with
654 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
107 changes: 107 additions & 0 deletions
107
src/javascript/SelectorTypes/Picker/JahiaPicker/JahiaPicker.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import React, {useEffect} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
cePickerClearSelection, | ||
cePickerMode, | ||
cePickerPath, | ||
cePickerSetMultiple, | ||
cePickerSetPage, | ||
cePickerSetSearchTerm | ||
} from '~/SelectorTypes/Picker/Picker.redux'; | ||
import {batchActions} from 'redux-batched-actions'; | ||
import {configPropType} from '../configs/configPropType'; | ||
import {booleanValue} from '../Picker.utils'; | ||
import {useDispatch} from 'react-redux'; | ||
import RightPanel from './RightPanel'; | ||
import {ContentNavigation} from '@jahia/jcontent'; | ||
import {SelectionHandler} from './SelectionHandler'; | ||
import {PickerSiteSwitcher} from './PickerSiteSwitcher'; | ||
|
||
const selector = state => ({ | ||
mode: state.contenteditor.picker.mode, | ||
siteKey: state.contenteditor.picker.site, | ||
language: state.contenteditor.ceLanguage | ||
}); | ||
|
||
export const JahiaPicker = ({ | ||
isOpen, | ||
onClose, | ||
initialSelectedItem, | ||
site, | ||
pickerConfig, | ||
lang, | ||
uilang, | ||
isMultiple, | ||
accordionItemProps, | ||
onItemSelection | ||
}) => { | ||
const dispatch = useDispatch(); | ||
|
||
useEffect(() => { | ||
if (isOpen) { | ||
dispatch(batchActions([ | ||
cePickerSetSearchTerm(''), | ||
cePickerSetPage(0), | ||
cePickerSetMultiple(isMultiple) | ||
])); | ||
} | ||
|
||
return () => { | ||
if (isOpen) { | ||
dispatch(cePickerClearSelection()); | ||
} | ||
}; | ||
}, [dispatch, pickerConfig.key, isOpen, isMultiple]); | ||
|
||
return ( | ||
<SelectionHandler site={site} | ||
pickerConfig={pickerConfig} | ||
accordionItemProps={accordionItemProps} | ||
initialSelectedItem={initialSelectedItem} | ||
lang={lang} | ||
uilang={uilang} | ||
> | ||
{booleanValue(pickerConfig.pickerDialog.displayTree) && ( | ||
<aside> | ||
<ContentNavigation | ||
isReversed={false} | ||
header={(booleanValue(pickerConfig.pickerDialog.displaySiteSwitcher) && ( | ||
<div> | ||
<PickerSiteSwitcher pickerConfig={pickerConfig} | ||
accordionItemProps={accordionItemProps}/> | ||
</div> | ||
))} | ||
accordionItemTarget={pickerConfig.key} | ||
accordionItemProps={accordionItemProps} | ||
selector={selector} | ||
handleNavigationAction={(mode, path) => (batchActions([cePickerPath(path), cePickerMode(mode)]))} | ||
/> | ||
</aside> | ||
)} | ||
<RightPanel pickerConfig={pickerConfig} | ||
accordionItemProps={accordionItemProps} | ||
isMultiple={isMultiple} | ||
lang={lang} | ||
uilang={uilang} | ||
onClose={onClose} | ||
onItemSelection={onItemSelection}/> | ||
</SelectionHandler> | ||
); | ||
}; | ||
|
||
JahiaPicker.propTypes = { | ||
isOpen: PropTypes.bool.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
site: PropTypes.string.isRequired, | ||
pickerConfig: configPropType.isRequired, | ||
initialSelectedItem: PropTypes.arrayOf(PropTypes.object), | ||
accordionItemProps: PropTypes.object, | ||
lang: PropTypes.string, | ||
uilang: PropTypes.string, | ||
isMultiple: PropTypes.bool, | ||
onItemSelection: PropTypes.func.isRequired | ||
}; | ||
|
||
JahiaPicker.defaultValues = { | ||
initialSelectedItem: [] | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...lectorTypes/Picker/JahiaPicker/RightPanel/PickerContentLayout/PickerContentTable/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './PickerContentTable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
.../SelectorTypes/Picker/JahiaPicker/RightPanel/PickerContentLayout/PickerFilesGrid/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import PickerFilesGrid from './PickerFilesGrid'; | ||
|
||
export default PickerFilesGrid; |
3 changes: 3 additions & 0 deletions
3
src/javascript/SelectorTypes/Picker/JahiaPicker/RightPanel/PickerContentLayout/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import ContentLayout from '~/SelectorTypes/Picker/JahiaPicker/RightPanel/PickerContentLayout/PickerContentLayout.container'; | ||
|
||
export default ContentLayout; |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.