Skip to content

@serenity-is/corelib / MultipleImageUploadEditor

Class: MultipleImageUploadEditor<P>

Defined in: src/ui/editors/uploadeditors.tsx:644

An editor that uploads and displays multiple images.

Extends

Type Parameters

P

P extends ImageUploadEditorOptions = ImageUploadEditorOptions

Widget props type.

Constructors

Constructor

new MultipleImageUploadEditor<P>(props): MultipleImageUploadEditor<P>

Defined in: src/ui/editors/uploadeditors.tsx:651

Creates a multiple image upload editor.

Parameters

props

EditorProps<P>

Widget props.

Returns

MultipleImageUploadEditor<P>

Overrides

MultipleFileUploadEditor.constructor

Properties

domNode

readonly domNode: HTMLElement

Defined in: src/ui/widgets/widget.ts:24

The DOM node this widget is bound to.

Inherited from

MultipleFileUploadEditor.domNode


hiddenInput

protected hiddenInput: HTMLInputElement

Defined in: src/ui/editors/uploadeditors.tsx:383

Inherited from

MultipleFileUploadEditor.hiddenInput


idPrefix

readonly idPrefix: string

Defined in: src/ui/widgets/widget.ts:22

The id prefix used for this widget's child element ids.

Inherited from

MultipleFileUploadEditor.idPrefix


options

protected readonly options: WidgetProps<EditorProps<P>>

Defined in: src/ui/widgets/widget.ts:18

The widget's options/props.

Inherited from

MultipleFileUploadEditor.options


progress

protected progress: HTMLElement

Defined in: src/ui/editors/uploadeditors.tsx:382

Inherited from

MultipleFileUploadEditor.progress


uniqueName

readonly uniqueName: string

Defined in: src/ui/widgets/widget.ts:20

A unique name for this widget instance, used for event namespacing.

Inherited from

MultipleFileUploadEditor.uniqueName


[typeInfo]

static [typeInfo]: ClassTypeInfo<"Serenity.">

Defined in: src/ui/editors/uploadeditors.tsx:645

Overrides

MultipleFileUploadEditor.[typeInfo]


isComponent

readonly static isComponent: true = true

Defined in: src/ui/widgets/widget.ts:334

Inherited from

MultipleFileUploadEditor.isComponent

Accessors

element

Get Signature

get element(): Fluent

Defined in: src/ui/widgets/widget.ts:82

Returns a Fluent(this.domNode) object

Returns

Fluent

Inherited from

MultipleFileUploadEditor.element


jsonEncodeValue

Get Signature

get jsonEncodeValue(): boolean

Defined in: src/ui/editors/uploadeditors.tsx:626

Whether the value is JSON-encoded.

Returns

boolean

True when JSON-encoded.

Set Signature

set jsonEncodeValue(value): void

Defined in: src/ui/editors/uploadeditors.tsx:629

Sets whether the value is JSON-encoded.

Parameters
value

boolean

True to JSON-encode the value.

Returns

void

Inherited from

MultipleFileUploadEditor.jsonEncodeValue


props

Get Signature

get props(): WidgetProps<P>

Defined in: src/ui/widgets/widget.ts:307

Returns the widget's props/options.

Returns

WidgetProps<P>

Inherited from

MultipleFileUploadEditor.props


readOnly

Get Signature

get readOnly(): boolean

Defined in: src/ui/editors/editorwidget.ts:42

Returns whether the editor is read-only.

Returns

boolean

True when read-only.

Set Signature

set readOnly(value): void

Defined in: src/ui/editors/editorwidget.ts:48

Sets whether the editor is read-only.

Parameters
value

boolean

Returns

void

Inherited from

MultipleFileUploadEditor.readOnly


value

Get Signature

get value(): UploadedFile[]

Defined in: src/ui/editors/uploadeditors.tsx:562

Returns the current uploaded files.

Returns

UploadedFile[]

The uploaded files.

Set Signature

set value(v): void

Defined in: src/ui/editors/uploadeditors.tsx:580

Sets the uploaded files.

Parameters
v

UploadedFile[]

The uploaded files to set.

Returns

void

Inherited from

