mirror of
https://github.com/flarum/framework.git
synced 2025-02-18 11:52:46 +08:00
Bundled output for commit 22a4406d5b
Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci]
This commit is contained in:
parent
22a4406d5b
commit
33cd846b72
153
framework/core/js/dist-typings/admin/components/AdminPage.d.ts
vendored
Normal file
153
framework/core/js/dist-typings/admin/components/AdminPage.d.ts
vendored
Normal file
|
@ -0,0 +1,153 @@
|
|||
import type Mithril from 'mithril';
|
||||
import Page, { IPageAttrs } from '../../common/components/Page';
|
||||
import Stream from '../../common/utils/Stream';
|
||||
export interface AdminHeaderOptions {
|
||||
title: string;
|
||||
description: string;
|
||||
icon: string;
|
||||
/**
|
||||
* Will be used as the class for the AdminPage.
|
||||
*
|
||||
* Will also be appended with `-header` and set as the class for the `AdminHeader` component.
|
||||
*/
|
||||
className: string;
|
||||
}
|
||||
/**
|
||||
* A type that matches any valid value for the `type` attribute on an HTML `<input>` element.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type
|
||||
*
|
||||
* Note: this will be exported from a different location in the future.
|
||||
*
|
||||
* @see https://github.com/flarum/core/issues/3039
|
||||
*/
|
||||
export declare type HTMLInputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
||||
interface CommonSettingsItemOptions extends Mithril.Attributes {
|
||||
setting: string;
|
||||
label: Mithril.Children;
|
||||
help?: Mithril.Children;
|
||||
className?: string;
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate an HTML input element.
|
||||
*/
|
||||
export interface HTMLInputSettingsComponentOptions extends CommonSettingsItemOptions {
|
||||
/**
|
||||
* Any valid HTML input `type` value.
|
||||
*/
|
||||
type: HTMLInputTypes;
|
||||
}
|
||||
declare const BooleanSettingTypes: readonly ["bool", "checkbox", "switch", "boolean"];
|
||||
declare const SelectSettingTypes: readonly ["select", "dropdown", "selectdropdown"];
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Switch.
|
||||
*/
|
||||
export interface SwitchSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof BooleanSettingTypes[number];
|
||||
}
|
||||
/**
|
||||
* Valid options for the setting component builder to generate a Select dropdown.
|
||||
*/
|
||||
export interface SelectSettingComponentOptions extends CommonSettingsItemOptions {
|
||||
type: typeof SelectSettingTypes[number];
|
||||
/**
|
||||
* Map of values to their labels
|
||||
*/
|
||||
options: {
|
||||
[value: string]: Mithril.Children;
|
||||
};
|
||||
default: string;
|
||||
}
|
||||
/**
|
||||
* All valid options for the setting component builder.
|
||||
*/
|
||||
export declare type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions;
|
||||
/**
|
||||
* Valid attrs that can be returned by the `headerInfo` function
|
||||
*/
|
||||
export declare type AdminHeaderAttrs = AdminHeaderOptions & Partial<Omit<Mithril.Attributes, 'class'>>;
|
||||
export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAttrs> extends Page<CustomAttrs> {
|
||||
settings: Record<string, Stream<string>>;
|
||||
loading: boolean;
|
||||
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||
/**
|
||||
* Returns the content of the AdminPage.
|
||||
*/
|
||||
abstract content(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||
/**
|
||||
* Returns the submit button for this AdminPage.
|
||||
*
|
||||
* Calls `this.saveSettings` when the button is clicked.
|
||||
*/
|
||||
submitButton(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||
/**
|
||||
* Returns the Header component for this AdminPage.
|
||||
*/
|
||||
header(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||
/**
|
||||
* Returns the options passed to the AdminHeader component.
|
||||
*/
|
||||
headerInfo(): AdminHeaderAttrs;
|
||||
/**
|
||||
* `buildSettingComponent` takes a settings object and turns it into a component.
|
||||
* Depending on the type of input, you can set the type to 'bool', 'select', or
|
||||
* any standard <input> type. Any values inside the 'extra' object will be added
|
||||
* to the component as an attribute.
|
||||
*
|
||||
* Alternatively, you can pass a callback that will be executed in ExtensionPage's
|
||||
* context to include custom JSX elements.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* {
|
||||
* setting: 'acme.checkbox',
|
||||
* label: app.translator.trans('acme.admin.setting_label'),
|
||||
* type: 'bool',
|
||||
* help: app.translator.trans('acme.admin.setting_help'),
|
||||
* className: 'Setting-item'
|
||||
* }
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* {
|
||||
* setting: 'acme.select',
|
||||
* label: app.translator.trans('acme.admin.setting_label'),
|
||||
* type: 'select',
|
||||
* options: {
|
||||
* 'option1': 'Option 1 label',
|
||||
* 'option2': 'Option 2 label',
|
||||
* },
|
||||
* default: 'option1',
|
||||
* }
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* () => {
|
||||
* return <p>My cool component</p>;
|
||||
* }
|
||||
*/
|
||||
buildSettingComponent(entry: ((this: typeof this) => Mithril.Children) | SettingsComponentOptions): Mithril.Children;
|
||||
/**
|
||||
* Called when `saveSettings` completes successfully.
|
||||
*/
|
||||
onsaved(): void;
|
||||
/**
|
||||
* Returns a function that fetches the setting from the `app` global.
|
||||
*/
|
||||
setting(key: string, fallback?: string): Stream<string>;
|
||||
/**
|
||||
* Returns a map of settings keys to values which includes only those which have been modified but not yet saved.
|
||||
*/
|
||||
dirty(): Record<string, string>;
|
||||
/**
|
||||
* Returns the number of settings that have been modified.
|
||||
*/
|
||||
isChanged(): number;
|
||||
/**
|
||||
* Saves the modified settings to the database.
|
||||
*/
|
||||
saveSettings(e: SubmitEvent & {
|
||||
redraw: boolean;
|
||||
}): Promise<void>;
|
||||
}
|
||||
export {};
|
|
@ -47,7 +47,7 @@ export default class ExtensionData {
|
|||
* @param priority
|
||||
* @returns {ExtensionData}
|
||||
*/
|
||||
registerPermission(content: any, permissionType?: any, priority?: number): ExtensionData;
|
||||
registerPermission(content: any, permissionType?: null, priority?: number): ExtensionData;
|
||||
/**
|
||||
* Replace the default extension page with a custom component.
|
||||
* This component would typically extend ExtensionPage
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export default class Model {
|
||||
constructor(type: any, model?: any);
|
||||
constructor(type: any, model?: null);
|
||||
type: any;
|
||||
attributes: any[];
|
||||
hasOnes: any[];
|
||||
|
|
|
@ -44,8 +44,8 @@ export default abstract class PaginatedListState<T extends Model> {
|
|||
* @param page
|
||||
* @see requestParams
|
||||
*/
|
||||
refreshParams(newParams: any, page: number): any;
|
||||
refresh(page?: number): any;
|
||||
refreshParams(newParams: any, page: number): Promise<void> | undefined;
|
||||
refresh(page?: number): Promise<void>;
|
||||
getPages(): Page<T>[];
|
||||
getLocation(): PaginationLocation;
|
||||
isLoading(): boolean;
|
||||
|
|
|
@ -41,8 +41,8 @@ declare class PostStreamState {
|
|||
* @type {Boolean}
|
||||
*/
|
||||
forceUpdateScrubber: boolean;
|
||||
loadNext: any;
|
||||
loadPrevious: any;
|
||||
loadNext: throttle<() => void>;
|
||||
loadPrevious: throttle<() => void>;
|
||||
/**
|
||||
* Update the stream so that it loads and includes the latest posts in the
|
||||
* discussion, if the end is being viewed.
|
||||
|
@ -184,3 +184,4 @@ declare class PostStreamState {
|
|||
declare namespace PostStreamState {
|
||||
const loadCount: number;
|
||||
}
|
||||
import { throttle } from "throttle-debounce";
|
||||
|
|
4
framework/core/js/dist/admin.js
generated
vendored
4
framework/core/js/dist/admin.js
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/admin.js.map
generated
vendored
2
framework/core/js/dist/admin.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
framework/core/js/dist/forum.js
generated
vendored
6
framework/core/js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/forum.js.map
generated
vendored
2
framework/core/js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user