export enum DisplayType { treetable = 'treetable', datagrid = 'datagrid' } export const isValidDisplayType = (displayType: string) => { if (displayType === DisplayType.datagrid || displayType === DisplayType.treetable) { return true; } return false; }; export interface ShowOptions { displayType: DisplayType; columns: any[]; items: any[]; idField: string; //#region for dialog width?: number; height?: number; title?: string; showButtons?: boolean; showCloseButton?: boolean; showMaxButton?: boolean; resizable?: boolean; draggable?: boolean; buttons?: any[], //#endregion disabled?: boolean; multi?: boolean; showFilterBar?: boolean; fit?: boolean; showHeader?: boolean; showBorder?: boolean; fitColumns?: boolean; showCheckbox?: boolean; showCheckAll?: boolean; striped?: boolean; virtualized?: boolean; sortName?: string; sortOrder?: 'asc' | 'desc'; editable?: boolean; keepSelect?: boolean; onCancel?: () => void; onConfirm?: (event: { id: string, ids: string[], items: any[], item: any }) => void; } export const isValidOptions = (options: ShowOptions) => { if (!options) { return false; } if (!options.displayType) { return false; } if (!isValidDisplayType(options.displayType)) { return false; } if (!options.columns || options.columns.length < 1) { return false; } return true; }; export const PRIMARY_KEY = '__ID__';