MultipleFileUploadEditor.value

Methods

addCssClass()

protected addCssClass(): void

Defined in: src/ui/widgets/widget.ts:89

Adds the widget's CSS class to its DOM node.

Returns

void

Inherited from

MultipleFileUploadEditor.addCssClass


addFileButtonText()

protected addFileButtonText(): string

Defined in: src/ui/editors/uploadeditors.tsx:449

Returns the text for the add-file button.

Returns

string

The button text.

Inherited from

MultipleFileUploadEditor.addFileButtonText


addValidationRule()

Call Signature

addValidationRule(rule, uniqueName?): void

Defined in: src/ui/widgets/widget.ts:142

Adds a validation rule to the widget's DOM node.

Parameters
rule

(input) => string

The validation rule function, or a unique name when the two-argument overload is used.

uniqueName?

string

A unique name for the rule, or the rule function when the two-argument overload is used.

Returns

void

Inherited from

MultipleFileUploadEditor.addValidationRule

Call Signature

addValidationRule(uniqueName, rule): void

Defined in: src/ui/widgets/widget.ts:143

Adds a validation rule to the widget's DOM node.

Parameters
uniqueName

string

A unique name for the rule, or the rule function when the two-argument overload is used.

rule

(input) => string

The validation rule function, or a unique name when the two-argument overload is used.

Returns

void

Inherited from

MultipleFileUploadEditor.addValidationRule


afterRender()

protected afterRender(callback): void

Defined in: src/ui/widgets/widget.ts:228

Queues a callback to run after the widget's contents are rendered.

Parameters

callback

() => void

The callback to run after rendering.

Returns

void

Inherited from

MultipleFileUploadEditor.afterRender


byId()

protected byId<TElement>(id): Fluent<TElement>

Defined in: src/ui/widgets/widget.ts:154

Finds a child element by its prefix-relative id.

Type Parameters

TElement

TElement extends HTMLElement = HTMLElement

Parameters

id

string

The id relative to the widget's id prefix.

Returns

Fluent<TElement>

A Fluent wrapper for the matching element.

Inherited from

MultipleFileUploadEditor.byId


change()

change(handler): void

Defined in: src/ui/widgets/widget.ts:179

Registers a change handler on the widget's DOM node.

Parameters

handler

(e) => void

The change event handler.

Returns

void

Inherited from

MultipleFileUploadEditor.change


changeSelect2()

changeSelect2(handler): void

Defined in: src/ui/widgets/widget.ts:188

Registers a change handler that ignores changes originating from combobox setting values.

Parameters

handler

(e) => void

The change event handler.

Returns

void

Inherited from

MultipleFileUploadEditor.changeSelect2


deferRender()

protected deferRender(): boolean

Defined in: src/ui/widgets/widget.ts:98

Determines whether rendering should be deferred until init is called.

Returns

boolean

True to defer rendering.

Inherited from

MultipleFileUploadEditor.deferRender


destroy()

destroy(): void

Defined in: src/ui/widgets/widget.ts:61

Destroys the widget, removing its association with the DOM node, its CSS classes and its event handlers.

Returns

void

Inherited from

MultipleFileUploadEditor.destroy


findById()

protected findById<TElement>(id): TElement

Defined in: src/ui/widgets/widget.ts:163

Finds a child element by its prefix-relative id.

Type Parameters

TElement

TElement extends HTMLElement = HTMLElement

Parameters

id

string

The id relative to the widget's id prefix.

Returns

TElement

The matching element, or null if not found.

Inherited from

MultipleFileUploadEditor.findById


get_readOnly()

get_readOnly(): boolean

Defined in: src/ui/editors/uploadeditors.tsx:502

Returns whether the editor is read-only.

Returns

boolean

True when read-only.

Inherited from

MultipleFileUploadEditor.get_readOnly


get_required()

get_required(): boolean

Defined in: src/ui/editors/uploadeditors.tsx:536

Returns whether the field is required.

Returns

boolean

True when required.

Inherited from

MultipleFileUploadEditor.get_required


get_value()

get_value(): UploadedFile[]

Defined in: src/ui/editors/uploadeditors.tsx:552

Returns the current uploaded files.

