APIs

Show:

Menu component for Semantic UI.

Questions:

  • Need in flexberry-menu.hbs?

Methods

_getActionForMenu

(
  • collapseMenuOnItemClick
)
String private

Method for getting action name for menu based on collapseMenuOnItemClick property.

Parameters:

  • collapseMenuOnItemClick Boolean

    Flag whether to collapse menu on click or not.

Returns:

String:

Action name.

_onClickHandler

(
  • e
)
private

Menu click handler. Used to delegate menu items clicks handling.

Parameters:

  • e JQuery.Event

    Click event object.

configurateItems

(
  • items
)

Hook which will be called to configure menu items.

Parameters:

  • items Array

    Menu items array.

Example:

<!-- app/templates/menu.hbs -->
                    {{flexberry-menu
                      ...
                      configurateItems=(action 'configurateItems')
                      ...
                    }}
                    
// app/controllers/menu.js
                    export default Controller.extend({
                    ...
                      actions: {
                        ...
                        configurateItems(items) {
                          items.push({
                            icon: 'edit icon',
                            title: 'Edit',
                          });
                        },
                        ...
                      }
                    ...
                    });
                    

getTargetObjectByCondition.

(
  • condition
)
Null | Component | Controller

Returns that 'targetObject' (from 'targetObject's hierarchy) which satisfies a given condition.

let controller = this.getTargetObjectByCondition((targetObject) => {
                      return targetObject instanceof Controller;
                    });
                    

Parameters:

  • condition Function

    Callback-function, which will be called for each 'targetObject' in 'targetObject's hierarchy, until callback return true for one of them.

Returns:

Null | Component | Controller:

Target object which satisfies a given condition or null.

initProperty

(
  • options
)

Initializes component's property with recpect to following priority: 1 - template-defined parameters, 2 - applicaion configuration-defined parameters (JSON from ./config/environment by path defined in 'appConfigSettingsPath' property), 3 - component-defined defaults. Note! It is important to be declared as undefined for those component properties, which will be initialized through 'initProperty' call.

// ./config/environment.js.
                    module.exports = function(environment) {
                      var ENV = {
                        APP: {
                          components: {
                            myComponent: {
                              myComponentProperty: 'myComponentProperty config-defined default value',
                            }
                          }
                        }
                      };
                      return ENV;
                    };
                    
// /components/my-component.js
                    import FlexberryBaseComponent from 'ember-flexberry/flexberry-base-component';
                    
                    export default FlexberryBaseComponent.extend({
                      appConfigSettingsPath: 'APP.components.myComponent',
                    
                      myComponentProperty: undefined,
                    
                      init() {
                        this._super.apply(this, arguments);
                        this.initProperty({ propertyName: 'myComponentProperty', defaultValue: 'myComponentProperty default value' });
                      }
                    });
                    

Parameters:

  • options Object

    Method options.

    • propertyName String

      Component's property name.

    • defaultValue

      Component's property default value (from component defined default's).

Properties

_skipDropdownInit

Boolean private

See comment on using this.

Default: false

appConfig

Object

Application configuration (JSON from ./config/environment.js).

Default: null

appConfigSettings

Object

Component settings object from application configuration (part of JSON from ./config/environment.js). Part of appConfig related to appConfigSettingsPath.

Default: null

appConfigSettingsPath

String

Path to component's settings in application configuration (JSON from ./config/environment.js).

Default: 'APP.components.flexberryMenu'

callItemsOnClickCallbacks

Boolean

Flag: indicates whether to call 'items.[].onClick' callbacks or not.

Default: true

classNames

Array

Array CSS class names. More info.

collapseMenuOnItemClick

Boolean

Flag: indicates whether to collapse menu when clicking menuitem or not.

Default: true

componentName

String

Unique name of the component. TODO: use guidFor from 'ember-metal/utils'

currentController

Controller

Current controller.

Default: null

dynamicProperties

Object

Component dynamic properties ({ componentPropertyName: value }). Used when component renders dynamically with ember {{component}} helper: {{component 'my-component' value=value dynamicProperties=myConponentProperties}}. In the end of component initialization its properties values will be replaced with values from this object.

Default: null

items

Array

Menu items.

Default: null

onlyClickHandler

Boolean

Indicates than only click handler needed.

Default: false

readonly

Boolean

Flag: indicates whether component is readonly.

Default: false

readonlyAttr

String | Undefined

Readonly HTML attribute following to the readonly query param. According to the W3C standard, returns 'readonly' if readonly is true and undefined otherwise.

relatedModel

DS.Model

Model to which current component's value is related.

Default: null

required

Boolean

Flag: indicates whether component is required.

Default: false

settings

Object

Settings for the dropdown, see Semantic UI API for more info.