APIs

Show:

Lookup component for Semantic UI.

Item Index

Methods

_autofillByLimitObserverFunction

() private

Function for autofillByLimit observer.

_buildDisplayValue

() String private

Builds display text by selected model.

Returns:

_conjuctPredicates

(
  • limitPredicate
  • autocompletePredicate
  • lookupAdditionalLimitFunction
)
BasePredicate

Concatenates predicates.

Parameters:

  • limitPredicate BasePredicate

    The first predicate to concatenate.

  • autocompletePredicate BasePredicate

    The second predicate to concatenate.

  • lookupAdditionalLimitFunction Function

    Function return BasePredicate to concatenate.

Returns:

BasePredicate:

Concatenation of two predicates.

_createQueryBuilder

(
  • store
  • modelName
  • projection
  • order
)
Builder

Creates an instance of the Builder class with selection and sorting specified in the component parameters.

Parameters:

Returns:

Builder:

_dropdownObserver

() private

Handles changes in dropdown.

_dropdownRerenderObserverFunction

() private

Rerender dropdown when needed.

_getAutocomplitePredicate

(
  • settingsUrlDataQuery
)
Predicate private

Build predicate with settingsUrlDataQuery.

Parameters:

Returns:

Predicate:

_languageReinit

() private

Handles changing current locale. It reinits autocomplete or dropdown mode (depending on flag) in order to localize messages.

_onAutocomplete

() private

Initialize component with autocomplete mode.

_onAutofillByLimit

() private

Handles changing properties affecting the sample.

_onDropdown

() private

Initialize component with dropdown mode.

_setModalIsHidden

() private

Set the value for the property modalIsShow.

_setModalIsStartToShow

() private

Set the value for the property modalIsStartToShow.

_setModalIsVisible

() private

Set the value for the property modalIsShow & modalIsStartToShow.

_valueObserver

() private

Additional observer of value and relatedModel.relationName change, updates displayValue.

actions.choose

(
  • chooseData
)

Open window for select value.

Parameters:

actions.onInputFocusOut

()

Clears the value when focus is lost.

actions.preview

()

Show window for select value.

actions.remove

(
  • removeData
)

Clear current value.

Parameters:

actions.updateLookupValue

(
  • updateData
)

Update relation value at model.

Parameters:

didDestroyElement

()

It seems to me a mistake here, it should be willDestroyElement.

WRANING!

didInsertElement

()

Called when the element of the view has been inserted into the DOM or after the view was re-rendered. More info.

didRender

()

Called after a component has been rendered, both on initial render and in subsequent rerenders. More info.

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

onShowHide

()

Properties

_autofillByLimitObserver

Unknown

Observer on 'autofillByLimit'.

_cachedAutocompleteValue

Boolean private

This property is used in order to cache last value of flag autocomplete in order to let init this mode afrer re-render only once if flag was enabled.

_cachedDropdownValue

Boolean private

This property is used in order to cache last value of flag dropdown in order to let init this mode afrer re-render only once if flag was enabled.

_cachedDropdownValues

Array private

This property is used in order to cache loaded for dropdown mode values. Values are kept as array with master id as key and master object as value. This property is initialized after request to server got dropdown values. This cache is important because semantic ui dropdown component lets use only text values, while for lookup it is necessary to get object values.

_dropdownRefreshFlag

Boolean private

Flag for rerendering dropdown.

_hasBlockSetter

Unknown private

Triggered by the component template if the component has a block form definition.

_lastAutocompleteValue

String private

This property is used in order to cache last value of autocomplete input.

_lookupWindowCustomPropertiesData

Object private

This computed property forms a set of properties to send to lookup window. Closure action lookupWindowCustomProperties is called here if defined, otherwise undefined is returned.

Example:

// app/controllers/post.js
                    import EditFormController from './edit-form';
                    export default EditFormController.extend({
                      actions: {
                        lookupWindowCustomProperties({ relationName, projection }) {
                          if (relationName === 'author' && projection === 'UserL') {
                            return {
                              filterButton: true,
                              filterByAnyWord: true,
                              enableFilters: true,
                              refreshButton: true,
                              perPage: 25,
                            };
                          }
                        },
                      },
                    });
                    
<!-- app/templates/post.hbs -->
                    {{flexberry-lookup
                      componentName="AuthorLookup"
                      choose=(action "showLookupDialog")
                      remove=(action "removeLookupValue")
                      value=model.author
                      projection="UserL"
                      relationName="author"
                      displayAttributeName="name"
                      title="Author"
                      placeholder="Not select"
                      chooseText="Select"
                      removeText="Clear"
                      lookupWindowCustomProperties=(action "getLookupFolvProperties")
                    }}
                    

_modalDialogSettings

Unknown private

Computed property for modalDialogSettings property.

_pageInResultsForAutocomplete

Number private

Default: 1

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.flexberryLookup'

autocomplete

Boolean

Flag to show that lookup is in autocomplete mode.

Default: false

autocompleteClass

String

Classes by property of autocomplete.

autocompleteDirection

String

Direction of list for autocomplete values. Availible values: 'upward', 'downward', 'auto'.

