APIs

Show:

Flexberry checkbox component with Semantic UI checkbox style and "Data Down Actions UP (DDAU)" pattern one way binding. Component doesn't mutate passed value by its own, it only invokes 'change' action, which signalizes to the route, controller, or another component, that passed value should be mutated.

Usage with manual 'change' action handling: templates/my-form.hbs

{{flexberry-ddau-checkbox
  value=model.flag
  change=(action "onModelFlagChange")
}}

controllers/my-form.js

actions: {
  onModelFlagChange(e) {
    // Set new value to model's 'flag' property.
    this.set('model.flag', e.newValue);

    // Log jQuery 'change' event object triggered after checkbox input was clicked.
    console.log(e.originalEvent);
  }
}

Usage with {{#crossLink "FlexberryDdauCheckboxActionsHandlerMixin"}}flexberry-ddau-checkbox-actions-handler mixin{{/crossLink}}:

{{flexberry-ddau-checkbox
  value=model.flag
  change=(action "onCheckboxChange" "model.flag")
}}

controllers/my-form.js

import Controller from '@ember/controller';
import FlexberryDdauCheckboxActionsHandlerMixin from 'ember-flexberry/mixins/flexberry-ddau-checkbox-actions-handler';

export default Controller.extend(FlexberryDdauCheckboxActionsHandlerMixin, {
});

Methods

_actionHandlerIsDefined

(
  • options
)
Boolean private
Returns flag, indicating whether action handler is defined, for action with the specified name, or not.

Parameters:

  • options Object
    Method options
    • actionName String

      Name of component's action for which handler's existence this method should check.

Returns:

Boolean: Flag, indicating whether action handler is defined, for action with the specified name, or not.

_addDynamicProperty

(
  • propertyName
)
private
Adds component's new dynamic property. Gets related value from {{#crossLink "DynamicPropertiesMixin:dynamicProperties:property"}}dynamic properties{{/crossLink}}, and assignes it to related component's property, then attaches observer.

Parameters:

  • propertyName String
    Name of dynamic property that must be added.

_dynamicPropertiesDidChange

() private
Observes & handles any changes in {{#crossLink "DynamicPropertiesMixin/dynamicProperties:property"}}'dynamicProperties'{{/crossLink}}, assigns actual values to a component's related properties (including initialization moment).

_removeDynamicProperties

() private
Removes component's all previously added dynamic properties. Removes related component's properties & observers.

_removeDynamicProperty

(
  • propertyName
)
private
Removes component's previously added dynamic property. Removes related component's property & observer.

Parameters:

  • propertyName String
    Name of dynamic property that must be removed.

actions.change

(
  • e
)

Handles inner input's bubbled 'change' action. Invokes component's FlexberryDdauCheckbox/sendingActions.change:method action.

Parameters:

actions.sendButtonAction

(
  • action
)
public

Call action of a clicked button.

Parameters:

attachEventHandler

(
  • options
)
Attaches event handler for a given event-target. Also remembers attached handlers and related event-targets for clean up logic which will be executed before component will be destroyed, so use this method instead of explicit calls to [jQuery.on method](http://api.jquery.com/on/) to avoid possible memory leaks.

Parameters:

closeModalDialog

()
Close current modal window if it exists.

createdModalDialog

(
  • modalDialog
)
Handles create modal window action. It saves created window to have opportunity to close it later.

Parameters:

  • modalDialog JQuery
    Created modal window.

detachAllEventHandlers

()
Detaches all event-handlers remembered in metadata when event-handlers were attached through {{#crossLink "DomActionsMixin/attachEventHandler:method"}}'attachEventHandler' method {{/crossLink}}.

detachEventHandler

(
  • options
)
Detaches event-handler from a given event-target. Also cleans up metadata remembered when event-handler was attached through {{#crossLink "DomActionsMixin/attachEventHandler:method"}}'attachEventHandler' method {{/crossLink}}.

Parameters:

send

(
  • actionName
  • args
)
Any
Overridden ['send' method](https://github.com/emberjs/ember.js/blob/v2.7.0/packages/ember-runtime/lib/mixins/action_handler.js#L145). Method logic still the same, but method now returns value returned by the action handler. `

Parameters:

  • actionName String
    Name of the action that must be triggered.
  • args
    Arguments that must be passed to action.

Returns:

Any: Returns value returned by action handler.

sendingActions.change

(
  • e
)

Component's action invoking when checkbox was clicked and it's 'checked' state changed.

Parameters:

Properties

_availableDomEvents

Object private
Dictionary containing names of DOM-events available for component's wrapping DOM-element and component's actions names related to them.

_componentWrapperIsAvailable

Boolean private
Flag: indicates whether component's wrapper DOM-element is available for select now.

_dynamicActions

Object private
Component's dynamic actions from {{#crossLink "DynamicActionsMixin:dynamicActions:property"}}'dynamicActions' property{{/crossLink}}, mapped from array into flat [JSON-object](http://www.json.org/).

_dynamicPropertiesMetadata

Object[] private
Array with objects containing names of already assigned {{#crossLink "DynamicPropertiesMixin:dynamicProperties:property"}}dynamic properties{{/crossLink}} and observer handlers related to them. Each object in array has following structure: { propertyName: '...', propertyObserverHandler: function() { ... } }.

Default: null

_eventsMetadata

Object[] private
Array with objects containing selected event targets & handlers attached to them. Each object in array has following structure: { eventTarget: ..., attachedEventHandlers: { click: [function() {}, function() {}, ...], dblclick: [function() {}, function() {}, ...], ... } }.

Default: null

_openedModalDialog

JQuery
Current opened modal window.

Default: undefined

_requiredActions

String[]

Component's required actions names. For actions enumerated in this array an assertion exceptions will be thrown, if actions handlers are not defined for them.

Default: ['change']

caption

String

Component's caption.

Default: null

classNameBindings

String[]

Components class names bindings.

Default: ['value:checked', 'readonly:read-only']

classNames

String[]

Component's wrapping

CSS-classes names.

Any other CSS-classes can be added through component's 'class' property.

{{flexberry-ddau-checkbox class="toggle" value=model.flag change=(action "onModelFlagChange")}}
                    

Default: ['flexberry-checkbox', 'ui', 'checkbox']

dynamicActions

DynamicActionObject[]
Component's dynamic actions. If component consumes it's inner structure as [JSON-object](http://www.json.org/) or [Ember-object](https://emberjs.com/api/ember/release/classes/EmberObject) and there is no way to attach action handlers explicitly in hbs-markup, then you can define {{#crossLink "DynamicActionObject"}}dynamic actions{{/crossLink}} somewhere in code & pass defined array into this component's property.

Default: null

dynamicProperties

Object
Object containing dynamic properties that must be assigned to component using {{#crossLink "DynamicPropertiesMixin"}}dynamic-properties mixin{{/crossLink}}.

Default: null

flexberryClassNames

Object static

Component's CSS-classes names. JSON-object containing string constants with CSS-classes names related to component's .hbs markup elements.

Sub-properties:

  • prefix String

    Component's CSS-class names prefix ('flexberry-button').

  • wrapper String

    Component's wrapping

    CSS-class name ('flexberry-button').

flexberryClassNames

Object static

Component's CSS-classes names. JSON-object containing string constants with CSS-classes names related to component's .hbs markup elements.

Sub-properties:

  • prefix String

    Component's CSS-class names prefix ('flexberry-checkbox').

  • wrapper String

    Component's wrapping

    CSS-class name ('flexberry-checkbox').

  • checkboxInput String

    Component's inner CSS-class name ('flexberry-checkbox-input').

  • checkboxCaption String

    Component's inner

isTagless

Boolean
Flag: indicates whether component is tagless or not (has empty [tagName](https://emberjs.com/api/ember/release/classes/Component#property_tagName) or not).

readonly

Boolean

Flag: indicates whether component is in readonly mode.

Default: false

value

Boolean

Component's value (if true, then checkbox is checked).

Default: false