@jupyterlab/filebrowser

  • Version 4.4.0
  • Published
  • 577 kB
  • 20 dependencies
  • BSD-3-Clause license

Install

npm i @jupyterlab/filebrowser
yarn add @jupyterlab/filebrowser
pnpm add @jupyterlab/filebrowser

Overview

filebrowser

Index

Variables

Classes

Interfaces

Type Aliases

Namespaces

Variables

variable CHUNK_SIZE

const CHUNK_SIZE: number;
  • The size (in bytes) of the biggest chunk we should upload at once.

variable IDefaultFileBrowser

const IDefaultFileBrowser: Token<FileBrowser>;
  • The default file browser token.

variable IFileBrowserCommands

const IFileBrowserCommands: Token<IFileBrowserCommands>;
  • The token that indicates the default file browser commands are loaded.

variable IFileBrowserFactory

const IFileBrowserFactory: Token<IFileBrowserFactory>;
  • The file browser factory token.

variable LARGE_FILE_SIZE

const LARGE_FILE_SIZE: number;
  • The maximum upload size (in bytes) for notebook version < 5.1.0

Classes

class BreadCrumbs extends Widget {}
  • A class which hosts folder breadcrumbs.

constructor(options: BreadCrumbs.IOptions);
  • Construct a new file browser crumb widget.

    Parameter options

    Constructor options.

fullPath: boolean;
  • Whether to show the full path in the breadcrumbs

