import { ValidatorFn } from '@angular/forms'; import { IdentitySelectorComponentPropsInterface } from '../design-systems/ui/indentity-selector/identity-selector.component'; import { SelectComponentPropsInterface } from '../design-systems/ui/select/select.component'; import { TextboxComponentPropsInterface } from '../design-systems/ui/textbox/textbox.component'; import { CheckboxComponentPropsInterface } from '../design-systems/ui/checkbox/checkbox.component'; import { DataGridComponent } from '../design-systems/components/organisms/data-grid/data-grid.component'; import { TextboxCurrencyConfigInterface } from './textbox-currency-config.interface'; import { DropdownTextInputOptionInterface } from '../design-systems/components/molecules/dropdown-text-input/dropdown-text-input.component'; import { GridColumnAggregationTypes } from '../enums/grid-column-aggregation-types'; import { IconNameType } from '../types/icon-name.type'; import { TreeSelectComponentInterface } from '../design-systems/ui/tree-select/tree-select.component'; interface CallbackParamsInterface { value: any; row: RowType; instance: DataGridComponent; } export type DynamicPropertyType = DynamicPropertyType | ((params: CallbackParamsInterface) => DynamicPropertyType) | ((params: CallbackParamsInterface) => Promise); export interface ChangeCallbackParamsInterface extends CallbackParamsInterface { selectedItem?: any | null; } export interface DataGridEditConfigValidatorInterface { type: ValidatorFn; message?: string; } export interface EnterCallbackParamsInterface extends CallbackParamsInterface { } export interface TabCallbackParamsInterface extends CallbackParamsInterface { event: KeyboardEvent; } type HiddenFieldType = { type: 'hiddenField'; }; type LabelType = { type: 'label'; }; type ButtonType = { type: 'button'; config: DataGridButtonColumnConfig; }; type TextboxType = { type: 'textbox'; config?: Omit & { currencyConfig?: DynamicPropertyType; }; }; type SelectType = { type: 'select'; config: Omit & { options: DynamicPropertyType; }; }; type DropdownTextBoxType = { type: 'dropdown-textbox'; config: Omit & { currencyConfig?: DynamicPropertyType; } & Omit & { options: DynamicPropertyType; defaultDropdownValue?: string; }; }; type CheckboxType = { type: 'checkbox'; config?: Omit; }; type IdentitySelectorType = { type: 'identity-selector'; config: Omit & Required> & { oDataHttpHeaders: DynamicPropertyType<{ [key: string]: string; }>; }; }; type TreeSelectType = { type: 'tree-select'; config?: Omit & { data: DynamicPropertyType; }; }; export type DataGridEditConfig = { validators?: DynamicPropertyType; isUnique?: boolean; disabled?: DynamicPropertyType; disabledReason?: string; defaultValue?: any; beforeChange?: { canChange: DynamicPropertyType; errorMessage?: string | DynamicPropertyType; }; changeCallback?: (params: ChangeCallbackParamsInterface) => void; enterCallback?: ((params: EnterCallbackParamsInterface) => boolean) | ((params: EnterCallbackParamsInterface) => Promise); tabCallback?: (params: TabCallbackParamsInterface) => boolean | void; } & (HiddenFieldType | LabelType | ButtonType | TextboxType | SelectType | CheckboxType | IdentitySelectorType | DropdownTextBoxType | TreeSelectType); export type DataGridStyleType = 'color' | 'back' | 'both'; export type DataGridColorType = 'success' | 'error' | 'warning'; export type DataGridNumberColumnConfig = { base?: number; style?: DataGridStyleType; }; export type DataGridButtonColumnConfig = (value: any) => { icon?: IconNameType; text: string; onClick?: () => void; }; export interface DataGridColumnInterface { title?: string; binding: string | undefined; displayBindingFields?: [string, string?]; width?: string; aggregate?: { type: GridColumnAggregationTypes; value?: number; label?: string; }; editConfig?: DataGridEditConfig; numberConfig?: { hasHightStyles?: DataGridNumberColumnConfig | boolean; hasLowStyles?: DataGridNumberColumnConfig | boolean; }; color?: { name: DataGridColorType; style: DataGridStyleType; } | DataGridColorType; } export {};