@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
225 lines (217 loc) • 9.98 kB
TypeScript
import * as i0 from '@angular/core';
import { OnInit, OnDestroy, TemplateRef, EventEmitter } from '@angular/core';
import { IIdentified, QueriesUtil, IManagedObject } from '@c8y/client';
import { ColumnConfig, IconConfigItem, ComputedConfig, AssetColumnOperationType, CustomColumn, CustomColumnType, DisplayOptions, WidgetDisplaySettings, BaseColumn, WidgetSettings, AssetTableExtendedColumn, ServerSideDataCallback, DataSourceModifier, ServerSideDataResult, Column, Pagination } from '@c8y/ngx-components';
import { BehaviorSubject } from 'rxjs';
import { AssetPropertyType } from '@c8y/ngx-components/asset-properties';
import { CdkDragDrop } from '@angular/cdk/drag-drop';
import { BsDropdownDirective } from 'ngx-bootstrap/dropdown';
declare class DefaultAssetTableGridColumn extends CustomColumnExtended {
constructor(initialColumnConfig?: CustomColumnConfigExtended);
}
declare class OperationAssetTableGridColumn extends BaseColumnExtended {
constructor(initialColumnConfig?: ColumnConfigExtended);
}
interface AssetTableWidgetConfig {
columnSortOrders?: Record<string, 'asc' | 'desc' | ''>;
columns?: DefaultAssetTableGridColumn[];
configurableColumnsEnabled?: boolean;
device?: IIdentified;
displayOptions?: Partial<DisplayOptions>;
displaySettings?: WidgetDisplaySettings;
filterPredicate?: Record<string, any>;
isAutoRefreshEnabled?: boolean;
operationColumns?: OperationAssetTableGridColumn[];
refreshInterval?: number;
options?: any;
refreshOption?: AssetTableRefreshOption;
includeDescendants?: boolean;
selectedProperties?: AssetPropertyType[];
showAsLink?: boolean;
showStatusIcon?: boolean;
showIconAndValue?: boolean;
settings?: WidgetSettings;
title?: string;
columnOrder?: AssetTableExtendedColumn[];
isDeviceAssetSelected?: boolean;
widgetInstanceGlobalAutoRefreshContext?: boolean;
widgetInstanceGlobalTimeContext?: boolean;
}
type AssetTableRefreshOption = 'interval' | 'global-interval';
type AssetColumnType = 'alarm' | 'date' | 'icon' | 'computed' | 'default' | 'operation';
declare class BaseColumnExtended extends BaseColumn {
iconConfig?: Array<IconConfigItem>;
isLink?: boolean;
command?: object;
isOperation?: boolean;
operationType?: AssetColumnOperationType;
computedConfig?: ComputedConfig;
showIconAndValue?: boolean;
buttonLabel?: string;
type?: AssetColumnType;
}
declare class CustomColumnExtended extends CustomColumn {
iconConfig?: Array<IconConfigItem>;
isLink?: boolean;
command?: object;
isOperation?: boolean;
operationType?: AssetColumnOperationType;
computedConfig?: ComputedConfig;
showIconAndValue?: boolean;
columnOrder?: [];
}
interface ColumnConfigExtended extends ColumnConfig {
/** Column header title */
header?: string;
/** The path in a row item to read the cell value from. */
path?: string;
/**
* Icon configuration for the column when renderType is 'icon'.
*/
iconConfig?: Array<IconConfigItem>;
/** Configuration for computed column */
computedConfig?: ComputedConfig;
/** Whether the column is a link. */
isLink?: boolean;
/** The column operationType. E.g. 'maintenance' */
operationType?: AssetColumnOperationType;
/** Command to be executed */
command?: any;
/** Whether to show both icon and value in the cell */
showIconAndValue?: boolean;
/** Button label for operation columns */
buttonLabel?: string;
/** e.g. 'Restart Device', 'Firmware Update', 'Send Command' */
operation?: string;
}
interface CustomColumnConfigExtended extends ColumnConfigExtended {
/** JSON path to the managed object property to be displayed */
path: string;
/** Column header title */
header: string;
/** Flag to identify custom columns */
custom: boolean;
/** Column type of the custom column*/
type: CustomColumnType;
}
declare class AssetTableWidgetConfigComponent implements OnInit, OnDestroy {
set previewMapSet(template: TemplateRef<any>);
readonly GLOBAL_INTERVAL_OPTION: AssetTableRefreshOption;
readonly REFRESH_INTERVAL_IN_MILLISECONDS: number[];
title: "Asset table";
columns: AssetTableExtendedColumn[];
selectedAssets: AssetPropertyType[];
serverSideDataCallback: ServerSideDataCallback;
refresh: EventEmitter<void>;
formGroup: ReturnType<AssetTableWidgetConfigComponent['createForm']>;
/**
* Current isLoading state. Based on it next countdown cycle is being started.
*/
isLoading$: BehaviorSubject<boolean>;
refreshOption: AssetTableRefreshOption;
config: AssetTableWidgetConfig;
includeDescendantsTooltip: "When enabled, all assets in the hierarchy under the selected asset will be included. When disabled, only the direct child assets will be included.";
private initializedContext;
protected queriesUtil: QueriesUtil;
private destroy$;
private readonly formBuilder;
private readonly assetTableService;
private readonly widgetGlobalAutoRefresh;
private readonly alertService;
private readonly widgetConfigService;
private readonly contextDashboardService;
constructor();
ngOnInit(): void;
ngOnDestroy(): void;
/**
* This method loads data when data grid requests it (e.g. on initial load or on column settings change).
* It gets the object with current data grid setup and is supposed to return:
* full response, list of items, paging object, the number of items in the filtered subset, the number of all items.
*/
onDataSourceModifier(dataSourceModifier: DataSourceModifier): Promise<ServerSideDataResult>;
updateSelectedAssets(): Promise<void>;
updateRefreshOption(): void;
private getColumns;
private handleGlobalRefreshLoading;
private updateConfigBasedOnRefreshOption;
private updateFormDisabledState;
private setupGridHeaderFilterDependency;
private initializeForm;
private createForm;
static ɵfac: i0.ɵɵFactoryDeclaration<AssetTableWidgetConfigComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AssetTableWidgetConfigComponent, "c8y-asset-table-widget-config", never, {}, {}, never, never, true, never>;
}
declare class AssetTableWidgetViewComponent implements OnInit, OnDestroy {
config: AssetTableWidgetConfig;
/**
* Current isLoading state. Based on it next countdown cycle is being started.
*/
isLoading$: BehaviorSubject<boolean>;
selectedAssets: any[];
columns: Column[];
refresh: EventEmitter<any>;
serverSideDataCallback: ServerSideDataCallback;
pagination: Pagination;
private destroy$;
private readonly widgetGlobalAutoRefresh;
private readonly assetTableService;
private readonly alertService;
constructor();
ngOnInit(): Promise<void>;
ngOnDestroy(): void;
/**
* This method loads data when data grid requests it (e.g. on initial load or on column settings change).
* It gets the object with current data grid setup and is supposed to return:
* full response, list of items, paging object, the number of items in the filtered subset, the number of all items.
*/
onDataSourceModifier(dataSourceModifier: DataSourceModifier): Promise<ServerSideDataResult>;
updateSelectedAssets(): void;
private handleGlobalRefreshLoading;
static ɵfac: i0.ɵɵFactoryDeclaration<AssetTableWidgetViewComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AssetTableWidgetViewComponent, "c8y-asset-table-widget-view", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}
declare class AssetTableGridSettingsComponent implements OnInit, OnDestroy {
contextAsset: IManagedObject;
columns: AssetTableExtendedColumn[];
selectedProperties: AssetPropertyType[];
extraProperties: AssetPropertyType[];
operationColumns: ColumnConfigExtended[];
text: string;
existingColumnFilter: {
[key: string]: any;
};
hasMaintenanceColumn: boolean;
customHeaderNames: Record<string, string>;
customLabel: "(custom`column`)";
private readonly widgetConfigService;
private readonly assetTableService;
private readonly bottomDrawerService;
private readonly inventoryService;
private readonly modalService;
private readonly operationPickerService;
private readonly destroy$;
ngOnInit(): void;
ngOnDestroy(): void;
applyColumnType(type: AssetColumnType, column: AssetTableExtendedColumn): Promise<void>;
onColumnDrop(event: CdkDragDrop<AssetTableExtendedColumn[]>): void;
toggleColumnVisibility(column: AssetTableExtendedColumn): void;
applyFilter(column: AssetTableExtendedColumn, dropdown: BsDropdownDirective): void;
resetFilter(column: AssetTableExtendedColumn, dropdown: BsDropdownDirective): void;
isColumnFiltered(column: AssetTableExtendedColumn): boolean;
updateColumnNames(column: AssetTableExtendedColumn): void;
changeSortOrder(column: AssetTableExtendedColumn): void;
onCreateOperation(): Promise<void>;
onToggleMaintenanceMode(): Promise<void>;
editOperationColumn(column: AssetTableExtendedColumn): Promise<void>;
deleteColumn(column: AssetTableExtendedColumn): void;
trackByColumnName(_index: number, column: AssetTableExtendedColumn): string;
selectAssetAndProperty(): Promise<void>;
selectProperties(selectedProperties: AssetPropertyType[]): void;
private applyCustomHeaderNames;
private operationModal;
private getColumns;
static ɵfac: i0.ɵɵFactoryDeclaration<AssetTableGridSettingsComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AssetTableGridSettingsComponent, "c8y-asset-table-column-settings", never, {}, {}, never, never, true, never>;
}
export { AssetTableGridSettingsComponent, AssetTableWidgetConfigComponent, AssetTableWidgetViewComponent };
//# sourceMappingURL=index.d.ts.map