64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
|
|
/**
|
||
|
|
* Common virtual-scrolling grid (api/virtualGrid) — matches HRM.BO/VirtualGrid/VirtualGrid.cs.
|
||
|
|
* Screens use <app-virtual-grid gridKey="..."> (custom-components/virtual-grid) rather than these directly.
|
||
|
|
*/
|
||
|
|
|
||
|
|
/** EnumVirtualGridColumnType on the server. */
|
||
|
|
export enum EnumVirtualGridColumnType {
|
||
|
|
Text = 1,
|
||
|
|
Number = 2,
|
||
|
|
Money = 3,
|
||
|
|
Date = 4,
|
||
|
|
DateTime = 5
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface VirtualGridColumnInfo {
|
||
|
|
field: string;
|
||
|
|
title: string;
|
||
|
|
width: number;
|
||
|
|
type: EnumVirtualGridColumnType;
|
||
|
|
sortable: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface VirtualGridLayout {
|
||
|
|
gridKey: string;
|
||
|
|
title: string;
|
||
|
|
defaultSortField: string;
|
||
|
|
defaultSortDir: 'asc' | 'desc';
|
||
|
|
maxPageSize: number;
|
||
|
|
columns: VirtualGridColumnInfo[];
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Screen-specific filters, e.g. { fromDate: '2025-01-01', toDate: '2025-12-31' }. Dates as 'yyyy-MM-dd'. */
|
||
|
|
export type VirtualGridFilters = { [name: string]: string };
|
||
|
|
|
||
|
|
export interface VirtualGridRequest {
|
||
|
|
gridKey: string;
|
||
|
|
filters: VirtualGridFilters;
|
||
|
|
skip: number;
|
||
|
|
take: number;
|
||
|
|
search?: string;
|
||
|
|
sortField?: string;
|
||
|
|
sortDir?: 'asc' | 'desc';
|
||
|
|
/** True on Preview: reload the data instead of using the copy the server keeps for scrolling. */
|
||
|
|
refresh?: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface VirtualGridExportRequest extends VirtualGridRequest {
|
||
|
|
fields: string[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface VirtualGridPage {
|
||
|
|
total: number;
|
||
|
|
totalWithoutSearch: number;
|
||
|
|
data: { [field: string]: any }[];
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Emitted by <app-virtual-grid> after every window it loads. */
|
||
|
|
export interface VirtualGridLoadedEvent {
|
||
|
|
total: number;
|
||
|
|
totalWithoutSearch: number;
|
||
|
|
/** True for the first window after load(filters). */
|
||
|
|
firstLoad: boolean;
|
||
|
|
}
|