@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
183 lines • 4.93 kB
TypeScript
import { DashboardChildComponent } from './dashboard-child.component';
import { DashboardComponent } from './dashboard.component';
/**
* Describes a legacy widget. Please use
* the proper Widget interface instead.
*/
export interface LegacyWidget {
/**
* The name of the widget.
* @deprecated Use componenId
*/
name?: string;
/**
* The template URL for legacy plugins.
* @deprecated: Only used for angularjs plugins.
*/
templateUrl?: string;
/**
* The config template URL for legacy plugins.
* @deprecated: Only used for angularjs plugins.
*/
configTemplateUrl?: string;
/**
* The config component name.
* @deprecated: Only used for angularjs plugins.
*/
configComponent?: string;
/**
* The widget component name.
* @deprecated: Only used for angularjs plugins.
*/
widgetComponent?: string;
transformConfigWithContext?: () => void;
}
/**
* A widget is a child on a dashboard which can be added and configured
* by the user. A widget can be defined by the [[DynamicComponentDefinition]]
* by any module of an application. Thew widget itself stores beside it's
* link (componentId) to the DynamicComponentDefinition the information
* about the title, layout (classes) and the configuration.
*/
export interface Widget extends LegacyWidget {
/**
* x dimension parameters
*/
_x?: number;
/**
* y dimension parameters
*/
_y?: number;
/**
* width dimension parameters
*/
_width?: number;
/**
* height dimension parameters
*/
_height?: number;
/**
* The unique component id to find the component in the
* HOOK_COMPONENTS dynamic-component implementation.
*/
componentId: string;
/**
* A random key for saving it to the object.
*/
id: string;
/**
* The current configuration of the widget.
*/
config: any;
/**
* The current title of the widget.
*/
title?: string;
/**
* Which classes should be added.
*/
classes?: {
[key: string]: boolean;
};
}
/**
* Is used to configure a widget dashboard. It allows
* to set certain parameter that change the behavior
* of the dashboard.
*/
export interface DashboardSettings {
/**
* If the dashboard is frozen, the user can't edit it any more.
* However he can delete it and change the frozen state.
*/
isFrozen: boolean;
/**
* If the dashboard is disabled, no changes on this dashboard are allowed.
* E.g. because the user doesn't have the rights.
*/
isDisabled: boolean;
/**
* The gap between each widget as pixel
*/
widgetMargin: number;
/**
* Should the application check if a translation is present for the
* widget title.
*/
translateWidgetTitle: boolean;
/**
* New added widgets get that height attached (in css grid columns units)
*/
defaultHeight: number;
/**
* New added widgets get that width attached (in css grid row units)
*/
defaultWidth: number;
/**
* Should the user be able to switch to fullscreen mode.
*/
allowFullscreen: boolean;
/**
* A global title that is used for this dashboard.
*/
title?: string;
/**
* If set to false, the dashboard can not be copied (default true).
*/
canCopy?: boolean;
/**
* If set to false, the dashboard can not be removed (default true).
*/
canDelete?: boolean;
/**
* Indicates that the dashboard is loading.
*/
isLoading?: boolean;
/**
* The amount of columns on that dashboard.
* Can be freely chosen, but product uses either 12 or 24.
*/
columns?: number;
}
export interface DashboardChildDimension {
x?: number;
y?: number;
width: number;
height: number;
}
export interface DashboardChildResizeDimension {
pointer: {
x: number;
y: number;
};
width: number;
height: number;
}
export interface DashboardChildArrangement {
current: DashboardChildDimension;
scan: DashboardChildComponent[];
spacing: number;
origin: DashboardChildDimension;
}
export interface DashboardChange {
source: DashboardChildComponent;
children: DashboardChildComponent[];
}
export interface WidgetChange {
widget: Widget;
dashboard: DashboardComponent;
source: DashboardChildComponent;
}
export declare const CopyDashboardDisabledReason: {
readonly PERMISSIONS: "PERMISSIONS";
readonly WRONG_REFERENCE: "WRONG_REFERENCE";
};
export type DashboardCopyPermission = {
state: true;
reason?: never;
} | {
state: false;
reason: (typeof CopyDashboardDisabledReason)[keyof typeof CopyDashboardDisabledReason];
};
export declare const NEW_DASHBOARD_ROUTER_STATE_PROP = "newDashboard";
//# sourceMappingURL=dashboard.model.d.ts.map