import { GridColumnAggregationTypes } from '../../../../enums/grid-column-aggregation-types'; import { Observable } from 'rxjs'; import { GeneralODataServiceInterface } from '../../../../models/general-odata-service.interface'; import { GridColumnInterface } from '../../../../models/grid-column.interface'; import { GridColumnFilterInterface } from '../../../../models/grid-column-filter.interface'; import { FararuDataGridValidatorInterface } from './fararu-data-grid.validations'; export type FararuDataGridColumnInterface = { [K in keyof T]: FararuDataGridDetailColumnInterface; }; export interface FararuDataGridDetailColumnInterface { title?: string; width?: string | number; listConfig?: { autoSize?: boolean; align?: 'left' | 'right' | 'center' | 'justify'; format?: '0' /** Decimal Format */ | 'n1' /** Number Format - Accuracy to 1 decimal place - trailing zero*/ | 'n2' /** Number Format - Accuracy to 2 decimal place - trailing zero */ | 'n3' /** Number Format - Accuracy to 3 decimal place - trailing zero */ | 'n4' /** Number Format - Accuracy to 4 decimal place - trailing zero */ | 'g1' /** Number Format - Accuracy to 1 decimal place - No trailing zero - Without thousand delimiter*/ | 'g2' /** Number Format - Accuracy to 2 decimal place - No trailing zero - Without thousand delimiter*/ | 'g3' /** Number Format - Accuracy to 3 decimal place - No trailing zero - Without thousand delimiter*/ | 'g4' /** Number Format - Accuracy to 4 decimal place - No trailing zero - Without thousand delimiter*/ | 'G1' /** Number Format - Accuracy to 1 decimal place - No trailing zero */ | 'G2' /** Number Format - Accuracy to 2 decimal place - No trailing zero */ | 'G3' /** Number Format - Accuracy to 3 decimal place - No trailing zero */ | 'G4' /** Number Format - Accuracy to 4 decimal place - No trailing zero */ | 'p' /** Percentage Format */ | 'c2' /** Currency Format */ | 'd' /** Short Date */ | 'D' /** Long Date */ | 'f' /** Full Date/TIme (short time) */ | 'F' /** Full Date/TIme (long time) */ | (string & {}); isReadOnly?: boolean; aggregate?: GridColumnAggregationTypes; visible?: boolean; }; formConfig?: GridFieldConfigInterface; } export type GridFieldDepency = { setup: (currentValues: T, previousValues: T, userChanged: boolean) => P | Promise

; dependencies: (keyof T)[]; }; export type GridConfigDepency = { setup: (currentValues: T, previousValues: T, config: P, userChanged: boolean) => P | undefined | Promise

; dependencies: (keyof T)[]; }; type HiddenFieldType = { type: 'hiddenField'; }; type PropType = { type: 'prop'; ref: keyof T; }; type TextboxType = { type: 'textbox'; maxlength?: number; inputType?: 'currency' | 'number' | 'tel' | 'time' | 'email' | 'password' | 'url' | 'text' | (string & {}); mask?: string; direction?: 'ltr' | 'rtl'; dynamicConfig?: GridConfigDepency, NoDynamicConfigType>>; decimal?: number; }; type SelectType = { type: 'select'; selectConfig?: SelectConfigInterface; dynamicConfig?: GridConfigDepency, NoDynamicConfigType>>; options?: any[]; }; type CheckboxType = { type: 'checkbox'; checkBoxConfig?: CheckBoxConfigInterface; dynamicConfig?: GridConfigDepency, NoDynamicConfigType>>; beforeChangeCallback?: (next: boolean) => boolean | Promise; }; type IdentitySelectorType = { type: 'identity-selector'; identitySelectorConfig: IndentiySelectorConfigInterface; dynamicConfig?: GridConfigDepency, NoDynamicConfigType>>; beforeChangeCallback?: (selectedItem: any, previousSelectedItem?: any) => boolean | Promise; }; type TreeSelectType = { type: 'tree'; treeConfig?: TreeConfigInterface; dynamicConfig?: GridConfigDepency, NoDynamicConfigType>>; }; interface SelectConfigInterface { multiple?: boolean; oDataService?: GeneralODataServiceInterface; oDataEntity?: string; bindValue?: string; bindLabel?: string; isLoaded?: boolean; isLoading?: boolean; oDataServer?: string; oDataTable?: string; oDataHttpHeaders?: { [key: string]: string; }; allowClear?: boolean; } interface TreeConfigInterface { multiple?: boolean; bindValue?: string; bindLabel?: string; bindItems?: string; data: any[]; allowClear?: boolean; } interface IndentiySelectorConfigInterface { valueData?: any; valueDataBinding?: (currentValues: T) => Object; inputField: string; secondInputField?: string; resultField: string; displayField?: string; gridFields?: GridColumnInterface[]; oDataService?: GeneralODataServiceInterface; oDataServer?: string; oDataTable?: string; oDataEntity?: string; hasCrudOrigin?: boolean; oDataHttpHeaders?: { [key: string]: string; }; oDataFilters?: GridColumnFilterInterface[]; allowClear?: boolean; } interface CheckBoxConfigInterface { bindNumberValue: boolean; } export type GridGeneralFieldConfig = { autoFocus?: boolean; placeholder?: string; validators?: FararuDataGridValidatorInterface[]; order?: number; tooltip?: string; defaultValue?: P; value$?: Observable

; value?: GridFieldDepency; hidden?: boolean | GridFieldDepency; disabled?: boolean | GridFieldDepency; readonly?: boolean | GridFieldDepency; }; export type GridLookupFieldConfig = GridGeneralFieldConfig & IdentitySelectorType; export type GridSelectFieldConfig = GridGeneralFieldConfig & SelectType; export type GridCheckboxFieldConfig = GridGeneralFieldConfig & CheckboxType; export type GridTreeFieldConfig = GridGeneralFieldConfig & TreeSelectType; export type GridHiddenFieldConfig = GridGeneralFieldConfig & HiddenFieldType; export type GridTextFieldConfig = GridGeneralFieldConfig & TextboxType; export type GridPropFieldConfig = GridGeneralFieldConfig & PropType; export type GridFieldConfigInterface = GridLookupFieldConfig | GridSelectFieldConfig | GridCheckboxFieldConfig | GridTreeFieldConfig | GridHiddenFieldConfig | GridTextFieldConfig | GridPropFieldConfig; type NoDynamicConfigType = 'dynamicConfig' | 'defaultValue' | 'type'; export {};