/** Angular2 */ import * as ng from "@angular/core"; import { DomSanitizer } from "@angular/platform-browser"; /** Core */ import { CoreComponent } from "cmf.core/src/core"; import { EntityTypePropertyValueType as PropertyViewerType, CollectionType } from "cmf.core/src/domain/extensions/caches/entityType"; import Cmf from "cmf.lbos"; import { PropertyContainerService } from "../propertyContainer/propertyContainerService"; import { FontSize, TextAlignment } from "cmf.core.controls/src/components/label/label"; /** * PropertyView type */ export { PropertyViewerType }; /** * Display value type, only used internally */ export declare enum DisplayValueType { NoValue = 0, Text = 1, Navigation = 2, URL = 3, HTML = 4, HeadingLabel = 5, Color = 6, Custom = 7, Image = 8, EncapsulatedHTML = 9, EntityType = 10 } /** * DisplayValue */ export interface DisplayValue { value: any; valueHtml: any; } /** * Generic property viewer component. * * ## Inputs * * label: Property label. Default "". * * value: Property value. Default is null. * * valueType: Property viewer value type. Default is PropertyViewerType.String. * * labelClasses: (Not being used) * * valueClasses: (Not being used) * * valueReferenceType: Property editor value reference type. Default is Cmf.Foundation.Common.ReferenceType.None. * * valueReferenceTypeName: Property value reference type name. Default "". * * topLeftAligned: Input to force the type of layout. * * labelHidden: Define if property editor shows the label or not. This option will only hide the label, * maintaining the label area (property label). Default is false. * * required: Determines if the field should be filled. Default is false. * * color : Label text foreground color * * fontSize : Label font size * * alignment : Label text alignment * * `CollectionType`: **collectionType** - Collection type for the property to be displayed (Array\None) * * `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) * * propertyIconClass: icon class to appear to the left of the label text. The first use case was to identify Custom Properties of an Entity. [Optional]. * * #Examples * * ```html * * * * * * * ``` */ export declare class PropertyViewer extends CoreComponent implements ng.OnChanges, ng.OnDestroy, ng.AfterViewInit { private containerService; private sanitizer; private _ngZone; /** * SetTimeout number of the reformatLinkedItems function, saved in order to cancel on destroy */ private _reformatLinkedItemsTimeout; /** * SetTimeout number of the reformatIframe function, saved in order to cancel on destroy */ private _reformatIFrameTimeout; /** * Direct reference of rich text component */ private _containerDivRef; /** * Property viewer value type. Default is PropertyViewerType.String. */ private _valueType; /** * Property viewer value reference type. Default is Cmf.Foundation.Common.ReferenceType.None; */ _valueReferenceType: Cmf.Foundation.Common.ReferenceType; /** * Property viewer value reference type name. Default is ""; */ valueReferenceTypeName: string; /** * Property string display value. Default is "". */ _displayValue: string; /** * Property display value type. Default is DisplayValueType.Text. */ _displayValueType: DisplayValueType; /** * Input to force the type of layout */ private _topLeftAlignedInput; /** * Layout type */ _topLeftLayout: boolean; /** * Internal alignment variable */ _alignment: TextAlignment; /** * Display value array */ _displayValueArray: DisplayValue[]; /** * property label. Default "". If no label is provided it will infer from type. */ label: string; /** * property value. Default is null. */ value: any; /** * Property Viewer font size */ valueFontSize: FontSize; /** * Label font size */ fontSize: FontSize; /** * Label text Alignment */ alignment: TextAlignment; /** * Label text foreground color */ color: string; /** * Determines if the field should be filled. Default is false. */ required: boolean; /** * Hide label and maintain label area (maintain global form format) */ labelHidden: boolean; /** * If property editor shows the label */ showLabel: boolean; /** * Property label symbol. */ symbol: string; /** * Property used to indicate if symbol should be enclosed in parentheses */ symbolParentheses: boolean; /** * If this propertyViewer is sibling of a propertyEditor */ propertyEditorSibling: boolean; /** * If value is an array, by default is false */ collectionType: CollectionType; /** * If the property viewer has a forced layout applied */ hasForcedLayout: boolean; /** * Gets or sets if the navigation component is display only */ isDisplayOnly: boolean; /** * Nested viewer type getter/setter */ nestedViewerType: DisplayValueType | string; /** * Property viewer value reference type getter * * @return {Cmf.Foundation.Common.ReferenceType} */ /** * Property viewer value reference type setter * * @param {Cmf.Foundation.Common.ReferenceType} [value] */ valueReferenceType: Cmf.Foundation.Common.ReferenceType | string; /** * Label always on top */ topLabel: boolean; /** * Getter top left aligned input */ /** * Setter top left aligned input. Used to force a layout type */ topLeftAligned: boolean; /** * Property viewer type getter * * @return {PropertyViewerType} */ /** * Property viewer type setter * @param {PropertyViewerType} [value] */ valueType: PropertyViewerType | string; /** * Icon class for the property label. */ propertyIconClass: string; /** * Constructor */ constructor(containerService: PropertyContainerService, sanitizer: DomSanitizer, _ngZone: ng.NgZone); /** * 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; /** * Property viewer value field update method */ private updateValue; /** * Convert value to a display value */ private translateValue; /** * Add action to apply valueHTML as iFrame contents * @param securityCounter Parameter to avoid infinite recursion */ private reFormatIFrame; /** * Add action to open each image on a new tab and ensure all links always open on new tabs * @param securityCounter Parameter to avoid infinite recursion */ private reFormatLinkedItems; /** * Open image in another tab */ openImageInAnotherTab(imageURL: string): void; /** * On changes method - update property viewer value field */ ngOnChanges(changes: ng.SimpleChanges): void; /** * On component destruction - unsubscribe events. */ ngOnDestroy(): void; /** * after view init */ ngAfterViewInit(): void; } export declare class PropertyViewerModule { }