Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ProgressBox<TOptions, TProps, TChildren>

The ProgressBox class is a dialog that displays a progress indicator, a text and an optional Cancel button.

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • new ProgressBox(content?: string, title?: string, cancelReturnValue?: any): ProgressBox
  • Parameters

    • Optional content: string
    • Optional title: string
    • Optional cancelReturnValue: any

    Returns ProgressBox

Properties

Protected content

content: any

Protected defaultStyles

defaultStyles: ProgressBoxStyles

Protected optionalStyles

optionalStyles: ProgressBoxStyles

Protected options

options: TOptions

Readonly props

props: CompProps<TProps, TChildren>

Component properties passed to the constructor. This is normally used only by managed components and is usually undefined for independent coponents.

vn

Remembered virtual node object through which the component can request services. This is undefined in the component's costructor but will be defined before the call to the (optional) willMount method.

Accessors

buttonCount

  • get buttonCount(): number
  • Returns the number of buttons in the button bar

    Returns number

events

  • Events that can be fired by the Popup component

    Returns MultiEventSlot<IPopupEvents>

isMounted

  • get isMounted(): boolean
  • Determines whether the component is currently mounted. If a component has asynchronous functionality (e.g. fetching data from a server), component's code may be executed after it was alrady unmounted. This property allows the component to handle this situation.

    Returns boolean

isOpen

  • get isOpen(): boolean
  • Determines whether the popup is currently open.

    Returns boolean

isVisible

  • get isVisible(): boolean
  • set isVisible(v: boolean): void
  • Gets or sets the flag determining whether the popup is currently visible or hidden.

    Returns boolean

  • Gets or sets the flag determining whether the popup is currently visible or hidden.

    Parameters

    • v: boolean

    Returns void

returnValue

  • get returnValue(): any
  • Returns the value set by the close() method. If the popup is open, the value is undefined.

    Returns any

Methods

addButton

