Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Slots
JET elements can have up to two types of child content:
- Any child element with a
slotattribute will be moved into that named slot, e.g.<span slot='startIcon'>...</span>. All supported named slots are documented below. Child elements with unsupported named slots will be removed from the DOM. - Any child element lacking a
slotattribute will be moved to the default slot, also known as a regular child.
-
trigger
-
The
triggerslot is set on the custom content of the file picker.Example
Display an upload button instead of the default dropzone
<oj-file-picker class='oj-filepicker-custom'> <oj-button slot='trigger'> <span slot='startIcon' class='oj-fwk-icon oj-fwk-icon-arrowbox-n'></span> Upload </oj-button> </oj-file-picker>
Attributes
-
accept :Array.<string>|null
-
An array of strings of allowed MIME types or file extensions that can be uploaded. If not specified, accept all file types
Note: If accept is specified, files with empty string type will be rejected if no match found in the "accept" value.
- Default Value:
null
Names
Item Name Property acceptProperty change event acceptChangedProperty change listener attribute (must be of type function) on-accept-changedExamples
Initialize the file picker with the
acceptattribute specified:<oj-file-picker accept='image/*'></oj-file-picker>Get or set the
acceptproperty after initialization:// getter var acceptValue = myFilePicker.accept; // setter myFilePicker.accept = 'image/*'; -
select-on :string
-
The type of event to select the files.
- Default Value:
"auto"
Supported Values:
Name Type Description "auto"string either click or drag and drop to select the files "click"string click to select the files "clickAndDrop"string either click or drag and drop to select the files "drop"string drag and drop the files Names
Item Name Property selectOnProperty change event selectOnChangedProperty change listener attribute (must be of type function) on-select-on-changedExamples
Initialize the file picker with the
select-onattribute specified:<oj-file-picker select-on='click'></oj-file-picker>Get or set the
selectOnproperty after initialization:// getter var selectOnValue = myFilePicker.selectOn; // setter myFilePicker.selectOn = 'click'; -
selection-mode :string
-
Whether to allow single or multiple file selection.
- Default Value:
"multiple"
Supported Values:
Name Type Description "multiple"string multiple file selection "single"string single file selection Names
Item Name Property selectionModeProperty change event selectionModeChangedProperty change listener attribute (must be of type function) on-selection-mode-changedExamples
Initialize the file picker with the
selection-modeattribute specified:<oj-file-picker selection-mode='single'></oj-file-picker>Get or set the
selectionModeproperty after initialization:// getter var selectionModeValue = myFilePicker.selectionMode; // setter myFilePicker.selectionMode = 'single';
Events
-
ojSelect
-
Triggered after the files are selected
Properties:
All of the event payloads listed below can be found under
event.detail.Name Type Description filesFileList The files that were just selected. Examples
Specify an
ojSelectlistener via the DOM attribute:<oj-file-picker on-oj-select='[[listener]]'></oj-file-picker>Specify an
ojSelectlistener via the JavaScript property:myFilePicker.onOjSelect = listener;Add an
ojSelectlistener via theaddEventListenerAPI:myFilePicker.addEventListener('ojSelect', listener);
Methods
-
getProperty(property) → {any}
-
Retrieves a value for a property or a single subproperty for complex properties.
Parameters:
Name Type Description propertystring The property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
Example
Get a single subproperty of a complex property:
var subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2'); -
setProperties(properties) → {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesObject An object containing the property and value pairs to set. Returns:
- Type
- void
Example
Set a batch of properties:
myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"}); -
setProperty(property, value) → {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a [property]Changed event.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. Returns:
- Type
- void
Example
Set a single subproperty of a complex property:
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");