mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 09:03:36 +08:00
34e0ab6100
Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci]
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import Component, { ComponentAttrs } from '../../common/Component';
|
|
import ItemList from '../../common/utils/ItemList';
|
|
import type Mithril from 'mithril';
|
|
export interface PermissionConfig {
|
|
permission: string;
|
|
icon: string;
|
|
label: Mithril.Children;
|
|
allowGuest?: boolean;
|
|
}
|
|
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>;
|
|
}
|