UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

75 lines 2.42 kB
import { Injector, Type } from '@angular/core'; import { ExtensionFactory } from '../common/extension-hooks'; import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons'; /** * An action is a global operation which you can * add to the plus sign in the upper right corner * or any custom component added to the header. */ export type Action = ActionWithLabelAndFunction | ActionWithTemplate | ActionWithComponent; interface ActionBase { /** * Ordering of the actions (high number first) (optional) */ priority?: number; /** * Is that action disabled. */ disabled?: boolean; /** * The injector to use. If not set, the default root injector will be used. */ injector?: Injector; } export interface ActionWithLabelAndFunction extends ActionBase { /** * The label of the action, [[ActionWithLabelAndFunction]] actions are combined in a "add"-button dropdown. */ label: string; /** * Which action to trigger on click */ action: (...args: any[]) => void; /** * The icon to show on this action (optional) */ icon?: SupportedIconsSuggestions; template?: never; component?: never; } export interface ActionWithTemplate extends ActionBase { /** * A template that should be rendered as the action. [[ActionWithTemplate]] actions * are combined in a "add"-button dropdown. * Note: As a Action is rendered in a <li> it is good practice * to remove the wrapper node to not run into CSS issues. You * can do so by defining the selector as a li: `li[customExtension]` * (see: https://stackoverflow.com/a/56887630/923270 or * https://stackoverflow.com/a/38716164/923270) */ template: any; /** * The icon to show on this action (optional) */ icon?: SupportedIconsSuggestions; label?: never; action?: never; component?: never; } export interface ActionWithComponent extends ActionBase { /** * A component that should be rendered as the action. This component would be shown * directly in the header bar. */ component: Type<any>; template?: never; label?: never; action?: never; icon?: never; } /** * Factory to implement if used in a hook for Multi Provider extension. */ export type ActionFactory = ExtensionFactory<Action>; export {}; //# sourceMappingURL=action.model.d.ts.map