HRM-10/HRM.UI/ClientApp/src/app/_models/common/virtual-grid.ts

44 lines
1.4 KiB
TypeScript
Raw Normal View History

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