Protected callMeAfterUpdate

  • Schedules the given function to be called after all components scheduled to be updated in the Mimbl tick have already been updated.

    Parameters

    • func: ScheduledFuncType

      Function to be called

    • Optional funcThisArg: any

      Object that will be used as "this" value when the function is called. If this parameter is undefined, the component instance will be used (which allows scheduling regular unbound components' methods). This parameter will be ignored if the the function is already bound or is an arrow function.

    Returns void

Protected callMeBeforeUpdate

  • Schedules the given function to be called before any components scheduled to be updated in the Mimbl tick are updated.

    Parameters

    • func: ScheduledFuncType

      Function to be called

    • Optional funcThisArg: any

      Object that will be used as "this" value when the function is called. If this parameter is undefined, the component instance will be used (which allows scheduling regular unbound components' methods). This parameter will be ignored if the function is already bound or is an arrow function.

    Returns void

close

  • close(retVal?: any): void
  • Closes the popup and passes a value to be used as a return value. For the modal popups, this value will be the resolved value of the promise returned by the showModal() method. For modeless popups, this value will be available as the returnValue property.

    Parameters

    • Optional retVal: any

    Returns void

Protected getDefaultStyles

isModal

  • isModal(): boolean
  • Determines whether the dialog is currently open as modal.

    Returns boolean

isModeless

  • isModeless(): boolean
  • Determines whether the dialog is currently open as modeless.

    Returns boolean

moveTo

  • moveTo(newX: number, newY: number): void
  • Moves the dialog to the given coordinates. The coordinates are adjusted so that at least some part of the dialog at the top-left corner remains visible in order to the user to be able to continue moving it.

    Parameters

    • newX: number
    • newY: number

    Returns void

Protected onClose

  • onClose(retVal: any): void
  • This method is called when the popup is being closed. If derived classes override it they must call super.onClose().

    Parameters

    • retVal: any

    Returns void

Protected onOpen

  • onOpen(isModal: boolean): void
  • This method is called when the popup opens. If derived classes override it they must call super.onOpen().

    Parameters

    • isModal: boolean

    Returns void

open

  • open(): boolean
  • Displays the popup as a modeless dialog. The method will throw an exception if the popup is already open as a modal popup.

    Returns boolean

render

  • render(): any

renderBody

  • renderBody(): any
  • Returns any

renderButtons

  • renderButtons(): any

renderCaption

  • renderCaption(): any

setCaption

  • setCaption(captionContent: any): void
  • Adds a button to the button bar

    Parameters

    • captionContent: any

    Returns void

setContent

  • setContent(content: any): void
  • Replaces the current content of the popup with the given one.

    Parameters

    • content: any

    Returns void

showModal

  • showModal(): Promise<any>
  • Displays the popup as a modeless dialog and returns a promise that is resolved when the popup is closed. The resolved value of the promise is the value passed to the close() method. The method will return a rejected promise if the popup is already open.

    Returns Promise<any>

showModalWithDelay

  • showModalWithDelay(delayMilliseconds: number): void
  • Initiates displaying a progress box but doesn't really create it until the given timeout expires. If the close method is called before the timeout expires, the popup isn't created at all. This can be useful if you want the progress to reflect multiple operations but don't show it if the operations finish quickly enough, for example:

    let progress = new Progress();
    progress.showModalWithDelay( 1000);
    progress.setContent( "First operation is in progress...")
    performFirstOperation();
    progress.setContent( "Second operation is in progress...")
    performSecondOperation();
    progress.close();

    Parameters

    • delayMilliseconds: number

    Returns void

startMove

  • startMove(clientX: number, clientY: number): void
  • Starts monitoring mouse movements and moves the popup with the mouse. This method is intented to be called from a mousedown event handled either by a derived class or by the popup caller.

    Parameters

    • clientX: number
    • clientY: number

    Returns void

stopMove

  • stopMove(): void
  • Stops monitoring mouse movements. This method allows programmatically interrupt dialog moving operations.

    Returns void

Protected updateMe

  • This method is called by the component to request to be updated. If no arguments are provided, the entire component is requested to be updated. If arguments are provided, they indicate what rendering functions should be updated.

    Parameters

    • Optional func: RenderMethodType

      Optional rendering function to invoke

    • Optional funcThisArg: any

      Optional value to use as "this" when invoking the rendering function. If undefined, the component's "this" will be used.

    • Optional key: any

      Optional key which distinguishes between multiple uses of the same function. This can be either the "arg" or the "key" property originally passed to the FunProxy component.

    Returns void

willMount

  • willMount(): void

willUnmount

  • willUnmount(): void

Protected wrapCallback

  • Creates a wrapper function with the same signature as the given callback so that if the original callback throws an exception, it is processed by the Mimbl error handling mechanism so that the exception bubbles from this component up the hierarchy until a component that knows to handle errors is found.

    Use this method before passing callbacks to document and window event handlers as well as non-DOM objects that use callbacks, e.g. fetch, Promise, setTimeout, etc. For example:

        class ResizeMonitor extends mim.Component
        {
            private onWindowResize(e: Event): void {};
    
            wrapper: (e: Event): void;
    
            public startResizeMonitoring()
            {
                this.wrapper = this.wrapCallback( this.onWindowResize);
                window.addEventListener( "resize", this.wrapper);
            }
    
            public stopResizeMonitoring()
            {
                window.removeEventListener( "resize", this.wrapper);
                this.wrapper = undefined;
            }
        }

    Type parameters

    • T: Function

    Parameters

    • func: T

      Method/function to be wrapped

    • Optional funcThisArg: any

      Optional value of "this" to bind the callback to. If this parameter is undefined, the component instance will be used. This parameter will be ignored if the the function is already bound or is an arrow function.

    • Optional schedulingType: TickSchedulingType

      Type determining whether and how a Mimbl tick should be scheduled after callback invocation.

    Returns T

    Function that has the same signature as the given callback and that should be used instead of the original callback

Static showUntil

  • showUntil(promise: Promise<any>, content: any, title?: string, delayMilliseconds?: number): Promise<any>
  • Displays the modal progress box with the given content and title, which is displayed until the given promise is settled. The delayMilliseconds parameter controls whether the progress box is displayed immediately or is delayed. If the input promise is settled before the delay expires, the progress box is not displayed at all.

    Parameters

    • promise: Promise<any>

      Promise to monitor - the progress box is displayed until this promis is settled.

    • content: any

      Content to be used in the progress box's body.

    • Optional title: string

      Content to display in the progress box's caption.

    • Default value delayMilliseconds: number = 750

      Delay in milliseconds until which the progress box isn't displayed. The default value is 750ms. To display the progress box immediately, set it to 0.

    Returns Promise<any>

    Promise which is resolved ot rejected with the same value as the input promise.

Generated using TypeDoc