1
0
mirror of https://github.com/flarum/core.git synced 2025-08-10 18:35:56 +02:00

Bundled output for commit 7db2d0f697

Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
This commit is contained in:
flarum-bot
2021-10-30 22:31:34 +00:00
parent 7db2d0f697
commit 45927f1068
21 changed files with 122 additions and 88 deletions

View File

@@ -1,7 +1,8 @@
/**
* The `EditUserModal` component displays a modal dialog with a login form.
*/
export default class EditUserModal extends Modal {
export default class EditUserModal extends Modal<any> {
constructor();
username: Stream<any> | undefined;
email: Stream<any> | undefined;
isEmailConfirmed: Stream<any> | undefined;

View File

@@ -1,67 +1,66 @@
import Component from '../Component';
import { AlertAttrs } from './Alert';
import type Mithril from 'mithril';
import type ModalManagerState from '../states/ModalManagerState';
import type RequestError from '../utils/RequestError';
import type ModalManager from './ModalManager';
interface IInternalModalAttrs {
state: ModalManagerState;
animateShow: ModalManager['animateShow'];
animateHide: ModalManager['animateHide'];
}
/**
* The `Modal` component displays a modal dialog, wrapped in a form. Subclasses
* should implement the `className`, `title`, and `content` methods.
*
* @abstract
*/
export default class Modal extends Component<import("../Component").ComponentAttrs, undefined> {
export default abstract class Modal<ModalAttrs = {}> extends Component<ModalAttrs & IInternalModalAttrs> {
/**
* Determine whether or not the modal should be dismissible via an 'x' button.
*/
static isDismissible: boolean;
constructor();
static readonly isDismissible = true;
protected loading: boolean;
/**
* Attributes for an alert component to show below the header.
*
* @type {object}
*/
alertAttrs: object;
alertAttrs: AlertAttrs;
oninit(vnode: Mithril.VnodeDOM<ModalAttrs & IInternalModalAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<ModalAttrs & IInternalModalAttrs, this>): void;
onbeforeremove(vnode: Mithril.VnodeDOM<ModalAttrs & IInternalModalAttrs, this>): Promise<void> | void;
view(): JSX.Element;
/**
* Get the class name to apply to the modal.
*
* @return {String}
* @abstract
*/
className(): string;
abstract className(): string;
/**
* Get the title of the modal dialog.
*
* @return {String}
* @abstract
*/
title(): string;
abstract title(): string;
/**
* Get the content of the modal.
*
* @return {VirtualElement}
* @abstract
*/
content(): any;
abstract content(): Mithril.Children;
/**
* Handle the modal form's submit event.
*
* @param {Event} e
*/
onsubmit(): void;
abstract onsubmit(e: Event): void;
/**
* Focus on the first input when the modal is ready to be used.
* Callback executed when the modal is shown and ready to be interacted with.
*
* @remark Focuses the first input in the modal.
*/
onready(): void;
/**
* Hide the modal.
* Hides the modal.
*/
hide(): void;
/**
* Stop loading.
* Sets `loading` to false and triggers a redraw.
*/
loaded(): void;
loading: boolean | undefined;
/**
* Show an alert describing an error returned from the API, and give focus to
* the first relevant field.
*
* @param {RequestError} error
* Shows an alert describing an error returned from the API, and gives focus to
* the first relevant field involved in the error.
*/
onerror(error: any): void;
onerror(error: RequestError): void;
}
import Component from "../Component";
export {};

View File

@@ -1,11 +1,18 @@
import Component from '../Component';
import type Mithril from 'mithril';
import type ModalManagerState from '../states/ModalManagerState';
interface IModalManagerAttrs {
state: ModalManagerState;
}
/**
* The `ModalManager` component manages a modal dialog. Only one modal dialog
* can be shown at once; loading a new component into the ModalManager will
* overwrite the previous one.
*/
export default class ModalManager extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
animateShow(readyCallback: any): void;
export default class ModalManager extends Component<IModalManagerAttrs> {
view(): JSX.Element;
oncreate(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): void;
animateShow(readyCallback: () => void): void;
animateHide(): void;
}
import Component from "../Component";
export {};

View File

@@ -1,3 +1,4 @@
export default class RequestErrorModal extends Modal {
export default class RequestErrorModal extends Modal<any> {
constructor();
}
import Modal from "./Modal";