APIs

Show:

Mobile version of flexberry-file component (with mobile-specific defaults).

Item Index

Methods

_dataURLtoFile

(
  • dataUrl
  • fileName
)
private
Method converts base64 string to File

Parameters:

  • dataUrl String
    Base64 string
  • fileName String
    Filename for saving

_isValidTypeFile

(
  • fileType
  • accept
)
private
Defines valid of file type.

Parameters:

  • fileType String
    file type as MIME TYPES.
  • accept String
    available MIME TYPES.

_onRelatedModelPreSave

(
  • e
)
private
Handles related model's 'preSave' event.

Parameters:

  • e Object
    Related model's 'preSave' event arguments.
    • promises Object[]

      Related model's 'preSave' operations promises array.

_previewOptionsDidChange

() private
Preview options change handler.

_subscribeOnRelatedModelPreSaveEvent

() private
Subscribes on related model's 'preSave' event.

_unsubscribeFromRelatedModelPresaveEvent

() private
Unsubscribes from related model's 'preSave' event.

_uploadDataDidChange

() private
Upload data change handler.

_valueDidChange

() private
Value change handler.

actions.addButtonClick

() public
Handles click on add button.

actions.downloadButtonClick

() public
Handles click on download button.

actions.onMenuItemClick

(
  • e
)
public

Handles click on menu item of selected file.

Parameters:

  • e Object

    Information about selected menu item.

    • [data] Object optional

      Data of selected menu item.

actions.removeButtonClick

() public
Handles click on remove button.

actions.uploadButtonClick

() public
Handles click on upload button.

actions.viewLoadedImage

() public
Handles click on selected image preview and sends action with data outside component in order to view selected image at modal window.

downloadFile

()
Downloads previously uploaded file.

getTargetObjectByCondition.

(
  • condition
)
Null | Component | Controller
Returns that 'targetObject' (from 'targetObject's hierarchy) which satisfies a given condition. `javascript 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. `javascript // ./config/environment.js. module.exports = function(environment) { var ENV = { APP: { components: { myComponent: { myComponentProperty: 'myComponentProperty config-defined default value', } } } }; return ENV; }; ` `javascript // /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).

removeFile

()
Removes selected file.

showDownloadErrorModalDialog

(
  • fileName
  • errorMessage
)
Shows errors if there were some during file download.

Parameters:

  • fileName String
    File name.
  • errorMessage String
    Message about error occurred during file download.

showErrorModalDialog

(
  • errorCaption
  • errorContent
)
String
Shows error modal dialog.

Parameters:

  • errorCaption String
    Error caption (window header caption).
  • errorContent String
    Error content (window body content).

Returns:

String: Error content.

showFileExtensionErrorModalDialog

(
  • fileName
)
String
Shows file extension errors if there were some.

Parameters:

  • fileName String
    Added file name.

Returns:

String: Error content.

showUploadErrorModalDialog

(
  • fileName
  • actualFileSize
  • maxFileSize
  • sizeUnit
)
String
Shows file size errors if there were some.

Parameters:

  • fileName String
    Added file name.
  • actualFileSize String
    Actual size of added file.
  • maxFileSize String
    Max file size allowed.
  • sizeUnit String
    Max file size unit.

Returns:

String: Error content.

uploadFile

()
Uploads selected file.

Properties

_addButtonIsEnabled

Boolean private
Flag: indicates whether add button is enabled now.

_addButtonIsVisible

Boolean private
Flag: indicates whether add button is visible now.

_canLoadPreview

Boolean
indicates whether preview img can be loaded when show.

Default: true

_downloadButtonIsEnabled

Boolean private
Flag: indicates whether download button is enabled now.

_downloadButtonIsVisible

Boolean private
Flag: indicates whether download button is visible now.

_errorModalDialog

JQueryObject private
Selected jQuery object, containing HTML of error modal dialog.

Default: null

_errorModalDialogCaption

String private
Caption to be displayed in error modal dialog. It will be displayed only if some error occurs.

Default: t('components.flexberry-file.error-dialog-caption')

_errorModalDialogContent

String private
Content to be displayed in error modal dialog. It will be displayed only if some error occurs.

Default: t('components.flexberry-file.error-dialog-content')

_errorPreviewCaption

String private
Caption to be displayed in loaded file table cell. It will be displayed only if preview can't be loaded.

Default: t('components.flexberry-file.error-preview-caption')

_fileInputId

String private
File input identifier.

_fileName

String private
File name. It is binded to component file name input, so every change to fileName will automatically change file name input value.

