APIs

Show:

Flexberry colorpicker component based on jquery-minicolors plugin (see http://labs.abeautifulsite.net/jquery-minicolors).

Usage: templates/my-form.hbs

{{flexberry-colorpicker
  value=model.color
  change=(action "onModelColorChange")
}}

controllers/my-form.js

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

    // Log original jQuery 'change' event object.
    console.log(e.originalEvent);
  }
}

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

{{flexberry-colorpicker
  value=model.color
  change=(action "onColorpickerChange" "model.color")
}}

controllers/my-form.js

import Controller from '@ember/controller';
import FlexberryColorpickerActionsHandlerMixin from 'ember-flexberry/mixins/flexberry-colorpicker-actions-handler';

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

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 FlexberryColorpicker/sendingActions.change:method action.

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 color 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']

classNames

String[]

Component's wrapping

CSS-classes names.

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


                    

Default: ['flexberry-colorpicker']

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-colorpicker').

  • wrapper String

    Component's wrapping

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

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).