import { GroupedSelectItem, SelectColor, SelectItem } from '@sowatech/shared/@types'; import { DatasourceComponent } from '@sowatech/shared/ds-datasource'; import { IQuillConfiguration, QuillToolbarDefaultType, IQuillToolbarConfiguration, ColorPickerConfiguration } from '@sowatech/shared/swt-controls'; import { QuillModules } from 'ngx-quill'; import { GridConfiguration } from '../swt-grid/swt-grid-configuration'; /**key for dynamic lookups, which are provided during dialog.show as a dictionary[lookupsKey,Array]*/ export type lookupsKey = string; export type Lookups = Array | Array; export type FieldType = 'text' | 'number' | 'date' | 'dateInterval' | 'boolean' | 'textarea' | 'password' | 'password-with-confirm' | 'email' | 'tel' | 'divider' | 'buttons' | 'info-text' | 'time' | 'lru' | 'hidden' | 'color-select' | 'money'; /**the type of control. in most cases this is equal to type of field but can differ (e.g. controltype "select")*/ export type ControlType = 'text' | 'number' | 'date' | 'dateInterval' | 'dateInput' | 'checkbox' | 'textarea' | 'password' | 'password-with-confirm' | 'email' | 'tel' | 'select' | 'divider' | 'buttons' | 'grid' | 'info-text' | 'time' | 'dropdown-grid' | 'hidden' | 'rich-text' | 'color-picker'; /**this class is used to configure the dialog*/ export declare class DialogField { fieldname?: Extract; type?: FieldType; /** Nicht manuell setzen! * wird intern aus type, controlTypeVariant, und vorhandenen lookups ermittelt. Im Regelfall identisch zu type * */ controlType?: ControlType; /** wenn abweichend vom standard zb bei datePicker / dateInput */ controlTypeVariant?: 'input'; text?: string; unit?: string; placeholder?: string; help?: string; required?: boolean; /** Zweiter Feldname bei mehrteiligen Inputs wie z.B. dateInterval*/ fieldname2?: Extract; /** Zweiter Text bei mehrteiligen Inputs wie z.B. dateInterval*/ text2?: string; /** Zweiter Hilfetext bei mehrteiligen Inputs wie z.B. dateInterval*/ help2?: string; /** Zweites Required bei mehrteiligen Inputs wie z.B. dateInterval*/ required2?: boolean; maxLength?: number; default?: any; trueValueText?: string; falseValueText?: string; min?: number; max?: number; showSpinnerButtons?: boolean; calendarWeekVisible?: boolean; lookUps?: Lookups | Array | lookupsKey; onLookUp?: (lookupItems: Array, editItem: DTO) => Array; onChange?: (editItem: any, previousValue: any) => void; multiSelectLookups?: boolean; radioLookups?: boolean; /** multi-lru async SelectItem loading */ lookUpSearchFn?: (term: string) => Promise; /** text for empty lookup */ addEmptyLookup?: string; /** Felder mit abhängigen selects => leert Value und cached lookUps des fieldnames beim change */ dependentSelectFieldnames?: Array>; fieldnamePasswordConfirm?: Extract; autofocus?: boolean; hideIf?: (editItem: any) => boolean; buttons?: Array; grid?: DialogGridConfiguration; textMask?: TextMaskConfig; richText?: RichTextConfiguration; colorPicker?: ColorPickerConfiguration; zIndex?: number; /**optional: direktes setzen eines style im Eingabe-Control */ controlStyle?: string; /** internal*/ hasError?: boolean; cssClass?: string; } export declare class TextMaskConfig { mask?: string; showMaskTyped?: boolean; patterns?: { [character: string]: { pattern: RegExp; optional?: boolean; symbol?: string; }; }; } export declare class DialogFieldCategory { name: string; dialogFields: DialogField[]; hideIf?: (editItem: any) => boolean; active?: boolean; } export declare class DialogDynamicList { key: string; lookupItems?: Lookups; datasource?: DatasourceComponent; } export declare class DialogFieldButton { onButtonClicked?: (editItem: any) => void; text?: string; tooltip?: string; buttonClass?: string; iconClass?: string; position?: 'form' | 'footer-before' | 'footer-after'; submitDialog?: boolean; submitResult?: string; width?: `${number}px` | `${number}em` | `${number}%` | 'auto'; } export declare class DialogGridConfiguration extends GridConfiguration { datasource: DatasourceComponent | lookupsKey; /** * wenn gesetzt wird, wird das Grid als DropDown dargestellt */ showAsDropDownFieldName?: string; onDropdownGridShown?: (editItem: any, fieldname: string, datasource: DatasourceComponent) => void; displayFieldValue?: string; pageSize?: number; } export declare class RichTextConfiguration implements IQuillConfiguration { /** default: 'html' */ format?: 'object' | 'html' | 'text' | 'json'; /** default: 'snow' */ theme?: 'snow' | 'bubble'; readOnly?: boolean; toolbar?: QuillToolbarDefaultType | IQuillToolbarConfiguration; /** *wird nur benötigt, falls standard modules/toolbar nicht ausreicht */ modules?: QuillModules; } export declare const DIALOG_FIELD_NULLVALUE = "$NULL"; export interface IDialogConfiguration { fieldsOrCategoriesOfFields: DialogField[] | DialogFieldCategory[]; title: string; enterKeyAsTabKey?: boolean; categoriesAsTabs?: boolean; size?: DialogSize; inputSize?: DialogInputSize; hideOkButton?: boolean; hideCancelButton?: boolean; } export type DialogSize = 'small' | 'medium' | 'large'; export type DialogInputSize = 'small' | 'medium' | 'large'; export declare class GenericEditDialogResult { key: string; dto: DATATYPE; mode: MODETYPE; submitResult: string; }