FlexberryLookup Class
addon/components/flexberry-lookup.js:25
Lookup component for Semantic UI.
Item Index
Methods
- _autofillByLimitObserverFunction
- _buildDisplayValue
- _conjuctPredicates
- _createQueryBuilder
- _dropdownObserver
- _dropdownRerenderObserverFunction
- _getAutocomplitePredicate
- _languageReinit
- _onAutocomplete
- _onAutofillByLimit
- _onDropdown
- _setModalIsHidden
- _setModalIsStartToShow
- _setModalIsVisible
- _valueObserver
- actions.choose
- actions.onInputFocusOut
- actions.preview
- actions.remove
- actions.updateLookupValue
- didDestroyElement
- didInsertElement
- didRender
- getTargetObjectByCondition.
- initProperty
- onShowHide
Properties
- _autofillByLimitObserver
- _cachedAutocompleteValue
- _cachedDropdownValue
- _cachedDropdownValues
- _dropdownRefreshFlag
- _hasBlockSetter
- _lastAutocompleteValue
- _lookupWindowCustomPropertiesData
- _modalDialogSettings
- _pageInResultsForAutocomplete
- appConfig
- appConfigSettings
- appConfigSettingsPath
- autocomplete
- autocompleteClass
- autocompleteDirection
- autocompleteOrder
- autocompletePersistValue
- autocompletePersistValueCache
- autocompleteProjection
- autofillByLimit
- chooseButtonClass
- chooseData
- chooseText
- classNameBindings
- classNames
- componentName
- controllerForPreview
- currentController
- displayAttributeName
- displayAttributeType
- displayValue
- dropdown
- dropdownClass
- dropdownIsSearch
- dynamicProperties
- folvComponentName
- hierarchicalAttribute
- inHierarchicalMode
- isActive
- isBlocked
- lookupAdditionalLimitFunction
- lookupEventsService
- lookupLimitPredicate
- maxResults
- modalDialogSettings
- modalIsBeforeToShow
- modalIsShow
- modalIsStartToShow
- placeholder
- previewButtonClass
- previewFormProjection
- previewFormRoute
- previewOnSeparateRoute
- previewText
- projection
- readonly
- readonlyAttr
- relatedModel
- relationName
- removeButtonClass
- removeData
- removeText
- required
- showPreviewButton
- sizeClass deprecated
- sorting
- store
- title
- updateLookupAction
- usePaginationForAutocomplete
- userSettings
- useSidePageMode
- value
Methods
_autofillByLimitObserverFunction
()
private
Function for autofillByLimit observer.
_conjuctPredicates
-
limitPredicate
-
autocompletePredicate
-
lookupAdditionalLimitFunction
Concatenates predicates.
Parameters:
-
limitPredicate
BasePredicateThe first predicate to concatenate.
-
autocompletePredicate
BasePredicateThe second predicate to concatenate.
-
lookupAdditionalLimitFunction
FunctionFunction return BasePredicate to concatenate.
Returns:
Concatenation of two predicates.
_createQueryBuilder
-
store
-
modelName
-
projection
-
order
Creates an instance of the Builder class with selection and sorting specified in the component parameters.
Returns:
_dropdownObserver
()
private
Handles changes in dropdown.
_dropdownRerenderObserverFunction
()
private
Rerender dropdown when needed.
_getAutocomplitePredicate
-
settingsUrlDataQuery
Build predicate with settingsUrlDataQuery.
Parameters:
-
settingsUrlDataQuery
String
Returns:
_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.onInputFocusOut
()
Clears the value when focus is lost.
actions.preview
()
Show window for select value.
actions.updateLookupValue
-
updateData
Update relation value at model.
Parameters:
-
updateData
Object
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
Returns that 'targetObject' (from 'targetObject's hierarchy) which satisfies a given condition.
let controller = this.getTargetObjectByCondition((targetObject) => {
return targetObject instanceof Controller;
});
Parameters:
-
condition
FunctionCallback-function, which will be called for each 'targetObject' in 'targetObject's hierarchy, until callback return true for one of them.
Returns:
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' });
}
});
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.
_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")
}}
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'
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
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
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).
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
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
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
modalDialogSettings
Object
An object with options and settings for the modal dialog of the component.
The following options and settings are available:
sizeClass
, not set by default.useOkButton
, defaultfalse
.useCloseButton
, defaultfalse
.settings
, not set by default.
modalIsBeforeToShow
Boolean
Flag: indicates whether a modal dialog will be shown soon.
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')
previewFormRoute
String
The URL that will be used for viewing the selected object.
Default: undefined
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.
removeText
String
Text on button clear value.
TODD: Use 'flexberry-lookup.remove-button-text' from locale.
Default: '<i class="remove icon"></i>'
sorting
String
Specify direction for sorting by displayAttributeName
.
For autocomplete
or dropdown
mode only.
Possible values: asc
or desc
.
Default: 'asc'
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
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