| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 | 
							- // @flow
 - 
 - import SideContainerToggler
 -     from '../../../modules/UI/side_pannels/SideContainerToggler';
 - 
 - import getDefaultButtons from './defaultToolbarButtons';
 - 
 - declare var interfaceConfig: Object;
 - 
 - export {
 -     abstractMapDispatchToProps,
 -     abstractMapStateToProps,
 -     getButton
 - } from './functions.native';
 - 
 - /**
 -  * Returns an object which contains the default buttons for the primary and
 -  * secondary toolbars.
 -  *
 -  * @param {Object} buttonHandlers - Contains additional toolbox button
 -  * handlers.
 -  * @returns {Object}
 -  */
 - export function getDefaultToolboxButtons(buttonHandlers: Object): Object {
 -     let toolbarButtons = {
 -         primaryToolbarButtons: new Map(),
 -         secondaryToolbarButtons: new Map()
 -     };
 - 
 -     if (typeof interfaceConfig !== 'undefined'
 -             && interfaceConfig.TOOLBAR_BUTTONS) {
 - 
 -         toolbarButtons
 -             = interfaceConfig.TOOLBAR_BUTTONS.reduce(
 -                 (acc, buttonName) => {
 -                     const buttons = getDefaultButtons();
 -                     let button = buttons ? buttons[buttonName] : null;
 -                     const currentButtonHandlers = buttonHandlers[buttonName];
 - 
 -                     if (button) {
 -                         const place = _getToolbarButtonPlace(buttonName);
 - 
 -                         button.buttonName = buttonName;
 - 
 -                         if (currentButtonHandlers) {
 -                             button = {
 -                                 ...button,
 -                                 ...currentButtonHandlers
 -                             };
 -                         }
 - 
 -                         // If isDisplayed method is not defined, display the
 -                         // button only for non-filmstripOnly mode
 -                         if (button.isDisplayed()) {
 -                             acc[place].set(buttonName, button);
 -                         }
 -                     }
 - 
 -                     return acc;
 -                 },
 -                 toolbarButtons);
 -     }
 - 
 -     return toolbarButtons;
 - }
 - 
 - /**
 -  * Returns toolbar class names to add while rendering.
 -  *
 -  * @param {Object} props - Props object pass to React component.
 -  * @returns {Object}
 -  * @private
 -  */
 - export function getToolbarClassNames(props: Object) {
 -     const primaryToolbarClassNames = [
 -         interfaceConfig.filmStripOnly
 -             ? 'toolbar_filmstrip-only'
 -             : 'toolbar_primary'
 -     ];
 -     const secondaryToolbarClassNames = [ 'toolbar_secondary' ];
 - 
 -     if (props._visible) {
 -         const slideInAnimation
 -             = SideContainerToggler.isVisible ? 'slideInExtX' : 'slideInX';
 - 
 -         primaryToolbarClassNames.push('fadeIn');
 -         secondaryToolbarClassNames.push(slideInAnimation);
 -     } else {
 -         const slideOutAnimation
 -             = SideContainerToggler.isVisible ? 'slideOutExtX' : 'slideOutX';
 - 
 -         primaryToolbarClassNames.push('fadeOut');
 -         secondaryToolbarClassNames.push(slideOutAnimation);
 -     }
 - 
 -     return {
 -         primaryToolbarClassName: primaryToolbarClassNames.join(' '),
 -         secondaryToolbarClassName: secondaryToolbarClassNames.join(' ')
 -     };
 - }
 - 
 - /**
 -  * Helper for getting the height of the toolbox.
 -  *
 -  * @returns {number} The height of the toolbox.
 -  */
 - export function getToolboxHeight() {
 -     const toolbox = document.getElementById('new-toolbox');
 - 
 -     return (toolbox && toolbox.clientHeight) || 0;
 - }
 - 
 - /**
 -  * Indicates if a toolbar button is enabled.
 -  *
 -  * @param {string} name - The name of the setting section as defined in
 -  * interface_config.js.
 -  * @returns {boolean} - True to indicate that the given toolbar button
 -  * is enabled, false - otherwise.
 -  */
 - export function isButtonEnabled(name: string) {
 -     return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
 -             || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
 - }
 - 
 - /**
 -  * Get place for toolbar button. Now it can be in the primary Toolbar or in the
 -  * secondary Toolbar.
 -  *
 -  * @param {string} btn - Button name.
 -  * @private
 -  * @returns {string}
 -  */
 - function _getToolbarButtonPlace(btn) {
 -     return (
 -         interfaceConfig.MAIN_TOOLBAR_BUTTONS.includes(btn)
 -             ? 'primaryToolbarButtons'
 -             : 'secondaryToolbarButtons');
 - }
 
 
  |