protected translator: ITranslator;
    handleEvent: (event: Event) => void;
    • Handle the DOM events for the bread crumbs.

      Parameter event

      The DOM event sent to the widget.

      #### Notes This method implements the DOM EventListener interface and is called in response to events on the panel's DOM node. It should not be called directly by user code.

    protected onAfterAttach: (msg: Message) => void;
    • A message handler invoked on an 'after-attach' message.

    protected onBeforeDetach: (msg: Message) => void;
    • A message handler invoked on a 'before-detach' message.

    protected onUpdateRequest: (msg: Message) => void;
    • A handler invoked on an 'update-request' message.

    class DirListing

    class DirListing extends Widget {}
    • A widget which hosts a file list area.

    constructor

    constructor(options: DirListing.IOptions);
    • Construct a new file browser directory listing widget.

      Parameter options

      The constructor options

    property allUploaded

    readonly allUploaded: ISignal<DirListing, void>;
    • Signal emitted on when all files were uploaded after native drag.

    property contentNode

    readonly contentNode: HTMLElement;
    • Get the dir listing content node.

      #### Notes This is the node which holds the item nodes.

      Modifying this node directly can lead to undefined behavior.

    property headerNode

    readonly headerNode: HTMLElement;
    • Get the dir listing header node.

      #### Notes This is the node which holds the header cells.

      Modifying this node directly can lead to undefined behavior.

    property model

    readonly model: FilterFileBrowserModel;
    • Get the model used by the listing.

    property onItemOpened

    readonly onItemOpened: ISignal<DirListing, Contents.IModel>;
    • A signal fired when an item is opened.

    property renderer

    readonly renderer: DirListing.IRenderer;
    • The renderer instance used by the directory listing.

    property selection

    protected selection: { [key: string]: boolean };

      property sortState

      readonly sortState: DirListing.ISortState;
      • The current sort state.

      property translator

      protected translator: ITranslator;

        method clearSelectedItems

        clearSelectedItems: () => void;
        • Clear the selected items.

        method copy

        copy: () => void;
        • Copy the selected items.

        method cut

        cut: () => void;
        • Cut the selected items.

        method delete

        delete: () => Promise<void>;
        • Delete the currently selected item(s).

          Returns

          A promise that resolves when the operation is complete.

        method dispose

        dispose: () => void;
        • Dispose of the resources held by the directory listing.

        method download

        download: () => Promise<void>;
        • Download the currently selected item(s).

        method duplicate

        duplicate: () => Promise<void>;
        • Duplicate the currently selected item(s).

          Returns

          A promise that resolves when the operation is complete.

        method evtDblClick

        protected evtDblClick: (event: MouseEvent) => void;
        • Handle the 'dblclick' event for the widget.

        method evtDragEnter

        protected evtDragEnter: (event: Drag.Event) => void;
        • Handle the 'lm-dragenter' event for the widget.

        method evtDragLeave

        protected evtDragLeave: (event: Drag.Event) => void;
        • Handle the 'lm-dragleave' event for the widget.

        method evtDragOver

        protected evtDragOver: (event: Drag.Event) => void;
        • Handle the 'lm-dragover' event for the widget.

        method evtDrop

        protected evtDrop: (event: Drag.Event) => void;
        • Handle the 'lm-drop' event for the widget.

        method evtKeydown

        protected evtKeydown: (event: KeyboardEvent) => void;
        • Handle the 'keydown' event for the widget.

        method evtNativeDrop

        protected evtNativeDrop: (event: DragEvent) => void;
        • Handle the drop event for the widget.

        method goUp

        goUp: () => Promise<void>;
        • cd ..

          Go up one level in the directory tree.

        method handleEvent

        handleEvent: (event: Event) => void;
        • Handle the DOM events for the directory listing.

          Parameter event

          The DOM event sent to the widget.

          #### Notes This method implements the DOM EventListener interface and is called in response to events on the panel's DOM node. It should not be called directly by user code.

        method handleFileSelect

        protected handleFileSelect: (event: MouseEvent) => void;
        • Handle selection on a file node.

        method handleOpen

        protected handleOpen: (item: Contents.IModel) => void;
        • Handle the opening of an item.

        method isSelected

        isSelected: (name: string) => boolean;
        • Get whether an item is selected by name.

          Parameter name

          The name of of the item.

          Returns

          Whether the item is selected.

        method isWithinCheckboxHitArea

        protected isWithinCheckboxHitArea: (event: Event) => boolean;
        • Would this click (or other event type) hit the checkbox by default?

        method modelForClick

        modelForClick: (event: MouseEvent) => Contents.IModel | undefined;
        • Find a model given a click.

          Parameter event

          The mouse event.

          Returns

          The model for the selected file.

        method onAfterAttach

        protected onAfterAttach: (msg: Message) => void;
        • A message handler invoked on an 'after-attach' message.

        method onAfterShow

        protected onAfterShow: (msg: Message) => void;
        • A message handler invoked on an 'after-show' message.

        method onBeforeDetach

        protected onBeforeDetach: (msg: Message) => void;
        • A message handler invoked on a 'before-detach' message.

        method onResize

        onResize: (msg: Widget.ResizeMessage) => void;

          method onUpdateRequest

          protected onUpdateRequest: (msg: Message) => void;
          • A handler invoked on an 'update-request' message.

          method paste

          paste: () => Promise<void>;
          • Paste the items from the clipboard.

            Returns

            A promise that resolves when the operation is complete.

          method rename

          rename: () => Promise<string>;
          • Rename the first currently selected item.

            Returns

            A promise that resolves with the new name of the item.

          method restore

          restore: (id: string) => Promise<void>;
          • Restore the state of the file browser listing.

            Parameter id

            The unique ID that is used to construct a state database key.

          method selectByPrefix

          selectByPrefix: () => void;
          • Select the first item that starts with prefix being typed.

          method selectedItems

          selectedItems: () => IterableIterator<Contents.IModel>;
          • Create an iterator over the listing's selected items.

            Returns

            A new iterator over the listing's selected items.

          method selectItemByName

          selectItemByName: (name: string, focus?: boolean) => Promise<void>;
          • Select an item by name.

            Parameter name

            The name of the item to select.

            Parameter focus

            Whether to move focus to the selected item.

            Returns

            A promise that resolves when the name is selected.

          method selectNext

          selectNext: (keepExisting?: boolean) => void;
          • Select next item.

            Parameter keepExisting

            Whether to keep the current selection and add to it.

          method selectPrevious

          selectPrevious: (keepExisting?: boolean) => void;
          • Select previous item.

            Parameter keepExisting

            Whether to keep the current selection and add to it.

          method setAllowSingleClickNavigation

          setAllowSingleClickNavigation: (isEnabled: boolean) => void;
          • Update the setting to allow single click navigation. This enables opening files/directories with a single click.

          method setColumnVisibility

          setColumnVisibility: (
          name: DirListing.ToggleableColumn,
          visible: boolean
          ) => void;

            method setNotebooksFirstSorting

            setNotebooksFirstSorting: (isEnabled: boolean) => void;
            • Update the setting to sort notebooks above files. This sorts the items again if the internal value is modified.

            method shutdownKernels

            shutdownKernels: () => Promise<void>;
            • Shut down kernels on the applicable currently selected items.

              Returns

              A promise that resolves when the operation is complete.

            method sort

            sort: (state: DirListing.ISortState) => void;
            • Sort the items using a sort condition.

            method sortedItems

            sortedItems: () => IterableIterator<Contents.IModel>;
            • Create an iterator over the listing's sorted items.

              Returns

              A new iterator over the listing's sorted items.

            method updateModified

            protected updateModified: (
            items: Contents.IModel[],
            nodes: HTMLElement[]
            ) => void;
            • Update only the modified dates.

            method updateNodes

            protected updateNodes: (
            items: Contents.IModel[],
            nodes: HTMLElement[],
            sizeOnly?: boolean
            ) => void;

              class FileBrowser

              class FileBrowser extends SidePanel {}
              • A widget which hosts a file browser.

                The widget uses the Jupyter Contents API to retrieve contents, and presents itself as a flat list of files and directories with breadcrumbs.

              constructor

              constructor(options: FileBrowser.IOptions);
              • Construct a new file browser.

                Parameter options

                The file browser options.

              property crumbs

              protected crumbs: BreadCrumbs;

                property filterToolbar

                protected filterToolbar: Toolbar;

                  property listing

                  protected listing: DirListing;

                    property mainPanel

                    protected mainPanel: Panel;

                      property model

                      readonly model: FilterFileBrowserModel;
                      • The model used by the file browser.

                      property navigateToCurrentDirectory

                      navigateToCurrentDirectory: boolean;
                      • Whether to show active file in file browser

                      property showFileCheckboxes

                      showFileCheckboxes: boolean;
                      • Whether to show checkboxes next to files and folders

                      property showFileFilter

                      showFileFilter: boolean;
                      • Whether to show a text box to filter files by name.

                      property showFileSizeColumn

                      showFileSizeColumn: boolean;
                      • Whether to show the file size column

                      property showFullPath

                      showFullPath: boolean;
                      • Whether to show the full path in the breadcrumbs

                      property showHiddenFiles

                      showHiddenFiles: boolean;
                      • Whether to show hidden files

                      property showLastModifiedColumn

                      showLastModifiedColumn: boolean;
                      • Whether to show the last modified column

                      property singleClickNavigation

                      singleClickNavigation: boolean;
                      • Whether to allow single click files and directories

                      property sortNotebooksFirst

                      sortNotebooksFirst: boolean;
                      • Whether to sort notebooks above other files

                      property translator

                      protected translator: ITranslator;

                        method clearSelectedItems

                        clearSelectedItems: () => void;

                          method copy

                          copy: () => void;
                          • Copy the selected items.

                          method createDirListing

                          protected createDirListing: (options: DirListing.IOptions) => DirListing;
                          • Create the underlying DirListing instance.

                            Parameter options

                            The DirListing constructor options.

                            Returns

                            The created DirListing instance.

                          method createNewDirectory

                          createNewDirectory: () => Promise<Contents.IModel>;
                          • Create a new directory

                          method createNewFile

                          createNewFile: (options: FileBrowser.IFileOptions) => Promise<Contents.IModel>;
                          • Create a new file

                          method cut

                          cut: () => void;
                          • Cut the selected items.

                          method delete

                          delete: () => Promise<void>;
                          • Delete the currently selected item(s).

                            Returns

                            A promise that resolves when the operation is complete.

                          method download

                          download: () => Promise<void>;
                          • Download the currently selected item(s).

                          method duplicate

                          duplicate: () => Promise<void>;
                          • Duplicate the currently selected item(s).

                            Returns

                            A promise that resolves when the operation is complete.

                          method goUp

                          goUp: () => Promise<void>;
                          • cd ..

                            Go up one level in the directory tree.

                          method modelForClick

                          modelForClick: (event: MouseEvent) => Contents.IModel | undefined;
                          • Find a model given a click.

                            Parameter event

                            The mouse event.

                            Returns

                            The model for the selected file.

                          method paste

                          paste: () => Promise<void>;
                          • Paste the items from the clipboard.

                            Returns

                            A promise that resolves when the operation is complete.

                          method rename

                          rename: () => Promise<string>;
                          • Rename the first currently selected item.

                            Returns

                            A promise that resolves with the new name of the item.

                          method selectedItems

                          selectedItems: () => IterableIterator<Contents.IModel>;
                          • Create an iterator over the listing's selected items.

                            Returns

                            A new iterator over the listing's selected items.

                          method selectItemByName

                          selectItemByName: (name: string) => Promise<void>;
                          • Select an item by name.

                            Parameter name

                            The name of the item to select.

                          method selectNext

                          selectNext: () => void;
                          • Select next item.

                          method selectPrevious

                          selectPrevious: () => void;
                          • Select previous item.

                          method shutdownKernels

                          shutdownKernels: () => Promise<void>;
                          • Shut down kernels on the applicable currently selected items.

                            Returns

                            A promise that resolves when the operation is complete.

                          class FileBrowserModel

                          class FileBrowserModel implements IDisposable {}
                          • An implementation of a file browser model.

                            #### Notes All paths parameters without a leading '/' are interpreted as relative to the current directory. Supports '../' syntax.

                          constructor

                          constructor(options: FileBrowserModel.IOptions);
                          • Construct a new file browser model.

                          property connectionFailure

                          readonly connectionFailure: ISignal<this, Error>;
                          • A signal emitted when the file browser model loses connection.

                          property driveName

                          readonly driveName: string;
                          • The drive name that gets prepended to the path.

                          property fileChanged

                          readonly fileChanged: ISignal<this, Contents.IChangedArgs>;
                          • Get the file path changed signal.

                          property isDisposed

                          readonly isDisposed: boolean;
                          • Get whether the model is disposed.

                          property manager

                          readonly manager: IDocumentManager;
                          • The document manager instance used by the file browser model.

                          property path

                          readonly path: string;
                          • Get the current path.

                          property pathChanged

                          readonly pathChanged: ISignal<this, IChangedArgs<string>>;
                          • A signal emitted when the path changes.

                          property refreshed

                          readonly refreshed: ISignal<this, void>;
                          • A signal emitted when the directory listing is refreshed.

                          property restored

                          readonly restored: Promise<void>;
                          • A promise that resolves when the model is first restored.

                          property rootPath

                          readonly rootPath: string;
                          • Get the root path

                          property specs

                          readonly specs: any;
                          • Get the kernel spec models.

                          property translator

                          protected translator: ITranslator;

                            property uploadChanged

                            readonly uploadChanged: ISignal<this, IChangedArgs<IUploadModel>>;
                            • A signal emitted when an upload progresses.

                            method cd

                            cd: (path?: string) => Promise<void>;
                            • Change directory.

                              Parameter path

                              The path to the file or directory.

                              Returns

                              A promise with the contents of the directory.

                            method dispose

                            dispose: () => void;
                            • Dispose of the resources held by the model.

                            method download

                            download: (path: string) => Promise<void>;
                            • Download a file.

                              Parameter path

                              The path of the file to be downloaded.

                              Returns

                              A promise which resolves when the file has begun downloading.

                            method handleContents

                            protected handleContents: (contents: Contents.IModel) => void;
                            • Handle an updated contents model.

                            method items

                            items: () => IterableIterator<Contents.IModel>;
                            • Create an iterator over the model's items.

                              Returns

                              A new iterator over the model's items.

                            method onFileChanged

                            protected onFileChanged: (
                            sender: Contents.IManager,
                            change: Contents.IChangedArgs
                            ) => void;
                            • Handle a change on the contents manager.

                            method onRunningChanged

                            protected onRunningChanged: (
                            sender: Session.IManager,
                            models: Iterable<Session.IModel>
                            ) => void;
                            • Handle a change to the running sessions.

                            method refresh

                            refresh: () => Promise<void>;
                            • Force a refresh of the directory contents.

                            method restore

                            restore: (id: string, populate?: boolean) => Promise<void>;
                            • Restore the state of the file browser.

                              Parameter id

                              The unique ID that is used to construct a state database key.

                              Parameter populate

                              If false, the restoration ID will be set but the file browser state will not be fetched from the state database.

                              Returns

                              A promise when restoration is complete.

                              #### Notes This function will only restore the model *once*. If it is called multiple times, all subsequent invocations are no-ops.

                            method sessions

                            sessions: () => IterableIterator<Session.IModel>;
                            • Create an iterator over the active sessions in the directory.

                              Returns

                              A new iterator over the model's active sessions.

                            method upload

                            upload: (file: File, path?: string) => Promise<Contents.IModel>;
                            • Upload a File object.

                              Parameter file

                              The File object to upload.

                              Parameter path

                              The directory into which the file should be uploaded; defaults to current directory.

                              Returns

                              A promise containing the new file contents model.

                              #### Notes On Notebook version < 5.1.0, this will fail to upload files that are too big to be sent in one request to the server. On newer versions, or on Jupyter Server, it will ask for confirmation then upload the file in 1 MB chunks.

                            method uploads

                            uploads: () => IterableIterator<IUploadModel>;
                            • Create an iterator over the status of all in progress uploads.

                            class FileUploadStatus

                            class FileUploadStatus extends VDomRenderer<FileUploadStatus.Model> {}
                            • Status bar item to display file upload progress.

                            constructor

                            constructor(opts: FileUploadStatus.IOptions);
                            • Construct a new FileUpload status item.

                            method dispose

                            dispose: () => void;

                              method render

                              render: () => JSX.Element;
                              • Render the FileUpload status.

                              class FilterFileBrowserModel

                              class FilterFileBrowserModel extends TogglableHiddenFileBrowserModel {}
                              • File browser model with optional filter on element.

                              constructor

                              constructor(options: FilterFileBrowserModel.IOptions);

                                property filterDirectories

                                filterDirectories: boolean;
                                • Whether to filter directories.

                                property filterSettingsChanged

                                readonly filterSettingsChanged: ISignal<
                                FileBrowserModel,
                                { [x: string]: IFilterBoxProps }
                                >;
                                • Signal for settings changed

                                property useFuzzyFilter

                                useFuzzyFilter: boolean;
                                • Whether to apply fuzzy filter.

                                method items

                                items: () => IterableIterator<Contents.IModel>;
                                • Create an iterator over the filtered model's items.

                                  Returns

                                  A new iterator over the model's items.

                                method setFilter

                                setFilter: (filter: (value: Contents.IModel) => Partial<IScore> | null) => void;

                                  class TogglableHiddenFileBrowserModel

                                  class TogglableHiddenFileBrowserModel extends FileBrowserModel {}
                                  • File browser model where hidden files inclusion can be toggled on/off.

                                  constructor

                                  constructor(options: TogglableHiddenFileBrowserModel.IOptions);

                                    method items

                                    items: () => IterableIterator<Contents.IModel>;
                                    • Create an iterator over the model's items filtering hidden files out if necessary.

                                      Returns

                                      A new iterator over the model's items.

                                    method showHiddenFiles

                                    showHiddenFiles: (value: boolean) => void;
                                    • Set the inclusion of hidden files. Triggers a model refresh.

                                    class Uploader

                                    class Uploader extends ToolbarButton {}
                                    • A widget which provides an upload button.

                                    constructor

                                    constructor(options: Uploader.IOptions);
                                    • Construct a new file browser buttons widget.

                                    property fileBrowserModel

                                    readonly fileBrowserModel: FileBrowserModel;
                                    • The underlying file browser fileBrowserModel for the widget.

                                      This cannot be named model as that conflicts with the model property of VDomRenderer.

                                    property translator

                                    protected translator: ITranslator;

                                      Interfaces

                                      interface IFileBrowserCommands

                                      interface IFileBrowserCommands {}
                                      • The identifiers of loaded commands exposed for reuse.

                                      property openPath

                                      openPath: string;
                                      • Command for opening a file or a directory by path.

                                      interface IFileBrowserFactory

                                      interface IFileBrowserFactory {}
                                      • The file browser factory interface.

                                      property tracker

                                      readonly tracker: WidgetTracker<FileBrowser>;
                                      • The widget tracker used by the factory to track file browsers.

                                      method createFileBrowser

                                      createFileBrowser: (
                                      id: string,
                                      options?: IFileBrowserFactory.IOptions
                                      ) => FileBrowser;
                                      • Create a new file browser instance.

                                        Parameter id

                                        The widget/DOM id of the file browser.

                                        Parameter options

                                        The optional file browser configuration object.

                                        #### Notes The ID parameter is used to set the widget ID. It is also used as part of the unique key necessary to store the file browser's restoration data in the state database if that functionality is enabled.

                                        If, after the file browser has been generated by the factory, the ID of the resulting widget is changed by client code, the restoration functionality will not be disrupted as long as there are no ID collisions, i.e., as long as the initial ID passed into the factory is used for only one file browser instance.

                                      interface IUploadModel

                                      interface IUploadModel {}
                                      • An upload progress event for a file at path.

                                      property path

                                      path: string;

                                        property progress

                                        progress: number;
                                        • % uploaded [0, 1)

                                        Type Aliases

                                        type IDefaultFileBrowser

                                        type IDefaultFileBrowser = FileBrowser;
                                        • Default file browser type.

                                        Namespaces

                                        namespace BreadCrumbs {}
                                        • The namespace for the BreadCrumbs class statics.

                                        interface IOptions {}
                                        • An options object for initializing a bread crumb widget.

                                        fullPath?: boolean;
                                        • Show the full file browser path in breadcrumbs

                                        model: FileBrowserModel;
                                        • A file browser model instance.

                                        translator?: ITranslator;
                                        • The application language translator.

                                        namespace DirListing

                                        namespace DirListing {}
                                        • The namespace for the DirListing class statics.

                                        variable columns

                                        const columns: IColumn[];
                                        • Column definitions.

                                        variable defaultRenderer

                                        const defaultRenderer: Renderer;
                                        • The default IRenderer instance.

                                        class Renderer

                                        class Renderer implements IRenderer {}
                                        • The default implementation of an IRenderer.

                                        property itemFactories

                                        protected itemFactories: {
                                        name: () => HTMLSpanElement;
                                        last_modified: () => HTMLSpanElement;
                                        file_size: () => HTMLSpanElement;
                                        is_selected: () => HTMLElement;
                                        };
                                        • Factories for individual parts of the item.

                                        method createCheckboxWrapperNode

                                        createCheckboxWrapperNode: (options?: {
                                        alwaysVisible: boolean;
                                        headerNode?: boolean;
                                        }) => HTMLElement;
                                        • Creates a node containing a checkbox.

                                          We wrap the checkbox in a label element in order to increase its hit area. This is because the padding of the checkbox itself cannot be increased via CSS, as the CSS/form compatibility table at the following url from MDN shows: https://developer.mozilla.org/en-US/docs/Learn/Forms/Property_compatibility_table_for_form_controls#check_boxes_and_radio_buttons

                                          Parameter options

                                          options.alwaysVisible Should the checkbox be visible even when not hovered?

                                          Returns

                                          A new DOM node that contains a checkbox.

                                        method createDragImage

                                        createDragImage: (
                                        node: HTMLElement,
                                        count: number,
                                        trans: TranslationBundle,
                                        fileType?: DocumentRegistry.IFileType
                                        ) => HTMLElement;
                                        • Create a drag image for an item.

                                          Parameter node

                                          A node created by [[createItemNode]].

                                          Parameter count

                                          The number of items being dragged.

                                          Parameter fileType

                                          The file type of the item, if applicable.

                                          Returns

                                          An element to use as the drag image.

                                        method createHeaderItemNode

                                        protected createHeaderItemNode: (label: string) => HTMLElement;
                                        • Create a node for a header item.

                                        method createItemNode

                                        createItemNode: (
                                        hiddenColumns?: Set<DirListing.ToggleableColumn>,
                                        columnsSizes?: Record<DirListing.IColumn['id'], number | null>
                                        ) => HTMLElement;
                                        • Create a new item node for a dir listing.

                                          Returns

                                          A new DOM node to use as a content item.

                                        method createNode

                                        createNode: () => HTMLElement;
                                        • Create the DOM node for a dir listing.

                                        method getCheckboxNode

                                        getCheckboxNode: (node: HTMLElement) => HTMLInputElement | null;
                                        • Get the checkbox input element node.

                                          Parameter node

                                          A node created by [[createItemNode]] or [[createHeaderItemNode]]

                                          Returns

                                          The checkbox node.

                                        method getNameNode

                                        getNameNode: (node: HTMLElement) => HTMLElement;
                                        • Get the node containing the file name.

                                          Parameter node

                                          A node created by [[createItemNode]].

                                          Returns

                                          The node containing the file name.

                                        method handleHeaderClick

                                        handleHeaderClick: (node: HTMLElement, event: MouseEvent) => ISortState | null;
                                        • Handle a header click.

                                          Parameter node

                                          A node populated by [[populateHeaderNode]].

                                          Parameter event

                                          A click event on the node.

                                          Returns

                                          The sort state of the header after the click event.

                                        method populateHeaderNode

                                        populateHeaderNode: (
                                        node: HTMLElement,
                                        translator?: ITranslator,
                                        hiddenColumns?: Set<DirListing.ToggleableColumn>,
                                        columnsSizes?: Record<DirListing.IColumn['id'], number | null>
                                        ) => void;
                                        • Populate and empty header node for a dir listing.

                                          Parameter node

                                          The header node to populate.

                                        method updateItemModified

                                        updateItemModified: (
                                        modified: HTMLElement,
                                        modifiedDate: string,
                                        modifiedStyle: Time.HumanStyle
                                        ) => void;
                                        • Update an item's last modified date.

                                          Parameter modified

                                          Element containing the file's last modified date.

                                          Parameter modifiedDate

                                          String representation of the last modified date.

                                          Parameter modifiedStyle

                                          The date style for the modified column: narrow, short, or long

                                        method updateItemNode

                                        updateItemNode: (
                                        node: HTMLElement,
                                        model: Contents.IModel,
                                        fileType?: DocumentRegistry.IFileType,
                                        translator?: ITranslator,
                                        hiddenColumns?: Set<DirListing.ToggleableColumn>,
                                        selected?: boolean,
                                        modifiedStyle?: Time.HumanStyle,
                                        columnsSizes?: Record<DirListing.IColumn['id'], number | null>
                                        ) => void;
                                        • Update an item node to reflect the current state of a model.

                                          Parameter node

                                          A node created by [[createItemNode]].

                                          Parameter model

                                          The model object to use for the item state.

                                          Parameter fileType

                                          The file type of the item, if applicable.

                                        method updateItemSize

                                        updateItemSize: (
                                        node: HTMLElement,
                                        model: Contents.IModel,
                                        modifiedStyle?: Time.HumanStyle,
                                        columnsSizes?: Record<DirListing.IColumn['id'], number | null>
                                        ) => void;
                                        • Update size of item nodes, assuming that model has not changed.

                                        interface IContentsThunk

                                        interface IContentsThunk {}
                                        • A file contents model thunk.

                                          Note: The content of the model will be empty. To get the contents, call and await the withContent method.

                                        property model

                                        model: Contents.IModel;
                                        • The contents model.

                                        property withContent

                                        withContent: () => Promise<Contents.IModel>;
                                        • Fetches the model with contents.

                                        interface IOptions

                                        interface IOptions {}
                                        • An options object for initializing a file browser directory listing.

                                        property model

                                        model: FilterFileBrowserModel;
                                        • A file browser model instance.

                                        property renderer

                                        renderer?: IRenderer;
                                        • A renderer for file items.

                                          The default is a shared Renderer instance.

                                        property state

                                        state?: IStateDB;
                                        • An optional state database. If provided, the widget will restore the columns sizes

                                        property translator

                                        translator?: ITranslator;
                                        • A language translator.

                                        interface IRenderer

                                        interface IRenderer {}
                                        • The render interface for file browser listing options.

                                        property getCheckboxNode

                                        getCheckboxNode: (node: HTMLElement) => HTMLInputElement | null;
                                        • Get the checkbox input element node.

                                          Downstream interface implementations,such as jupyterlab-unfold, that don't support checkboxes should simply always return null for this function.

                                          Parameter node

                                          A node created by [[createItemNode]] or [[createHeaderItemNode]]

                                          Returns

                                          The checkbox node.

                                        method createDragImage

                                        createDragImage: (
                                        node: HTMLElement,
                                        count: number,
                                        trans: TranslationBundle,
                                        fileType?: DocumentRegistry.IFileType
                                        ) => HTMLElement;
                                        • Create an appropriate drag image for an item.

                                          Parameter node

                                          A node created by [[createItemNode]].

                                          Parameter count

                                          The number of items being dragged.

                                          Parameter fileType

                                          The file type of the item, if applicable.

                                          Returns

                                          An element to use as the drag image.

                                        method createItemNode

                                        createItemNode: (
                                        hiddenColumns?: Set<DirListing.ToggleableColumn>,
                                        columnsSizes?: Record<IColumn['id'], number | null>
                                        ) => HTMLElement;
                                        • Create a new item node for a dir listing.

                                          Returns

                                          A new DOM node to use as a content item.

                                        method createNode

                                        createNode: () => HTMLElement;
                                        • Create the DOM node for a dir listing.

                                        method getNameNode

                                        getNameNode: (node: HTMLElement) => HTMLElement;
                                        • Get the node containing the file name.

                                          Parameter node

                                          A node created by [[createItemNode]].

                                          Returns

                                          The node containing the file name.

                                        method handleHeaderClick

                                        handleHeaderClick: (node: HTMLElement, event: MouseEvent) => ISortState | null;
                                        • Handle a header click.

                                          Parameter node

                                          A node populated by [[populateHeaderNode]].

                                          Parameter event

                                          A click event on the node.

                                          Returns

                                          The sort state of the header after the click event.

                                        method populateHeaderNode

                                        populateHeaderNode: (
                                        node: HTMLElement,
                                        translator?: ITranslator,
                                        hiddenColumns?: Set<DirListing.ToggleableColumn>,
                                        columnsSizes?: Record<IColumn['id'], number | null>
                                        ) => void;
                                        • Populate and empty header node for a dir listing.

                                          Parameter node

                                          The header node to populate.

                                        method updateItemModified

                                        updateItemModified: (
                                        modified: HTMLElement,
                                        modifiedDate: string,
                                        modifiedStyle: Time.HumanStyle
                                        ) => void;
                                        • Update an item's last modified date.

                                          Parameter modified

                                          Element containing the file's last modified date.

                                          Parameter modifiedDate

                                          String representation of the last modified date.

                                          Parameter modifiedStyle

                                          The date style for the modified column: narrow, short, or long

                                        method updateItemNode

                                        updateItemNode: (
                                        node: HTMLElement,
                                        model: Contents.IModel,
                                        fileType?: DocumentRegistry.IFileType,
                                        translator?: ITranslator,
                                        hiddenColumns?: Set<DirListing.ToggleableColumn>,
                                        selected?: boolean,
                                        modifiedStyle?: Time.HumanStyle,
                                        columnsSizes?: Record<IColumn['id'], number | null>
                                        ) => void;
                                        • Update an item node to reflect the current state of a model.

                                          Parameter node

                                          A node created by [[createItemNode]].

                                          Parameter model

                                          The model object to use for the item state.

                                          Parameter modifiedStyle

                                          The date style for the modified column: narrow, short, or long

                                          Parameter fileType

                                          The file type of the item, if applicable.

                                        method updateItemSize

                                        updateItemSize: (
                                        node: HTMLElement,
                                        model: Contents.IModel,
                                        modifiedStyle?: Time.HumanStyle,
                                        columnsSizes?: Record<IColumn['id'], number | null>
                                        ) => void;
                                        • Update size of item nodes, assuming that model has not changed.

                                        interface IResizableColumn

                                        interface IResizableColumn extends IBaseColumn {}
                                        • Resizable column.

                                        property id

                                        id: ResizableColumn;

                                          property resizable

                                          resizable: true;

                                            interface ISortableColumn

                                            interface ISortableColumn extends IBaseColumn {}
                                            • Sortable column.

                                            property caretSide

                                            caretSide: 'left' | 'right';

                                              property id

                                              id: SortableColumn;

                                                property sortable

                                                sortable: true;

                                                  interface ISortState

                                                  interface ISortState {}
                                                  • A sort state.

                                                  property direction

                                                  direction: 'ascending' | 'descending';
                                                  • The direction of sort.

                                                  property key

                                                  key: SortableColumn;
                                                  • The sort key.

                                                  type IColumn

                                                  type IColumn =
                                                  | IFixedColumn
                                                  | ISortableColumn
                                                  | IResizableColumn
                                                  | (ISortableColumn & IResizableColumn);
                                                  • Columns types supported by DirListing.

                                                  type ResizableColumn

                                                  type ResizableColumn = 'name' | 'last_modified' | 'file_size';
                                                  • Resizable columns.

                                                  type SortableColumn

                                                  type SortableColumn = 'name' | 'last_modified' | 'file_size';
                                                  • Sortable columns.

                                                  type ToggleableColumn

                                                  type ToggleableColumn = 'last_modified' | 'is_selected' | 'file_size';
                                                  • Toggleable columns.

                                                  namespace FileBrowser

                                                  namespace FileBrowser {}
                                                  • The namespace for the FileBrowser class statics.

                                                  interface IFileOptions

                                                  interface IFileOptions {}
                                                  • An options object for creating a file.

                                                  property ext

                                                  ext: string;
                                                  • The file extension.

                                                  interface IOptions

                                                  interface IOptions {}
                                                  • An options object for initializing a file browser widget.

                                                  property id

                                                  id: string;
                                                  • The widget/DOM id of the file browser.

                                                  property model

                                                  model: FilterFileBrowserModel;
                                                  • A file browser model instance.

                                                  property renderer

                                                  renderer?: DirListing.IRenderer;
                                                  • An optional renderer for the directory listing area.

                                                    The default is a shared instance of DirListing.Renderer.

                                                  property restore

                                                  restore?: boolean;
                                                  • Whether a file browser automatically restores state when instantiated. The default is true.

                                                    #### Notes The file browser model will need to be restored manually for the file browser to be able to save its state.

                                                  property state

                                                  state?: IStateDB;
                                                  • An optional state database. If provided, the widget will restore the columns sizes

                                                  property translator

                                                  translator?: ITranslator;
                                                  • The application language translator.

                                                  namespace FileBrowserModel

                                                  namespace FileBrowserModel {}
                                                  • The namespace for the FileBrowserModel class statics.

                                                  interface IOptions

                                                  interface IOptions {}
                                                  • An options object for initializing a file browser.

                                                  property auto

                                                  auto?: boolean;
                                                  • Whether a file browser automatically loads its initial path. The default is true.

                                                  property driveName

                                                  driveName?: string;
                                                  • An optional Contents.IDrive name for the model. If given, the model will prepend driveName: to all paths used in file operations.

                                                  property manager

                                                  manager: IDocumentManager;
                                                  • A document manager instance.

                                                  property refreshInterval

                                                  refreshInterval?: number;
                                                  • The time interval for browser refreshing, in ms.

                                                  property refreshStandby

                                                  refreshStandby?: Poll.Standby | (() => boolean | Poll.Standby);
                                                  • When the model stops polling the API. Defaults to when-hidden.

                                                  property state

                                                  state?: IStateDB;
                                                  • An optional state database. If provided, the model will restore which folder was last opened when it is restored.

                                                  property translator

                                                  translator?: ITranslator;
                                                  • The application language translator.

                                                  namespace FileDialog

                                                  namespace FileDialog {}
                                                  • Namespace for file dialog

                                                  function getExistingDirectory

                                                  getExistingDirectory: (
                                                  options: IDirectoryOptions
                                                  ) => Promise<Dialog.IResult<Contents.IModel[]>>;
                                                  • Create and show a open directory dialog.

                                                    Note: if nothing is selected when getValue will return the browser model current path.

                                                    Parameter options

                                                    The dialog setup options.

                                                    Returns

                                                    A promise that resolves with whether the dialog was accepted.

                                                  function getOpenFiles

                                                  getOpenFiles: (
                                                  options: IFileOptions
                                                  ) => Promise<Dialog.IResult<Contents.IModel[]>>;
                                                  • Create and show a open files dialog.

                                                    Note: if nothing is selected when getValue will return the browser model current path.

                                                    Parameter options

                                                    The dialog setup options.

                                                    Returns

                                                    A promise that resolves with whether the dialog was accepted.

                                                  interface IDirectoryOptions

                                                  interface IDirectoryOptions
                                                  extends Partial<
                                                  Pick<
                                                  Dialog.IOptions<Promise<Contents.IModel[]>>,
                                                  Exclude<
                                                  keyof Dialog.IOptions<Promise<Contents.IModel[]>>,
                                                  'body' | 'buttons' | 'defaultButton'
                                                  >
                                                  >
                                                  > {}
                                                  • Options for the open directory dialog

                                                  property defaultPath

                                                  defaultPath?: string;
                                                  • Default path to open

                                                  property label

                                                  label?: string;
                                                  • Text to display above the file browser.

                                                  property manager

                                                  manager: IDocumentManager;
                                                  • Document manager

                                                  property translator

                                                  translator?: ITranslator;
                                                  • The application language translator.

                                                  interface IFileOptions

                                                  interface IFileOptions extends IDirectoryOptions {}
                                                  • Options for the open file dialog

                                                  property filter

                                                  filter?: (value: Contents.IModel) => Partial<IScore> | null;
                                                  • Filter function on file browser item model

                                                  property translator

                                                  translator?: ITranslator;
                                                  • The application language translator.

                                                  namespace FileUploadStatus

                                                  namespace FileUploadStatus {}
                                                  • A namespace for FileUpload class statics.

                                                  class Model

                                                  class Model extends VDomModel {}
                                                  • The VDomModel for the FileUpload renderer.

                                                  constructor

                                                  constructor(browserModel: FileBrowserModel);
                                                  • Construct a new model.

                                                  property browserModel

                                                  browserModel: FileBrowserModel;
                                                  • The current file browser model.

                                                  property items

                                                  readonly items: IFileUploadItem[];
                                                  • The currently uploading items.

                                                  interface IOptions

                                                  interface IOptions {}
                                                  • Options for creating the upload status item.

                                                  property tracker

                                                  readonly tracker: WidgetTracker<FileBrowser>;
                                                  • The application file browser tracker.

                                                  property translator

                                                  readonly translator?: ITranslator;
                                                  • The translation language bundle.

                                                  namespace FilterFileBrowserModel

                                                  namespace FilterFileBrowserModel {}
                                                  • Namespace for the filtered file browser model

                                                  interface IOptions

                                                  interface IOptions extends TogglableHiddenFileBrowserModel.IOptions {}
                                                  • Constructor options

                                                  property filter

                                                  filter?: (value: Contents.IModel) => Partial<IScore> | null;
                                                  • Filter function on file browser item model

                                                  property filterDirectories

                                                  filterDirectories?: boolean;
                                                  • Filter directories

                                                  property useFuzzyFilter

                                                  useFuzzyFilter?: boolean;
                                                  • Use Fuzzy Filter

                                                  namespace IFileBrowserFactory

                                                  namespace IFileBrowserFactory {}
                                                  • A namespace for file browser factory interfaces.

                                                  interface IOptions

                                                  interface IOptions {}
                                                  • The options for creating a file browser using a file browser factory.

                                                    #### Notes In future versions of JupyterLab, some of these options may disappear, which is a backward-incompatible API change and will necessitate a new version release. This is because in future versions, there will likely be an application-wide notion of a singleton command registry and a singleton state database.

                                                  property auto

                                                  auto?: boolean;
                                                  • Whether a file browser automatically loads its initial path.

                                                    #### Notes The default is true.

                                                  property driveName

                                                  driveName?: string;
                                                  • An optional Contents.IDrive name for the model. If given, the model will prepend driveName: to all paths used in file operations.

                                                  property refreshInterval

                                                  refreshInterval?: number;
                                                  • The time interval for browser refreshing, in ms.

                                                  property restore

                                                  restore?: boolean;
                                                  • Whether a file browser automatically restores state when instantiated. The default is true.

                                                    #### Notes The file browser model will need to be restored before for the file browser to start saving its state.

                                                  property state

                                                  state?: IStateDB | null;
                                                  • The state database to use for saving file browser state and restoring it.

                                                    #### Notes Unless the value null is set for this option, the application state database will be automatically passed in and used for state restoration.

                                                  namespace TogglableHiddenFileBrowserModel

                                                  namespace TogglableHiddenFileBrowserModel {}
                                                  • Namespace for the togglable hidden file browser model

                                                  interface IOptions

                                                  interface IOptions extends FileBrowserModel.IOptions {}
                                                  • Constructor options

                                                  property includeHiddenFiles

                                                  includeHiddenFiles?: boolean;
                                                  • Whether hidden files should be included in the items.

                                                  namespace Uploader

                                                  namespace Uploader {}
                                                  • The namespace for Uploader class statics.

                                                  interface IOptions

                                                  interface IOptions {}
                                                  • The options used to create an uploader.

                                                  property label

                                                  label?: string;
                                                  • An optional label.

                                                  property model

                                                  model: FileBrowserModel;
                                                  • A file browser fileBrowserModel instance.

                                                  property translator

                                                  translator?: ITranslator;
                                                  • The language translator.

                                                  Package Files (9)

                                                  Dependencies (20)

                                                  Dev Dependencies (5)

                                                  Peer Dependencies (0)

                                                  No peer dependencies.

                                                  Badge

                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jupyterlab/filebrowser.

                                                  • Markdown
                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jupyterlab/filebrowser)
                                                  • HTML
                                                    <a href="https://www.jsdocs.io/package/@jupyterlab/filebrowser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>