FlexberrySimpledatetime Class
addon/components/flexberry-simpledatetime.js:13
Wrapper for input[type='date/datetime/datetime-local'] component. Please keep in mind that these input types are not supported in all browsers, see supported browsers.
Item Index
Methods
Properties
- _maxAsString
- _minAsString
- _valueAsDate
- _valueAsString
- altDateFormat
- altDateTimeFormat
- appConfig
- appConfigSettings
- appConfigSettingsPath
- calendarContext
- canClick
- classNames
- componentName
- currentController
- currentTypeSupported
- dateFormat
- dateMask
- dateTimeFormat
- dateTimeMask
- defaultHour
- defaultMinute
- dynamicProperties
- eventNamespace
- locale
- max
- min
- openButton
- placeholder
- readonly
- readonlyAttr
- relatedModel
- removeButton
- required
- scrollClassNames
- type
- useOnlyFlatpickr
- validDateFormat
- validDateTimeFormat
- value
Methods
_convertDateToLocal
-
value
Converts date (without time) to local date.
Returns:
Object of Date.
_convertDateToString
-
value
Convert Date object to appropriate string value for input.
Parameters:
-
value
DateObject of Date.
Returns:
Date in string format.
_convertStringToDate
-
value
Converts string value of input to Date object.
Parameters:
-
value
StringDate in string format.
Returns:
Object of Date.
_flatpickrCreate
()
private
Create Flatpickr instance, and save it into _flatpickr
property.
_flatpickrDestroy
()
private
Destroy Flatpickr instance.
_validationDateTime
()
private
Validation date and time.
actions.open
()
Open flatpickr.
actions.remove
()
Clear current value.
click
()
private
Component click handler.
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' });
}
});
reinitFlatpickrObserver
()
Observer for reinit flatpickr (defaultHour, defaultMinute, and others, for dynamically updating because set() for this options doesn't update view).
willDestroyElement
()
Called when the element of the view is going to be destroyed. Override this function to do any teardown that requires an element, like removing event listeners. More info.
Properties
_maxAsString
String
private
Convert date in max
to appropriate input datatype.
For example, see here.
Default: null
_minAsString
String
private
Convert date in min
to appropriate input datatype.
For example, see here.
Default: null
_valueAsString
String
private
Convert date in value
to appropriate input datatype.
For example, see here.
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.flexberrySimpledatetime'
calendarContext
String
The selector to get the element (using jQuery
) for the appendTo
flatpickr option.
canClick
Bool
If true, then onClick calling flatpickr.open().
currentController
Controller
Current controller.
Default: null
dateFormat
String
A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below.
dateTimeFormat
String
A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below.
defaultHour
Integer
Default value of hour.
Default: 12
defaultMinute
Integer
Default value of minute.
Default: 0
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
openButton
Bool
If true, then flatpickr has open button.
placeholder
String
Text to be displayed in field, if field has not been filled.
Default: 't('components.flexberry-simpledatetime.placeholder')'
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.
removeButton
Bool
If true, then flatpickr has remove button.