TeaSpeak-Client/imports/shared-app/ui/modal/permission/PermissionEditor.d.ts
2021-02-07 20:01:37 +01:00

119 lines
3.1 KiB
TypeScript

import * as React from "react";
import { Registry } from "tc-shared/events";
import { ConnectionHandler } from "tc-shared/ConnectionHandler";
export interface EditorGroupedPermissions {
groupId: string;
groupName: string;
permissions: {
id: number;
name: string;
description: string;
}[];
children: EditorGroupedPermissions[];
}
declare type PermissionEditorMode = "unset" | "no-permissions" | "normal";
export interface PermissionEditorEvents {
action_set_mode: {
mode: PermissionEditorMode;
failedPermission?: string;
};
action_toggle_client_button: {
visible: boolean;
};
action_toggle_client_list: {
visible: boolean;
};
action_set_filter: {
filter?: string;
};
action_set_assigned_only: {
value: boolean;
};
action_set_default_value: {
value: number;
};
action_open_icon_select: {
iconId?: number;
};
action_set_senseless_permissions: {
permissions: string[];
};
action_remove_permissions: {
permissions: {
name: string;
mode: "value" | "grant";
}[];
};
action_remove_permissions_result: {
permissions: {
name: string;
mode: "value" | "grant";
success: boolean;
}[];
};
action_set_permissions: {
permissions: {
name: string;
mode: "value" | "grant";
value?: number;
flagNegate?: boolean;
flagSkip?: boolean;
}[];
};
action_set_permissions_result: {
permissions: {
name: string;
mode: "value" | "grant";
newValue?: number;
flagNegate?: boolean;
flagSkip?: boolean;
}[];
};
action_toggle_group: {
groupId: string | null;
collapsed: boolean;
};
action_start_permission_edit: {
target: "value" | "grant";
permission: string;
defaultValue: number;
};
action_add_permission_group: {
groupId: string;
mode: "value" | "grant";
};
action_remove_permission_group: {
groupId: string;
mode: "value" | "grant";
};
query_permission_list: {};
query_permission_list_result: {
hideSenselessPermissions: boolean;
permissions: EditorGroupedPermissions[];
};
query_permission_values: {};
query_permission_values_result: {
status: "error" | "success";
error?: string;
permissions?: {
name: string;
value?: number;
flagNegate?: boolean;
flagSkip?: boolean;
granted?: number;
}[];
};
}
interface PermissionEditorProperties {
connection: ConnectionHandler;
events: Registry<PermissionEditorEvents>;
}
interface PermissionEditorState {
state: "no-permissions" | "unset" | "normal";
}
export declare class PermissionEditor extends React.Component<PermissionEditorProperties, PermissionEditorState> {
render(): JSX.Element[];
componentDidMount(): void;
}
export {};