Returns

UploadedFile[]

The uploaded files.

Inherited from

MultipleFileUploadEditor.get_value


getCssClass()

protected getCssClass(): string

Defined in: src/ui/widgets/widget.ts:106

Returns the CSS class(es) applied to the widget's DOM node.

Returns

string

The space-separated CSS class string.

Inherited from

MultipleFileUploadEditor.getCssClass


getCustomAttribute()

protected getCustomAttribute<TAttr>(attrType, inherit): TAttr

Defined in: src/ui/widgets/widget.ts:220

Returns a custom attribute applied to the widget's type.

Type Parameters

TAttr

TAttr extends CustomAttribute

Parameters

attrType

(...args) => TAttr

The attribute type to look up.

inherit

boolean = true

Whether to search inherited types; defaults to true.

Returns

TAttr

The matching attribute, or null.

Inherited from

MultipleFileUploadEditor.getCustomAttribute


getDefaultAllowNonImage()

protected getDefaultAllowNonImage(): boolean

Defined in: src/ui/editors/uploadeditors.tsx:664

Whether non-image files are allowed.

Returns

boolean

False for multiple image editors.

Overrides

MultipleFileUploadEditor.getDefaultAllowNonImage


getEditValue()

getEditValue(property, target): void

Defined in: src/ui/editors/uploadeditors.tsx:589

Gets the edit value into a target object.

Parameters

property

PropertyItem

The property item.

target

any

The target object.

Returns

void

Inherited from

MultipleFileUploadEditor.getEditValue


getGridField()

getGridField(): Fluent

Defined in: src/ui/widgets/widget.ts:171

Returns the closest .field element containing the widget's DOM node.

Returns

Fluent

A Fluent wrapper for the grid field.

Inherited from

MultipleFileUploadEditor.getGridField


getToolButtons()

protected getToolButtons(): ToolButton[]

Defined in: src/ui/editors/uploadeditors.tsx:457

Returns the toolbar buttons for the editor.

Returns

ToolButton[]

Tool button definitions.

Inherited from

MultipleFileUploadEditor.getToolButtons


getUploadInputOptions()

protected getUploadInputOptions(): UploadInputOptions

Defined in: src/ui/editors/uploadeditors.tsx:419

Returns the upload input options.

Returns

UploadInputOptions

Upload input options.

Inherited from

MultipleFileUploadEditor.getUploadInputOptions


init()

init(): this

Defined in: src/ui/widgets/widget.ts:243

Initializes the widget, rendering its contents if rendering was deferred.

Returns

this

This widget instance.

Inherited from

MultipleFileUploadEditor.init


internalRenderContents()

internalRenderContents(): void

Defined in: src/ui/widgets/widget.ts:266

Renders the widget's contents and runs any queued after-render callbacks.

Returns

void

Inherited from

MultipleFileUploadEditor.internalRenderContents


legacyTemplateRender()

protected legacyTemplateRender(): boolean

Defined in: src/ui/widgets/widget.ts:291

Renders the widget from a legacy getTemplate string, if defined.

Returns

boolean

True if a legacy template was rendered.

Inherited from

MultipleFileUploadEditor.legacyTemplateRender


populate()

protected populate(): void

Defined in: src/ui/editors/uploadeditors.tsx:470

Populates the file symbols from the current entities.

Returns

void

Inherited from

MultipleFileUploadEditor.populate


render()

render(): any

Defined in: src/ui/widgets/widget.ts:253

Returns the main element for this widget or the document fragment. As widgets may get their elements from props unlike regular JSX widgets, this method should not be overridden. Override renderContents() instead.

Returns

any

Inherited from

MultipleFileUploadEditor.render


renderContents()

protected renderContents(): any

Defined in: src/ui/widgets/widget.ts:281

Renders the widget's contents. Override this to provide custom content.

Returns

any

The rendered contents.

Inherited from

MultipleFileUploadEditor.renderContents


set_readOnly()

set_readOnly(value): void

Defined in: src/ui/editors/uploadeditors.tsx:510

Sets whether the editor is read-only.

Parameters

value

boolean

True to enable read-only mode.

Returns

void