_fileSizeUnits

Object private
Available file size units with its captions.

_hasFile

Boolean private
Flag: indicates whether some file is added now or not.

_initialValue

String private
Copy of value created at initialization moment or after successful upload.

_isMobile

Boolean private

Flag: whether component is mobile or not. Used in base class for class names bindings.

Default: true

_jsonInitialValue

Object private
Deserialized copy of value created at initialization moment or after successful upload.

_jsonValue

Object private
Deserialized value of file component.

_menuItems

Object[] private

Items for component's menu.

_previewDownloadIsInProgress

Boolean private
Flag: indicates whether file preview download is in progress now.

Default: false

_previewImageAsBase64String

String private
Selected file content. It can be used as source for image tag in order to view preview.

Default: null

_removeButtonIsEnabled

Boolean private
Flag: indicates whether remove button is enabled now.

_removeButtonIsVisible

Boolean private
Flag: indicates whether remove button is visible now.

_selectedFile

Object private
Current file selected for upload.

_uploadButtonIsEnabled

Boolean private
Flag: indicates whether upload button is enabled now.

_uploadButtonIsVisible

Boolean private
Flag: indicates whether upload button is visible now.

_uploadData

Object private
Data from jQuery fileupload plugin (contains selected file).

Default: null

_uploadDataCopy

Object private
Copy of data from jQuery fileupload plugin (contains selected file).

Default: null

_uploadIsInProgress

Boolean private
Flag: indicates whether file upload is in progress now.

Default: false

accept

String
Available file extensions for upload. In MIME type format. See [the documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) for more details.

Default: undefined

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

base64FileExtension

String
Extension for base64 file. {base64FileName}.{base64FileExtension}

Default: null

base64FileName

String
Name for base64 file. {base64FileName}.{base64FileExtension}

Default: null

base64Value

String
External Base64 string

Default: null

buttonClass

String
CSS-classes names for component's add, remove, upload, download buttons. See [Semantic UI buttons classes](http://semantic-ui.com/elements/button.html).

Default: ''

Example:

`handlebars
                    
                    

classNameBindings

String[]

Components class names bindings.

Default: ['isMobile:mobile']

classNames

String[]
Component's wrapping
CSS-class names.

Default: ['flexberry-file']

componentName

String
Unique name of the component. TODO: use guidFor from 'ember-metal/utils'

currentController

Controller
Current controller.

Default: null

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

headers

Object
Headers to the file upload request.

Default: null

inputClass

String
Component's input additional CSS-class names. See [Semantic UI inputs classes](http://semantic-ui.com/elements/input.html).

Default: ''

Example:

`handlebars
                    
                    `

isDrag

Boolean
Flag: Is the drag-and-drop event currently proceed.

Default: false

isValidTypeFileCustom

Function
Function with custom check for type of uploaded file.

Default: null

maxUploadFileSize

Number
Maximum file size in bytes for uploading files. It should be greater then 0 and less or equal then APP.components.file.maxUploadFileSize from application config\environment. If null or undefined, then APP.components.file.maxUploadFileSize from application config\environment will be used.

maxUploadFileSizeUnit

String
Maximum file size unit. May be 'Bt' 'Kb' 'Mb' or 'Gb'.

Default: 'Bt'

openInNewWindowInsteadOfLoading

Boolean
Flag: download by clicking download or open file in new window.

Default: false

placeholder

String
Text to be displayed instead of file name, if file has not been selected.

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

previewSettings

Object
Settings for preview modal dialog.

Default: null

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

required

Boolean
Flag: indicates whether component is required.

Default: false

showDownloadButton

Boolean
Flag: indicates whether to show download button or not.

Default: true

showModalDialogOnUploadError

Boolean
Flag: indicates whether to show modal dialog on upload errors or not.

Default: false

showPreview

Boolean

Flag: indicates whether to show preview element for images or not.

Default: true

showUploadButton

Boolean
Flag: indicates whether to show upload button or not.

Default: false

uploadOnModelPreSave

Boolean
Flag: indicates whether to upload file on 'relatedModel' 'preSave' event.

Default: true

uploadUrl

String
File upload URL. If null or undefined, then APP.components.file.uploadUrl from application config\environment will be used.

value

String
Value of file component (contains serialized file metadata such as fileName, fileSize, etc.). It is binded to related model property, so every change to value will automatically change model property.

viewImageAction

String
Name of the action which will be send outside after click on selected image preview.

Default: 'flexberryFileViewImageAction'