import { FieldType } from '../interfaces/view'; import { ConnectedComponentClass } from 'react-redux'; import { FunctionComponent } from 'react'; import { PickMap, DataValue } from './data'; import { OperationType, OperationInclusionDescriptor } from './operation'; export declare const enum WidgetTypes { Form = "Form", List = "List", DataGrid = "DataGrid", AssocListPopup = "AssocListPopup", PickListPopup = "PickListPopup", HeaderWidget = "HeaderWidget", SecondLevelMenu = "SecondLevelMenu", ThirdLevelMenu = "ThirdLevelMenu", FourthLevelMenu = "FourthLevelMenu", WidgetCreator = "WidgetCreator", Pivot = "Pivot", DimFilter = "DimFilter", Text = "Text" } /** * Different widget types that are considered `tables` in nature for purposes of applying some shared features. * For example, autofocus on missing required field should work for tables but not forms. */ export declare const TableLikeWidgetTypes: Array; export interface WidgetFieldBase { type: FieldType; key: string; drillDown?: boolean; bgColor?: string; bgColorKey?: string; label?: string; snapshotKey?: string; hidden?: boolean; } export interface WidgetListFieldBase extends WidgetFieldBase { title: string; width?: number; } export interface WidgetFormFieldBase extends WidgetFieldBase { label: string; } export declare type AllWidgetTypeFieldBase = WidgetFormFieldBase | WidgetListFieldBase; export declare type NumberFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.number | FieldType.money | FieldType.percent; digits?: number; nullable?: boolean; }; export declare type DateFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.date; }; export declare type CheckboxFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.checkbox; }; export declare type DateTimeFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.dateTime; }; export declare type DateTimeWithSecondsFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.dateTimeWithSeconds; }; export declare type DictionaryFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.dictionary; dictionaryName?: string; }; export declare type TextFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.text; popover?: boolean; }; export declare type InputFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.input | FieldType.hint; }; export declare type MultiFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.multifield; fields: WidgetField[]; style: 'inline' | 'list'; }; export declare type MultivalueFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.multivalue | FieldType.multivalueHover; popupBcName?: string; assocValueKey?: string; associateFieldKey?: string; displayedKey?: string; }; export declare type PickListFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.pickList; popupBcName: string; pickMap: PickMap; }; export declare type InlinePickListFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.inlinePickList; searchSpec: string; popupBcName: string; pickMap: PickMap; }; export declare type FileUploadFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.fileUpload; fileIdKey: string; fileSource: string; snapshotFileIdKey?: string; }; /** * @deprecated TODO: Remove in 2.0.0 in favor of `hidden` flag of widget meta field description */ export declare type HiddenFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.hidden; }; export declare type RadioButtonFieldMeta = AllWidgetTypeFieldBase & { type: FieldType.radio; }; export declare type WidgetField = NumberFieldMeta | DateFieldMeta | DateTimeFieldMeta | DateTimeWithSecondsFieldMeta | DictionaryFieldMeta | TextFieldMeta | MultiFieldMeta | InputFieldMeta | MultivalueFieldMeta | PickListFieldMeta | InlinePickListFieldMeta | FileUploadFieldMeta | CheckboxFieldMeta | HiddenFieldMeta | RadioButtonFieldMeta; export declare type WidgetFormField = Extract; export declare type WidgetListField = Extract; /** * @param readOnly All widget fields are not editable * @param tableOperations Options for allowed on table widget actions */ export interface WidgetOptions { layout?: { header?: string[]; aside?: string[]; rows: Array<{ cols: Array<{ fieldKey: string; span?: number; }>; }>; }; tableOperations?: TableOperations; hierarchy?: WidgetTableHierarchy[]; hierarchySameBc?: boolean; hierarchyFull?: boolean; hierarchyParentKey?: string; hierarchyGroupSelection?: boolean; hierarchyGroupDeselection?: boolean; hierarchyTraverse?: boolean; hierarchyRadio?: boolean; hierarchyRadioAll?: boolean; hierarchyDisableRoot?: boolean; actionGroups?: WidgetOperations; readOnly?: boolean; /** * @deprecated TODO: Удалить в 0.2.0 */ hideActionGroups?: string[]; } export interface WidgetMeta { name: string; type: WidgetTypes | string; title: string; bcName: string; position: number; limit?: number; gridWidth: number; fields: object[]; options?: WidgetOptions; showCondition?: WidgetShowCondition; description?: string; } /** * Show widget only if certain condition is met * * Supported conditions: * - Active record for specified business component {bcName} should contain field {fieldKey} * with value {fieldValue} * * @param bcName Business component where field condition is checked * @param fieldCondition Field key and value expected from this field */ export interface WidgetShowCondition { bcName: string; isDefault: boolean; params: { fieldKey: string; value: DataValue; }; } /** * Description of the list of fields of block type. * @deprecated * Used to create a block grouping of fields * * @param blockId Block ID. * @param name The name of the block. * @param Fields an array of fields of type T. */ export interface WidgetFieldBlock { blockId: number; name: string; fields: T[]; newRow?: boolean; break?: boolean; } export declare type WidgetFieldsOrBlocks = Array>; export interface WidgetFormMeta extends WidgetMeta { type: WidgetTypes.Form; fields: WidgetFieldsOrBlocks; } export interface WidgetTableMeta extends WidgetMeta { type: WidgetTypes.List | WidgetTypes.DataGrid; fields: WidgetListField[]; } /** * Description of possible positioning options */ export declare const enum PositionTypes { Top = "Top", Bottom = "Bottom", TopAndBottom = "TopAndBottom" } /** * Description of options of allowed on table widget actions * @param position Describes position of tableOperations relatively of table */ export interface TableOperations { position?: PositionTypes; } export interface WidgetTableHierarchy { bcName: string; assocValueKey?: string; radio?: boolean; fields: WidgetListField[]; } /** * Description of the interface for the widget displaying text with support for markdowns * @param description Text to display * @param descriptionTitle Title */ export interface WidgetTextMeta extends WidgetMeta { type: WidgetTypes.Text; description: string; descriptionTitle: string; } /** * Описание операций в опциях меты виджета, через который можно настраивать их доступность * * @param include Список включаемых операций или групп операций * @param exclude Список исключаемых операций или групп операций */ export interface WidgetOperations { include?: OperationInclusionDescriptor[]; exclude?: OperationType[]; } export declare type CustomWidget = ConnectedComponentClass | FunctionComponent; /** * TODO * * @param item */ export declare function isWidgetFieldBlock(item: any): item is WidgetFieldBlock; /** * Type of pagination, either page numbers or "Load More" button */ export declare const enum PaginationMode { page = "page", loadMore = "loadMore" }