Inherited from

MultipleFileUploadEditor.set_readOnly


set_required()

set_required(value): void

Defined in: src/ui/editors/uploadeditors.tsx:544

Sets whether the field is required.

Parameters

value

boolean

True when required.

Returns

void

Inherited from

MultipleFileUploadEditor.set_required


set_value()

set_value(value): void

Defined in: src/ui/editors/uploadeditors.tsx:570

Sets the uploaded files.

Parameters

value

UploadedFile[]

The uploaded files to set.

Returns

void

Inherited from

MultipleFileUploadEditor.set_value


setEditValue()

setEditValue(source, property): void

Defined in: src/ui/editors/uploadeditors.tsx:603

Sets the edit value from a source object.

Parameters

source

any

The source object.

property

PropertyItem

The property item.

Returns

void

Inherited from

MultipleFileUploadEditor.setEditValue


syncOrAsyncThen()

protected syncOrAsyncThen<T>(syncMethod, asyncMethod, then): void

Defined in: src/ui/widgets/widget.ts:318

Runs a method synchronously or asynchronously depending on the widget's useAsync flag, then invokes a continuation.

Type Parameters

T

T

Parameters

syncMethod

() => T

The synchronous method to run.

asyncMethod

() => PromiseLike<T>

The asynchronous method to run.

then

(v) => void

The continuation invoked with the result.

Returns

void

Inherited from

MultipleFileUploadEditor.syncOrAsyncThen


updateInterface()

protected updateInterface(): void

Defined in: src/ui/editors/uploadeditors.tsx:492

Updates the interface to reflect the current state.

Returns

void

Inherited from

MultipleFileUploadEditor.updateInterface


useIdPrefix()

protected useIdPrefix(): IdPrefixType

Defined in: src/ui/widgets/widget.ts:329

Returns an id prefix helper for resolving child element ids.

Returns

IdPrefixType

An IdPrefixType proxy for this widget's id prefix.

Inherited from

MultipleFileUploadEditor.useIdPrefix


create()

static create<TWidget, P>(params): TWidget

Defined in: src/ui/widgets/widget.ts:202

Creates a widget instance from the given params, appending its element to the container and invoking the init/init callbacks.

Type Parameters

TWidget

TWidget extends Widget<P>

P

P

Parameters

params

CreateWidgetParams<TWidget, P>

The widget creation params.

Returns

TWidget

The created widget instance.

Inherited from

MultipleFileUploadEditor.create


createDefaultElement()

static createDefaultElement(): HTMLElement

Defined in: src/ui/widgets/widget.ts:75

Creates the default DOM element for a widget.

Returns

HTMLElement

A new div element.

Inherited from

MultipleFileUploadEditor.createDefaultElement


getWidgetName()

static getWidgetName(type): string

Defined in: src/ui/widgets/widget.ts:131

Returns the widget name for a type, used for association and unique names.

Parameters

type

Function

The widget type.

Returns

string

The widget name.

Inherited from

MultipleFileUploadEditor.getWidgetName


registerClass()

protected static registerClass<TypeName>(typeName, intfAndAttr?): ClassTypeInfo<TypeName>

Defined in: src/ui/widgets/widget.ts:342

Registers this type as a class with the given type name.

Type Parameters

TypeName

TypeName

Parameters

typeName

StringLiteral<TypeName>

The type name to register.

intfAndAttr?

(InterfaceType | AttributeSpecifier)[]

Optional interfaces and attributes.

Returns

ClassTypeInfo<TypeName>

The class type info.

Inherited from

MultipleFileUploadEditor.registerClass


registerEditor()

protected static registerEditor<TypeName>(typeName, intfAndAttr?): EditorTypeInfo<TypeName>

Defined in: src/ui/widgets/widget.ts:357

Registers this type as an editor with the given type name.

Type Parameters

TypeName

TypeName

Parameters

typeName

StringLiteral<TypeName>

The type name to register.

intfAndAttr?

(InterfaceType | AttributeSpecifier)[]

Optional interfaces and attributes.

Returns

EditorTypeInfo<TypeName>

The editor type info.

Inherited from

MultipleFileUploadEditor.registerEditor