/** Angular2 */ import * as ng from "@angular/core"; /** Core */ import { CoreComponent } from "cmf.core/src/core"; import { EntityTypePropertyValueType as PropertyEditorType, CollectionType as PropertyEditorCollectionType } from "cmf.core/src/domain/extensions/caches/entityType"; import Cmf from "cmf.lbos"; /** Nested components*/ import { TextAlignment, FontSize } from "cmf.core.controls/src/components/label/label"; import { InputEditorType } from "cmf.core.controls/src/components/input/input"; import { FindEntityExclusions } from "../findEntity/findEntity"; import { EnumComboBoxOrderField } from "../enumComboBox/enumComboBox"; import { EnumDropdownElement } from "../enumDropdown/enumDropdown"; import { OnValidate, OnValidateArgs, ValidatorModel } from "cmf.core.controls/src/directives/validator/validator"; import { PropertyContainerService } from "../propertyContainer/propertyContainerService"; import { ModuleLoaderComponent } from 'cmf.core/src/domain/extensions/module.loader'; import { ValueValidator } from "cmf.core.controls/src/components/multiStringInput/multiStringInput"; import { OnLayout, LayoutBaseDef } from "cmf.core.controls/src/directives/layout/layoutDef"; export { FindEntityExclusions }; /** * Enum combobox orderFields */ export { EnumComboBoxOrderField }; /** * PropertyEditor type */ export { PropertyEditorType }; /** * PropertyEditorCollectionType type */ export { PropertyEditorCollectionType }; /** * Display value type, only used internally */ export declare enum EditorType { Input = 0, Select = 1, ComboBox = 2, FindEntity = 3, RolesComboBox = 4, EnumComboBox = 5, LookupComboBox = 6, Radio = 7, Custom = 8, FindStatic = 9, EntityComboBox = 10, EnumsComboBox = 11, CheckBox = 12, SelectExpanded = 13, StateModelsComboBox = 14, StateModelStatesComboBox = 15, RichInput = 16, EnumDropdown = 17, LookupDropdown = 18, FolderComboBox = 19, EntityTypeProperty = 20, TextArea = 21, CodeEditor = 22, Image = 23 } /** * ValueValidator */ export { ValueValidator }; /** * Layout definition for PropertyEditor */ export declare class PropertyEditorLayoutDef extends LayoutBaseDef { value: any; } /** * @whatItDoes * Generic property editor component * * @howToUse * This component is used with the inputs and outputs mentioned below. * * ### Inputs * `boolean` : **disabled** - Defines if the element is disabled; * `boolean` : **required** - Determines if the field should be filled. Default is false; * `string` : **label** - Property label. Default "". If no label is provided it will infer from type; * `string` : **symbol** - Property symbol. Default "". Symbol added to the label between (); * `boolean` : **showLabel** - Define if property editor shows the property label or not. * This option will collapse all label area - use only if you want to expand the control. * Takes precedence over "labelHidden". Default is true; * `boolean` : **labelHidden** - Define if property editor shows the label or not. This option will only hide the label, * maintaining the label area (property label) - use if you want to maintain the global form format. Default is false; * `string` : **placeholder** - Placeholder value, for inputs. Default is ""; * `any` : **value** - Property value. Default is null; * `value: EditorType | string` : **nestedEditorType** - Property editor input type. Default is InputType.Input; * `boolean` : **topLeftAligned** - Input to force the type of layout; * `boolean` : **topLabel** - Should the label be aligned vertically to the top; * `any[]` : **data** - The data collection, used to populate the nested select/comboBox components; * `string` : **dataNameField** - The object field that should be accessed to get the name to display on the nested select/selectExpanded/comboBox. * Default is "Name"; * `number`: **customPropertyMinWidth** - Custom min width for property editor (useful when property editor is in a small place and label is required * to remain in the left and not on top); * `string` : **dataComparisonField** - The object field designation that will be used to compare elements; * When you want to provide the selected element as a string, the field of the object to be used in the comparison should be indicated here; * `string` : **dataColorField** - The object field that should be accessed to get the color to display on the nested selectExpanded. Default is "Color"; * `string` : **dataDisabledField** - The object field that should be accessed to determine if the element will appear disabled or not; * `string` : **comboboxEnabledField** - The object field that should be accessed to determine if the combobox position will appear disabled or not; * Default is "Disabled" ; * `string` : **rowTemplate** - Row template to be used with the editor type comboBox; * `boolean` : **singleElementPreSelect** - Defines if the component should pre-select when there's only one element available. Default is 'true'; * `string[]` : **itemsToIgnore** - An array of items to ignore. The items of the array will be compared with both keys and values of the enum. * orderField The object field that will be used to sort the values in the comboBox - used in lookupTableComboBox, enumComboBox, rolesComboBox. * `string` : **dataSecondNameField** - The object field that should be accessed to get the second name to display on the nested selectExpanded. * Default is "SecondName". Select expanded related; * `value: PropertyEditorType | string` : **valueType** - Property editor value type. Default is PropertyEditorType.String; * `Cmf.Foundation.Common.ReferenceType | string` : **valueReferenceType** - Property editor value reference type; * Default is Cmf.Foundation.Common.ReferenceType.None ; * `PropertyEditorCollectionType | string` : **collectionType** - Indicates the type of list in what the property will be displayed; * Note that this representation might not be available for all types (value and reference types). Default is false; * If Array available only for String * `string` : **referenceTypeName** - Property editor reference type name. Default is "". Used as entityTypeName, LookupTableName, enumPath; * `string` : **referenceTypeId** - Property editor reference type Id. Default is "". Used for entityTypeId, LookupTableId; * `number` : **step** - Spinner step (used in input types: Integer, Decimal, Long); * `number` : **min** - Minimum Value. Only used for numeric inputs; * `number` : **max** - Maximum Value. Only used for numeric inputs; * `Cmf.Foundation.Common.RangeType` : **rangeType** - Range Type. Used in conjunction with max and min properties; * `number` : **numberOfDecimals** - Maximum number of decimal places. Above this number, the value is rounded. This value is defined externally; * `any` : **additionalFilters** - Find entity additional filters; * `boolean` : **showAdditionalFields**: If additional fields appear in the the listed items; * `Array` : **additionalFields** - Additional entity fields to be retrieved by the control. * Used in FindEntity; * `Cmf.Foundation.BusinessObjects.Entity` : **secondaryRowTextGenerator** - Secondary row transformation function returning the string * to be shown bellow each value; * `Cmf.Foundation.BusinessObjects.QueryObject.QueryObject` : **entityTypeQuery** - if working with a reference type -> entity type -> (any entity type), * `FindEntityExclusions` : **exclusions** - Defines the types of entities that will be excluded; * optionally select a query for find entity; * `boolean` : **autoResize** - Used to auto-resize component (if option is available). Default is true; * `string` : **color** - Label text foreground color; * `FontSize` : **fontSize** - Label font size; * `TextAlignment` : **alignment** - Label text alignment; * `boolean` : **includeRelations** - If relation entity types are included in entity combo box - used in EntityComboBox and Entity property input; * `any` : **onlyWithStateModels** - If we want only the entities with state models to show up on EntityComboBox; * `boolean` : **enumUsingRadioButtons** - If type os Enum, use the Radio Buttons controls instead of the comboBox; * `ValueValidator` : **valueValidator** - Defines a function to validate the input value, with return Promise; * `disableUnselect` : **boolean** - The object field that should be accessed to set if unselect is disabled; * `boolean` : **supportTokens** - Defines if tokens are to be supported. Currently only used in input control. Defaults to false; * `string` : **propertyIconClass** - icon class to appear to the left of the label text; * `boolean` : **allowCustomValue** - Defines if the component should allow user text. Default is 'false'. * The first use case was to identify Custom Properties of an Entity. [Optional]; * * ### Outputs * `any` : **valueChange** - Value change event, so the component can inform the upper components that the value has changed; * * ### Example * To use the component, assume this HTML Template as an example: * * ```html * * * * * * * * * * * * * * * * * ``` */ export declare class PropertyEditor extends CoreComponent implements ng.OnChanges, OnValidate, ng.AfterViewInit, ng.OnDestroy, OnLayout { private elementRef; private _changeDetectorRef; private _loader; private _validatorModel; private containerService; /** * Internal value */ private _internalValue; /** * Property editor input type. Default is InputType.Input. */ private _nestedEditorType; /** * Defines if the element is disabled by an external condition */ private _disabledSet; /** * Defines if the element is disabled by an internal condition */ private _internalDisabled; /** * Input to force the type of layout */ private _topLeftAlignedInput; /** * Query with all the location directives that will be used to instantiate the diagrams */ private _locations; /** * Find entity additional filters */ private additionalFilters; /** * property value. Default is null. */ private _value; /** * If additional fields appear in listed items */ showAdditionalFields: boolean; /** * Boolean flag that controls wether symbol was set by input */ private _userSetSymbol; /** * Property editor input type. Default is InputType.Input. */ _editorType: EditorType; /** * Property editor input type. */ _inputEditorType: InputEditorType; /** * Property editor value type. Default is PropertyEditorType.String. */ _valueType: PropertyEditorType; /** * The validator function that will be used to pass conditions about the input */ _valueValidator: ValueValidator; /** * Indicates the type of list in what the property will be displayed. Note that this representation might not be available for all types (value and reference types). Default is false. * */ _collectionType: PropertyEditorCollectionType; /** * Property editor value reference type. Default is Cmf.Foundation.Common.ReferenceType.None; */ _valueReferenceType: Cmf.Foundation.Common.ReferenceType; /** * Find entity additional filters */ _additionalFilters: Array; /** * Holds the disabled state of the property editor based on internal and external disable conditions. * Stores the hold condition of the expression (_disabledSet || _internalDisabled). */ _disabled: boolean; /** * Layout type */ _topLeftLayout: boolean; /** * Internal alignment variable */ _alignment: TextAlignment; /** * The object field that will be used to sort the values in the comboBox - used in lookupTableComboBox, enumComboBox, rolesComboBox */ _orderField: string; /** * Find entity navigable */ findEntityNavigable: boolean; /** * The object field that should be accessed to set if unselect is disabled. Used by selectExpanded. Default is "false". */ disableUnselect: boolean; /** * Label always on top */ topLabel: boolean; /** * Placeholder value, for inputs. Default is "". */ placeholder: string; /** * property label. Default "". If no label is provided it will infer from type. */ label: string; /** * Hide label and maintain label area (maintain global form format) */ labelHidden: boolean; /** * Defines if tokens are supported. * Currently only implemented for the input control. * Defaults to false. */ supportTokens: boolean; /** * Property label symbol. */ /** * Property label symbol. */ symbol: string; /** * Icon class for the property label. */ propertyIconClass: string; /** * If property editor shows the label */ showLabel: boolean; /** * If property set, auto-resize component */ autoResize: boolean; /** * If property set, include relation entity types in entity combo box */ /** * If property get, include relation entity types in entity combo box */ includeRelations: boolean; /** * Holds the include relations input */ _includeRelations: boolean; /** * If type os Enum, use the Radio Buttons controls instead of the comboBox */ enumUsingRadioButtons: boolean; /** * Get value */ /** * Set value */ value: any; /** * Symbol being added to the label */ _symbol: string; /** * The data collection, used to populate the nested select/comboBox component * * @property {any[]} Array of objects that represent the items that will appear in the select/comboBox component */ data: any[]; /** * Property editor reference type Id. Default is "". Used for entityTypeId, LookupTableId */ referenceTypeId: string; /** * Property editor reference type name. Default is "". Used as entityTypeName, LookupTableName, enumPath */ referenceTypeName: string; /** * if working with a reference type -> entity type -> (any entity type), optionally select a query for find entity */ entityTypeQuery: Cmf.Foundation.BusinessObjects.QueryObject.QueryObject; /** * The object field that should be accessed to get the name to display on the nested select/selectExpanded/comboBox. Default is "Name". * * @property {string} the field designation */ dataNameField: string; /** * The object field designation that will be used to compare elements. * When you want to provide the selected element as a string, the field of the object to be used in the comparison should be indicated here. * * @property {string} the field designation */ dataComparisonField: string; /** * The object field that should be accessed to get the second name to display on the nested selectExpanded. Default is "SecondName". * * @property {string} the field designation */ dataSecondNameField: string; /** * The object field that should be accessed to get the color to display on the nested selectExpanded. Default is "Color". * * @property {string} the field designation */ dataColorField: string; /** * The object field that should be accessed to determine if the element will appear disabled or not. Default is "Disabled". * * @property {string} the field designation */ dataDisabledField: string; /** * The object field that should be accessed to determine if the combo element will appear disabled or not. Default is "Enable". * * @property {string} the field designation */ comboboxEnabledField: string; /** * Entity Type Name of Entity property belongs to. Currently is used for state models in order to choose which state model to show * */ propertyParentEntityTypeName: string; /** * Additional entity fields to be retrieved by the control. * Used internally by FindEntity * * ### Example * ``` * * * ``` */ additionalFields: string[]; /** * Find entity query exclusions. By default it excludes the entities of type 'terminated' and 'templates' */ findEntityExclusions: FindEntityExclusions; /** * Secondary row transformation function returning the string to be shown bellow each value * Used internally by FindEntity */ secondaryRowTextGenerator: (entity: Cmf.Foundation.BusinessObjects.Entity) => string; /** * Property editor value reference type getter */ valueReferenceType: Cmf.Foundation.Common.ReferenceType | string; /** * Property editor type getter/setter */ valueType: PropertyEditorType | string; /** * Property editor type getter/setter */ collectionType: PropertyEditorCollectionType | string; /** * Value validator getter/setter */ valueValidator: ValueValidator; /** * Nested editor type getter/setter */ nestedEditorType: EditorType | string; /** * Gets the disabled state of the property editor based on internal and external disable conditions. */ /** * Allows setting the disabled state of the property editor */ disabled: boolean; /** * Determines if the field should be filled. Default is false. */ required: boolean; /** * An array of items to ignore. The items of the array will be compared with both keys and values of the enum */ itemsToIgnore: string[]; /** * The object field that will be used to sort the values in the comboBox - used in lookupTableComboBox, enumComboBox, rolesComboBox */ orderField: string; /** * Spinner step (used in input types: Integer, Decimal, Long) */ step: number; /** * Minimum Value * Only used for numeric inputs */ min: number; /** * Maximum Value * Only used for numeric inputs */ max: number; /** * Range Type * Used in conjunction with max and min properties. */ rangeType: Cmf.Foundation.Common.RangeType; /** * Maximum number of decimal places. Above this number, the value is rounded. This value is defined externally */ numberOfDecimals: number; /** * Row template to be used with the editor type comboBox */ rowTemplate: string; /** * Defines if the component should pre-select when there's only one element available. Default is 'true'. */ /** * Defines if the component should pre-select when there's only one element available. Default is 'true'. */ singleElementPreSelect: boolean; /** * Holds the single element pre select */ _singleElementPreSelect: boolean; /** * If pre-select single element value is set, use it. Otherwise, only pre-select if the field is required. */ singleElementPreSelectOrRequired: boolean; /**_allowCustomValue * Gets/Sets the allowCustomValue Property. */ /** * Sets the allowCustomValue Property */ allowCustomValue: boolean; /** * Defines if the component should allow user text. Default is 'false'. */ _allowCustomValue: boolean; /** * Value change event, so the component can inform the upper components that the selected value has changed */ valueChanged: ng.EventEmitter; /** * Getter top left aligned input */ /** * Setter top left aligned input. Used to force a layout type */ topLeftAligned: boolean; /** * Label font size */ fontSize: FontSize; /** * Label text alignment */ alignment: TextAlignment; /** * Label text foreground color */ color: string; /** * CodeEditor ModuleLoaderComponent */ codeEditorLoaderComponent: ModuleLoaderComponent; /** * CodeEditor ComponentRef */ componentRef: ng.ComponentRef[]; /** * If the property viewer has a forced layout applied */ hasForcedLayout: boolean; constructor(elementRef: ng.ElementRef, _changeDetectorRef: ng.ChangeDetectorRef, _loader: ng.NgModuleFactoryLoader, _validatorModel: ValidatorModel, containerService: PropertyContainerService); /** * This method updates private var _topLeftLayout, but since this var is bound via the ngClass use, * we need to prevent the ExpressionChangedAfterItHasBeenCheckedError * whenever the ngClass is re-checked on a changeDetection cycle. * * @private * @param {boolean} value new value for the _topLeftLayout * * @memberOf PropertyViewer */ private refreshTopLeftLayout; private getErrorMessage; /** * Property editor value field update method */ private updateTypings; private onSizeChange; /** * Update codeEditor inputs */ private updateCodeEditorInputs; /** * To improve performance, we only instantiate the codeEditor when we need. * (This is done like this to avoid unnecessary imports) */ private instantiateCodeEditor; /** * Handles the output of the lookup dropdown before emitting the event */ onLookupDropdownValueChange(value: Cmf.Foundation.BusinessObjects.LookupTableValue | Cmf.Foundation.BusinessObjects.LookupTableValue[]): void; /** * Handles the output of the enum dropdown before emitting the event */ onEnumDropdownValueChange(value: EnumDropdownElement | EnumDropdownElement[]): void; /** * On changes method - update property editor value field */ ngOnChanges(changes: ng.SimpleChanges): void; /** * On component destruction - unsubscribe events. */ ngOnDestroy(): void; /** * after view init */ ngAfterViewInit(): void; /** * When input value changes - notify parent component */ onValueChange(value: any): void; /** * On Validate * @param args */ onValidate(args: OnValidateArgs): Promise; /** * Resets the styling option of the validation process * * @see OnValidate interface */ reset(): Promise; /** * Focus the caret on the input */ focus(): void; OnComponentCodeEditorRefChange(ref: ng.ComponentRef[]): void; /** * Load layout */ onLoadLayout(layoutDef: PropertyEditorLayoutDef): Promise; /** * Save current layout */ onSaveLayout(): Promise; } export declare class PropertyEditorModule { }