Default: downward

autocompleteOrder

String

Name of the attribute of the model to display for the user for hidden attribute by master. Is required for autocomplete and dropdown modes.

Default: null

autocompletePersistValue

Boolean

Flag for remove autocomplete value if it's not in the results (remove when false).

Default: false

autocompletePersistValueCache

String

Stores autocomplete value, when autocompletePersistValue=true and lookup value clearing.

Default: undefined

autocompleteProjection

String

Projection name for autocomplete query.

Default: undefined

autofillByLimit

Boolean

Flag to fill value by limitPredicate.

Default: false

chooseButtonClass

String

CSS classes for choose button.

chooseData

Object

Object with lookup properties to send on choose action.

chooseText

String

Text on button opening a modal window.

Default: '<i class="change icon"></i>'

classNameBindings

Array

A list of properties of the view to apply as class names. More info.

classNames

Array

Standard CSS class names to apply to the view's outer element. More info.

componentName

String

Used to identify lookup on the page.

controllerForPreview

String

The controller for viewing the selected object.

Default: undefined

currentController

Controller

Current controller.

Default: null

displayAttributeName

String

Name of the attribute of the model to display for the user. Is required for autocomplete and dropdown modes.

Default: null

displayAttributeType

String

Type of the attribute of the model to display for the user.

displayValue

String

Text that displayed for the user as representation of currently selected value. This property is binded to the view and can be changed by user (it won't be applied to model automatically).

dropdown

Boolean

Flag to show that lookup is in dropdown mode.

Default: false

dropdownClass

String

CSS classes for flexberry-lookup at dropdown mode.

dropdownIsSearch

Boolean

Flag to show that lookup has search or autocomplete in dropdown mode.

Default: false

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

folvComponentName

String

FOLV component name.

hierarchicalAttribute

String

Hierarchical attribute.

Default: undefined

inHierarchicalMode

Boolean

Indicates wheter lookup dilog's table in hierarchical mode.

Default: false

isActive

Boolean

Flag: indicates whether component is active or not. Used to highlight component before data loading operation will be started.

Default: false

isBlocked

Boolean

Flag: indicates whether component is in blocked state now.

lookupAdditionalLimitFunction

Function

Function of limit function for lookup in GroupEdit. It should not be function return BasePredicate.

Default: undefined

Example:

  lookupAdditionalLimitFunction = function (relationModel) {
                      return new StringPredicate('LookUpField').contains(relationModel.get('GroupEditField'));
                    };
                    

lookupEventsService

Service

Service that triggers lookup events.

lookupLimitPredicate

BasePredicate

Limit function on lookup. It should not be just a string, it has to be predicate function (otherwise an exception will be thrown).

Default: undefined

maxResults

Number

Maximum number of results to display on autocomplete or dropdown.

Default: 10

modalDialogSettings

Object

An object with options and settings for the modal dialog of the component.

The following options and settings are available:

modalIsBeforeToShow

Boolean

Flag: indicates whether a modal dialog will be shown soon.

Default: false

modalIsShow

Boolean

Flag indicating whether a modal dialog is open.

Default: false

modalIsStartToShow

Boolean

Flag indicating whether a modal dialog starts to show. Needs for add loading indicator for choose button.

Default: false

placeholder

String

Text to be displayed in field, if value not selected.

Default: t('components.flexberry-lookup.placeholder')

previewButtonClass

String

CSS classes for preview button.

previewFormProjection

String

Projection name preview form.

Default: undefined

previewFormRoute

String

The URL that will be used for viewing the selected object.

Default: undefined

previewOnSeparateRoute

Boolean

Flag to show the selected object in separate route.

Default: false

previewText

String

Text on button preview value.

Default: '<i class="eye icon"></i>'

projection

String

Projection name.

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

relationName

String

Relation name.

removeButtonClass

String

CSS classes for remove button.

removeData

Object

Object with lookup properties to send on remove action.

removeText

String

Text on button clear value.

TODD: Use 'flexberry-lookup.remove-button-text' from locale.

Default: '<i class="remove icon"></i>'

required

Boolean

Flag: indicates whether component is required.

Default: false

showPreviewButton

Boolean

Flag to show in lookup preview button.

Default: false

sizeClass

String deprecated

Defined in addon/components/flexberry-lookup.js:532

Deprecated: Use `modalDialogSettings.sizeClass`.

Sets the sizeClass property for the modal dialog of the component.

sorting

String

Specify direction for sorting by displayAttributeName. For autocomplete or dropdown mode only. Possible values: asc or desc.

Default: 'asc'

store

DS.Store

Current store. Used for loading data for autocomplete and for dropdown.

title

String

Title for modal window.

updateLookupAction

String

Action's name to update model's relation value.

Default: 'updateLookupValue'

usePaginationForAutocomplete

Boolean

If true, page switching buttons will be available in the results for autocomplete.

Default: false

userSettings

UserSettingsService

The user settings service.

useSidePageMode

Boolean

The value of the useSidePageMode property for the modal windows used by this component. It can be configured through the configuration file (config/environment.js).

Default: false

value

Object

Current selected instance of the model.