HRM-10/HRM.UI/ClientApp/src/app/_models/common/virtual-grid.ts
2026-11-09 14:54:13 +06:00

44 lines
1.4 KiB
TypeScript

/**
* <app-virtual-grid> (custom-components/virtual-grid) and its server side
* (HRM.BO/VirtualPaging/VirtualPaging.cs, HRM.DA/Service/VirtualPaging/VirtualPaging.cs).
*/
/** How a column's values are shown (and exported to Excel). */
export type VirtualGridColumnType = 'text' | 'number' | 'money' | 'date' | 'datetime';
/** One grid column. field = the property name of the server object, camelCase. */
export interface VirtualGridColumn {
field: string;
title: string;
width?: number;
type?: VirtualGridColumnType; // default 'text'
sortable?: boolean; // default true
}
/** What the grid posts to the page endpoint (VirtualPageRequest on the server). */
export interface VirtualPageRequest {
filters: { [name: string]: string };
fields: string[];
skip: number;
take: number; // 0 = all rows (Export to Excel)
search?: string;
sortField?: string;
sortDir?: 'asc' | 'desc';
refresh: boolean; // true on Preview
}
/** What the page endpoint returns (VirtualPageResult on the server). */
export interface VirtualPageResult {
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;
}