mirror of
https://github.com/flarum/core.git
synced 2025-08-07 00:47:00 +02:00
Bundled output for commit 38362e689d
Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci]
This commit is contained in:
@@ -1,4 +1,19 @@
|
|||||||
export default class ExtensionPermissionGrid extends PermissionGrid {
|
import PermissionGrid, { PermissionGridEntry } from './PermissionGrid';
|
||||||
extensionId: any;
|
import ItemList from '../../common/utils/ItemList';
|
||||||
|
import Mithril from 'mithril';
|
||||||
|
export interface IExtensionPermissionGridAttrs {
|
||||||
|
extensionId: string;
|
||||||
|
}
|
||||||
|
export default class ExtensionPermissionGrid<CustomAttrs extends IExtensionPermissionGridAttrs = IExtensionPermissionGridAttrs> extends PermissionGrid<CustomAttrs> {
|
||||||
|
protected extensionId: string;
|
||||||
|
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
|
||||||
|
permissionItems(): ItemList<{
|
||||||
|
label: Mithril.Children;
|
||||||
|
children: PermissionGridEntry[];
|
||||||
|
}>;
|
||||||
|
viewItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
startItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
replyItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
moderateItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
scopeControlItems(): ItemList<unknown>;
|
||||||
}
|
}
|
||||||
import PermissionGrid from "./PermissionGrid";
|
|
||||||
|
@@ -1,12 +1,36 @@
|
|||||||
export default class PermissionGrid extends Component<import("../../common/Component").ComponentAttrs, undefined> {
|
import Component, { ComponentAttrs } from '../../common/Component';
|
||||||
constructor();
|
import ItemList from '../../common/utils/ItemList';
|
||||||
permissionItems(): ItemList<any>;
|
import type Mithril from 'mithril';
|
||||||
viewItems(): ItemList<any>;
|
export interface PermissionConfig {
|
||||||
startItems(): ItemList<any>;
|
permission: string;
|
||||||
replyItems(): ItemList<any>;
|
icon: string;
|
||||||
moderateItems(): ItemList<any>;
|
label: Mithril.Children;
|
||||||
scopeItems(): ItemList<any>;
|
allowGuest?: boolean;
|
||||||
scopeControlItems(): ItemList<any>;
|
}
|
||||||
|
export interface PermissionSetting {
|
||||||
|
setting: () => Mithril.Children;
|
||||||
|
icon: string;
|
||||||
|
label: Mithril.Children;
|
||||||
|
}
|
||||||
|
export declare type PermissionGridEntry = PermissionConfig | PermissionSetting;
|
||||||
|
export declare type PermissionType = 'view' | 'start' | 'reply' | 'moderate';
|
||||||
|
export interface ScopeItem {
|
||||||
|
label: Mithril.Children;
|
||||||
|
render: (permission: PermissionGridEntry) => Mithril.Children;
|
||||||
|
onremove?: () => void;
|
||||||
|
}
|
||||||
|
export interface IPermissionGridAttrs extends ComponentAttrs {
|
||||||
|
}
|
||||||
|
export default class PermissionGrid<CustomAttrs extends IPermissionGridAttrs = IPermissionGridAttrs> extends Component<CustomAttrs> {
|
||||||
|
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
|
||||||
|
permissionItems(): ItemList<{
|
||||||
|
label: Mithril.Children;
|
||||||
|
children: PermissionGridEntry[];
|
||||||
|
}>;
|
||||||
|
viewItems(): ItemList<PermissionGridEntry>;
|
||||||
|
startItems(): ItemList<PermissionGridEntry>;
|
||||||
|
replyItems(): ItemList<PermissionGridEntry>;
|
||||||
|
moderateItems(): ItemList<PermissionGridEntry>;
|
||||||
|
scopeItems(): ItemList<ScopeItem>;
|
||||||
|
scopeControlItems(): ItemList<unknown>;
|
||||||
}
|
}
|
||||||
import Component from "../../common/Component";
|
|
||||||
import ItemList from "../../common/utils/ItemList";
|
|
||||||
|
@@ -6,5 +6,5 @@ import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage';
|
|||||||
*/
|
*/
|
||||||
export default class ExtensionPageResolver<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs, RouteArgs extends Record<string, unknown> = {}> extends DefaultResolver<Attrs, ExtensionPage<Attrs>, RouteArgs> {
|
export default class ExtensionPageResolver<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs, RouteArgs extends Record<string, unknown> = {}> extends DefaultResolver<Attrs, ExtensionPage<Attrs>, RouteArgs> {
|
||||||
static extension: string | null;
|
static extension: string | null;
|
||||||
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): any;
|
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): new () => ExtensionPage<Attrs>;
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,46 @@
|
|||||||
|
import type Mithril from 'mithril';
|
||||||
|
import ItemList from '../../common/utils/ItemList';
|
||||||
|
import { SettingsComponentOptions } from '../components/AdminPage';
|
||||||
|
import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage';
|
||||||
|
import { PermissionConfig, PermissionType } from '../components/PermissionGrid';
|
||||||
|
declare type SettingConfigInput = SettingsComponentOptions | (() => Mithril.Children);
|
||||||
|
declare type SettingConfigInternal = SettingsComponentOptions | ((() => Mithril.Children) & {
|
||||||
|
setting: string;
|
||||||
|
});
|
||||||
|
export declare type CustomExtensionPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs> = new () => ExtensionPage<Attrs>;
|
||||||
|
declare type ExtensionConfig = {
|
||||||
|
settings?: ItemList<SettingConfigInternal>;
|
||||||
|
permissions?: {
|
||||||
|
view?: ItemList<PermissionConfig>;
|
||||||
|
start?: ItemList<PermissionConfig>;
|
||||||
|
reply?: ItemList<PermissionConfig>;
|
||||||
|
moderate?: ItemList<PermissionConfig>;
|
||||||
|
};
|
||||||
|
page?: CustomExtensionPage;
|
||||||
|
};
|
||||||
|
declare type InnerDataNoActiveExtension = {
|
||||||
|
currentExtension: null;
|
||||||
|
data: {
|
||||||
|
[key: string]: ExtensionConfig | undefined;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
declare type InnerDataActiveExtension = {
|
||||||
|
currentExtension: string;
|
||||||
|
data: {
|
||||||
|
[key: string]: ExtensionConfig;
|
||||||
|
};
|
||||||
|
};
|
||||||
export default class ExtensionData {
|
export default class ExtensionData {
|
||||||
data: {};
|
protected state: InnerDataActiveExtension | InnerDataNoActiveExtension;
|
||||||
currentExtension: any;
|
|
||||||
/**
|
/**
|
||||||
* This function simply takes the extension id
|
* This function simply takes the extension id
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* app.extensionData.load('flarum-tags')
|
* app.extensionData.for('flarum-tags')
|
||||||
*
|
*
|
||||||
* flarum/flags -> flarum-flags | acme/extension -> acme-extension
|
* flarum/flags -> flarum-flags | acme/extension -> acme-extension
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
*/
|
||||||
for(extension: any): ExtensionData;
|
for(extension: string): this;
|
||||||
/**
|
/**
|
||||||
* This function registers your settings with Flarum
|
* This function registers your settings with Flarum
|
||||||
*
|
*
|
||||||
@@ -24,13 +53,8 @@ export default class ExtensionData {
|
|||||||
* type: 'text', // This will be inputted into the input tag for the setting (text/number/etc)
|
* type: 'text', // This will be inputted into the input tag for the setting (text/number/etc)
|
||||||
* label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')
|
* label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')
|
||||||
* }, 15) // priority is optional (ItemList)
|
* }, 15) // priority is optional (ItemList)
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param content
|
|
||||||
* @param priority
|
|
||||||
* @returns {ExtensionData}
|
|
||||||
*/
|
*/
|
||||||
registerSetting(content: any, priority?: number): ExtensionData;
|
registerSetting(content: SettingConfigInput, priority?: number): this;
|
||||||
/**
|
/**
|
||||||
* This function registers your permission with Flarum
|
* This function registers your permission with Flarum
|
||||||
*
|
*
|
||||||
@@ -41,58 +65,32 @@ export default class ExtensionData {
|
|||||||
* label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
|
* label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
|
||||||
* permission: 'discussion.viewFlags'
|
* permission: 'discussion.viewFlags'
|
||||||
* }, 'moderate', 65)
|
* }, 'moderate', 65)
|
||||||
*
|
|
||||||
* @param content
|
|
||||||
* @param permissionType
|
|
||||||
* @param priority
|
|
||||||
* @returns {ExtensionData}
|
|
||||||
*/
|
*/
|
||||||
registerPermission(content: any, permissionType?: null, priority?: number): ExtensionData;
|
registerPermission(content: PermissionConfig, permissionType: PermissionType, priority?: number): this;
|
||||||
/**
|
/**
|
||||||
* Replace the default extension page with a custom component.
|
* Replace the default extension page with a custom component.
|
||||||
* This component would typically extend ExtensionPage
|
* This component would typically extend ExtensionPage
|
||||||
*
|
|
||||||
* @param component
|
|
||||||
* @returns {ExtensionData}
|
|
||||||
*/
|
*/
|
||||||
registerPage(component: any): ExtensionData;
|
registerPage(component: CustomExtensionPage): this;
|
||||||
/**
|
/**
|
||||||
* Get an extension's registered settings
|
* Get an extension's registered settings
|
||||||
*
|
|
||||||
* @param extensionId
|
|
||||||
* @returns {boolean|*}
|
|
||||||
*/
|
*/
|
||||||
getSettings(extensionId: any): boolean | any;
|
getSettings(extensionId: string): SettingConfigInternal[] | undefined;
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Get an ItemList of all extensions' registered permissions
|
* Get an ItemList of all extensions' registered permissions
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @param type
|
|
||||||
* @returns {ItemList}
|
|
||||||
*/
|
*/
|
||||||
getAllExtensionPermissions(type: any): ItemList<any>;
|
getAllExtensionPermissions(type: PermissionType): ItemList<PermissionConfig>;
|
||||||
/**
|
/**
|
||||||
* Get a singular extension's registered permissions
|
* Get a singular extension's registered permissions
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @param type
|
|
||||||
* @returns {boolean|*}
|
|
||||||
*/
|
*/
|
||||||
getExtensionPermissions(extension: any, type: any): boolean | any;
|
getExtensionPermissions(extension: string, type: PermissionType): ItemList<PermissionConfig>;
|
||||||
/**
|
/**
|
||||||
* Checks whether a given extension has registered permissions.
|
* Checks whether a given extension has registered permissions.
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
*/
|
||||||
extensionHasPermissions(extension: any): boolean;
|
extensionHasPermissions(extension: string): boolean;
|
||||||
/**
|
/**
|
||||||
* Returns an extension's custom page component if it exists.
|
* Returns an extension's custom page component if it exists.
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @returns {boolean|*}
|
|
||||||
*/
|
*/
|
||||||
getPage(extension: any): boolean | any;
|
getPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs>(extension: string): CustomExtensionPage<Attrs> | undefined;
|
||||||
}
|
}
|
||||||
import ItemList from "../../common/utils/ItemList";
|
export {};
|
||||||
|
2
framework/core/js/dist/admin.js
generated
vendored
2
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
2
framework/core/js/dist/forum.js
generated
vendored
2
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
Reference in New Issue
Block a user